diff options
Diffstat (limited to 'tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp')
-rw-r--r-- | tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 4a261c46b..c4461f1c1 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -100,15 +100,14 @@ public: QList<QUrl> firstPartyUrls; bool shouldIntercept; - bool interceptRequest(QWebEngineUrlRequestInfo &info) override + void interceptRequest(QWebEngineUrlRequestInfo &info) override { info.block(info.requestMethod() != QByteArrayLiteral("GET")); - if (info.requestUrl().toString().endsWith(QLatin1String("__placeholder__"))) + if (shouldIntercept && info.requestUrl().toString().endsWith(QLatin1String("__placeholder__"))) info.redirect(QUrl("qrc:///resources/content.html")); observedUrls.append(info.requestUrl()); firstPartyUrls.append(info.firstPartyUrl()); - return shouldIntercept; } TestRequestInterceptor(bool intercept) : shouldIntercept(intercept) @@ -162,11 +161,10 @@ class LocalhostContentProvider : public QWebEngineUrlRequestInterceptor public: LocalhostContentProvider() { } - bool interceptRequest(QWebEngineUrlRequestInfo &info) override + void interceptRequest(QWebEngineUrlRequestInfo &info) override { requestedUrls.append(info.requestUrl()); info.redirect(QUrl("data:text/html,<p>hello")); - return true; } QList<QUrl> requestedUrls; |