summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-18 16:56:06 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-18 16:56:06 +0100
commit440fbed83646f16bf002749f7cecf6ad6fc59bbf (patch)
tree231874f011a96d23061822d97bf70f52fc23617d /tests
parentbc315ce05298cf500f45f3a897b0f7c0408fd611 (diff)
parentc506d1d867f827dbff405d8e789ab4810410079a (diff)
Merge branch '5.6' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp44
-rw-r--r--tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp9
-rw-r--r--tests/quicktestbrowser/BrowserWindow.qml8
-rw-r--r--tests/quicktestbrowser/main.cpp8
4 files changed, 28 insertions, 41 deletions
diff --git a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
index 9436b093e..7cf55427e 100644
--- a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
+++ b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
@@ -95,6 +95,7 @@ void tst_QWebEngineCookieStore::cookieSignals()
{
QWebEngineView view;
QWebEngineCookieStore *client = view.page()->profile()->cookieStore();
+ client->deleteAllCookies();
QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
QSignalSpy cookieAddedSpy(client, SIGNAL(cookieAdded(const QNetworkCookie &)));
@@ -110,6 +111,7 @@ void tst_QWebEngineCookieStore::cookieSignals()
// try whether updating a cookie to be expired results in that cookie being removed.
QNetworkCookie expiredCookie(QNetworkCookie::parseCookies(QByteArrayLiteral("SessionCookie=delete; expires=Thu, 01-Jan-1970 00:00:00 GMT; path=///resources")).first());
client->setCookie(expiredCookie, QUrl("qrc:///resources/index.html"));
+
QTRY_COMPARE(cookieRemovedSpy.count(), 1);
cookieRemovedSpy.clear();
@@ -123,6 +125,7 @@ void tst_QWebEngineCookieStore::setAndDeleteCookie()
{
QWebEngineView view;
QWebEngineCookieStore *client = view.page()->profile()->cookieStore();
+ client->deleteAllCookies();
QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
QSignalSpy cookieAddedSpy(client, SIGNAL(cookieAdded(const QNetworkCookie &)));
@@ -134,8 +137,10 @@ void tst_QWebEngineCookieStore::setAndDeleteCookie()
QNetworkCookie expiredCookie3(QNetworkCookie::parseCookies(QByteArrayLiteral("SessionCookie=delete; expires=Thu, 01-Jan-1970 00:00:00 GMT; path=///resources")).first());
// check if pending cookies are set and removed
- client->setCookieWithCallback(cookie1, [](bool success) { QVERIFY(success); });
- client->setCookieWithCallback(cookie2, [](bool success) { QVERIFY(success); });
+ client->setCookie(cookie1);
+ QTRY_COMPARE(cookieAddedSpy.count(),1);
+ client->setCookie(cookie2);
+ QTRY_COMPARE(cookieAddedSpy.count(),2);
client->deleteCookie(cookie1);
view.load(QUrl("qrc:///resources/content.html"));
@@ -148,9 +153,10 @@ void tst_QWebEngineCookieStore::setAndDeleteCookie()
cookieAddedSpy.clear();
cookieRemovedSpy.clear();
- client->setCookieWithCallback(cookie3, [](bool success) { QVERIFY(success); });
+ client->setCookie(cookie3);
+ QTRY_COMPARE(cookieAddedSpy.count(), 1);
// updating a cookie with an expired 'expires' field should remove the cookie with the same name
- client->setCookieWithCallback(expiredCookie3, [](bool success) { QVERIFY(success); });
+ client->setCookie(expiredCookie3);
client->deleteCookie(cookie2);
QTRY_COMPARE(cookieAddedSpy.count(), 1);
QTRY_COMPARE(cookieRemovedSpy.count(), 2);
@@ -160,6 +166,7 @@ void tst_QWebEngineCookieStore::batchCookieTasks()
{
QWebEngineView view;
QWebEngineCookieStore *client = view.page()->profile()->cookieStore();
+ client->deleteAllCookies();
QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
QSignalSpy cookieAddedSpy(client, SIGNAL(cookieAdded(const QNetworkCookie &)));
@@ -168,10 +175,10 @@ void tst_QWebEngineCookieStore::batchCookieTasks()
QNetworkCookie cookie1(QNetworkCookie::parseCookies(QByteArrayLiteral("khaos=I9GX8CWI; Domain=.example.com; Path=/docs")).first());
QNetworkCookie cookie2(QNetworkCookie::parseCookies(QByteArrayLiteral("Test%20Cookie=foobar; domain=example.com; Path=/")).first());
- int capture = 0;
-
- client->setCookieWithCallback(cookie1, [&capture](bool success) { QVERIFY(success); ++capture; });
- client->setCookieWithCallback(cookie2, [&capture](bool success) { QVERIFY(success); ++capture; });
+ client->setCookie(cookie1);
+ QTRY_COMPARE(cookieAddedSpy.count(), 1);
+ client->setCookie(cookie2);
+ QTRY_COMPARE(cookieAddedSpy.count(), 2);
view.load(QUrl("qrc:///resources/index.html"));
@@ -180,28 +187,15 @@ void tst_QWebEngineCookieStore::batchCookieTasks()
QVERIFY(success.toBool());
QTRY_COMPARE(cookieAddedSpy.count(), 4);
QTRY_COMPARE(cookieRemovedSpy.count(), 0);
- QTRY_COMPARE(capture, 2);
- capture = 0;
cookieAddedSpy.clear();
cookieRemovedSpy.clear();
- client->getAllCookies([&capture](const QByteArray& cookieLine) {
- ++capture;
- QCOMPARE(QNetworkCookie::parseCookies(cookieLine).count(), 4);
- });
-
- client->deleteSessionCookiesWithCallback([&capture](int numDeleted) {
- ++capture;
- QCOMPARE(numDeleted, 3);
- });
-
- client->deleteAllCookiesWithCallback([&capture](int numDeleted) {
- ++capture;
- QCOMPARE(numDeleted, 1);
- });
+ client->deleteSessionCookies();
+ QTRY_COMPARE(cookieRemovedSpy.count(), 3);
- QTRY_COMPARE(capture, 3);
+ client->deleteAllCookies();
+ QTRY_COMPARE(cookieRemovedSpy.count(), 4);
}
QTEST_MAIN(tst_QWebEngineCookieStore)
diff --git a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
index a969993ff..eacd1f87e 100644
--- a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
+++ b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
@@ -52,12 +52,19 @@
class TestView : public QQuickView {
Q_OBJECT
public:
+ TestView()
+ {
+ connect(this, &TestView::_q_exposeChanged, this, &TestView::exposeChanged,
+ Qt::QueuedConnection);
+ }
+
virtual void exposeEvent(QExposeEvent *e) Q_DECL_OVERRIDE {
QQuickView::exposeEvent(e);
- emit exposeChanged();
+ emit _q_exposeChanged();
}
Q_SIGNALS:
+ void _q_exposeChanged();
void exposeChanged();
};
diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml
index 3fcca4aab..cf583c60d 100644
--- a/tests/quicktestbrowser/BrowserWindow.qml
+++ b/tests/quicktestbrowser/BrowserWindow.qml
@@ -79,7 +79,6 @@ ApplicationWindow {
property alias javaScriptEnabled: javaScriptEnabled.checked;
property alias errorPageEnabled: errorPageEnabled.checked;
property alias pluginsEnabled: pluginsEnabled.checked;
- property alias thirdPartyCookiesEnabled: thirdPartyCookiesEnabled.checked;
}
// Make sure the Qt.WindowFullscreenButtonHint is set on OS X.
@@ -255,13 +254,6 @@ ApplicationWindow {
checked: true
}
MenuItem {
- id: thirdPartyCookiesEnabled
- text: "Third party cookies enabled"
- checkable: true
- checked: true
- onToggled: applicationRoot.thirdPartyCookiesEnabled = checked
- }
- MenuItem {
id: offTheRecordEnabled
text: "Off The Record"
checkable: true
diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp
index 61977a018..85a02ab34 100644
--- a/tests/quicktestbrowser/main.cpp
+++ b/tests/quicktestbrowser/main.cpp
@@ -86,15 +86,9 @@ int main(int argc, char **argv)
QObject *rootObject = appEngine.rootObjects().first();
QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(rootObject);
- QWebEngineCookieStore *client = profile->cookieStore();
const QMetaObject *rootMeta = rootObject->metaObject();
- int index = rootMeta->indexOfProperty("thirdPartyCookiesEnabled");
- Q_ASSERT(index != -1);
- QMetaProperty thirdPartyCookiesProperty = rootMeta->property(index);
- client->setCookieFilter([rootObject,&thirdPartyCookiesProperty](const QWebEngineCookieStore::FilterRequest&){ return thirdPartyCookiesProperty.read(rootObject).toBool(); });
-
- index = rootMeta->indexOfProperty("testProfile");
+ int index = rootMeta->indexOfProperty("testProfile");
Q_ASSERT(index != -1);
QMetaProperty profileProperty = rootMeta->property(index);
profileProperty.write(rootObject, qVariantFromValue(profile));