diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-03-16 11:16:48 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-03-16 18:26:29 +0000 |
commit | 327fcc7fd3396219a29a6c8d38dc4774e410c1e9 (patch) | |
tree | 12d594340295fe58efe0a35a7ab266bf09f2990d /tests | |
parent | 29a9f9d6e4ad9ffee62d3633edb17c1be335203e (diff) |
Switch cookie-filter API to std::function
Allows us to use return value instead of magic properties
Task-number: QTBUG-66825
Change-Id: I55202a7aca2e662bc214b05caf767d2da496f026
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp | 4 | ||||
-rw-r--r-- | tests/quicktestbrowser/main.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp index 913614df2..4350575ab 100644 --- a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp +++ b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp @@ -193,7 +193,7 @@ void tst_QWebEngineCookieStore::basicFilter() QWebEngineCookieStore *client = m_profile.cookieStore(); QAtomicInt accessTested = 0; - client->setCookieFilter([&](QWebEngineCookieStore::FilterRequest &){ ++accessTested; }); + client->setCookieFilter([&](const QWebEngineCookieStore::FilterRequest &){ ++accessTested; return true;}); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); QSignalSpy cookieAddedSpy(client, SIGNAL(cookieAdded(const QNetworkCookie &))); @@ -209,7 +209,7 @@ void tst_QWebEngineCookieStore::basicFilter() client->deleteAllCookies(); QTRY_COMPARE(cookieRemovedSpy.count(), 2); - client->setCookieFilter([&](QWebEngineCookieStore::FilterRequest &request){ ++accessTested; request.accepted = false; }); + client->setCookieFilter([&](const QWebEngineCookieStore::FilterRequest &){ ++accessTested; return false; }); page.triggerAction(QWebEnginePage::ReloadAndBypassCache); QTRY_COMPARE(loadSpy.count(), 1); QVERIFY(loadSpy.takeFirst().takeFirst().toBool()); diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp index d56841974..45661b5d4 100644 --- a/tests/quicktestbrowser/main.cpp +++ b/tests/quicktestbrowser/main.cpp @@ -80,9 +80,9 @@ int main(int argc, char **argv) Q_ASSERT(index != -1); QMetaProperty thirdPartyCookiesProperty = rootMeta->property(index); profile->cookieStore()->setCookieFilter( - [rootObject,&thirdPartyCookiesProperty](QWebEngineCookieStore::FilterRequest &request) + [rootObject,&thirdPartyCookiesProperty](const QWebEngineCookieStore::FilterRequest &request) { - request.accepted = !request.thirdParty || thirdPartyCookiesProperty.read(rootObject).toBool(); + return !request.thirdParty || thirdPartyCookiesProperty.read(rootObject).toBool(); }); index = rootMeta->indexOfProperty("testProfile"); |