summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-12-16 14:33:28 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-12-18 00:08:02 +0100
commit4754121b79ae9129742d141bccf436cf9b30b986 (patch)
tree2ead9ab560e6ae77c04d19ecccf31cfd02f732f9 /tests
parent2681f86b2b24440950ea5c254b3d2e2bf8d40688 (diff)
Stabilize tst_qwebengineurlrequestinterceptor
One of our macOS test machines has become remarkably slower recently. Pick-to: 6.3 Change-Id: I375c92f9c52054190a79d7793849f2783c98baa8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index 94669c4ca..14d045613 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -231,7 +231,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest()
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
page.load(QUrl("qrc:///resources/index.html"));
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
QVariant success = loadSpy.takeFirst().takeFirst();
QVERIFY(success.toBool());
loadSpy.clear();
@@ -247,7 +247,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest()
interceptor.shouldRedirect = true;
page.load(QUrl("qrc:///resources/__placeholder__"));
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
success = loadSpy.takeFirst().takeFirst();
// The redirection for __placeholder__ should succeed.
QVERIFY(success.toBool());
@@ -258,7 +258,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest()
TestRequestInterceptor observer(/* intercept */ false);
profile.setUrlRequestInterceptor(&observer);
page.load(QUrl("qrc:///resources/__placeholder__"));
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
success = loadSpy.takeFirst().takeFirst();
// Since we do not intercept, loading an invalid path should not succeed.
QVERIFY(!success.toBool());
@@ -331,7 +331,7 @@ void tst_QWebEngineUrlRequestInterceptor::requestedUrl()
page.setUrl(QUrl("qrc:///resources/__placeholder__"));
QVERIFY(spy.wait());
- QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 20000);
QVERIFY(interceptor.requestInfos.count() >= 1);
QCOMPARE(interceptor.requestInfos.at(0).requestUrl, QUrl("qrc:///resources/content.html"));
QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__"));
@@ -340,14 +340,14 @@ void tst_QWebEngineUrlRequestInterceptor::requestedUrl()
interceptor.shouldRedirect = false;
page.setUrl(QUrl("qrc:/non-existent.html"));
- QTRY_COMPARE(spy.count(), 2);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 2, 20000);
QVERIFY(interceptor.requestInfos.count() >= 3);
QCOMPARE(interceptor.requestInfos.at(2).requestUrl, QUrl("qrc:/non-existent.html"));
QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__"));
QCOMPARE(page.url(), QUrl("qrc:///resources/content.html"));
page.setUrl(QUrl("http://abcdef.abcdef"));
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 15000);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 20000);
QVERIFY(interceptor.requestInfos.count() >= 4);
QCOMPARE(interceptor.requestInfos.at(3).requestUrl, QUrl("http://abcdef.abcdef/"));
QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__"));
@@ -444,7 +444,7 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes()
QWebEnginePage page(&profile);
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
page.setUrl(requestUrl);
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
QVERIFY(interceptor.requestInfos.count() >= 1);
RequestInfo info = interceptor.requestInfos.at(0);
@@ -534,7 +534,7 @@ void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType()
QWebEnginePage page(&profile);
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
page.setUrl(firstPartyUrl);
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
QTRY_COMPARE(interceptor.getUrlRequestForType(static_cast<QWebEngineUrlRequestInfo::ResourceType>(resourceType)).count(), 1);
QList<RequestInfo> infos = interceptor.getUrlRequestForType(static_cast<QWebEngineUrlRequestInfo::ResourceType>(resourceType));
@@ -735,7 +735,7 @@ void tst_QWebEngineUrlRequestInterceptor::jsServiceWorker()
QVERIFY(loadSync(page.get(), server.url("/sw.html")));
// We expect only one message here, because logging of services workers is not exposed in our API.
- QTRY_COMPARE(page->messages.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(page->messages.count(), 1, 20000);
QCOMPARE(page->levels.at(0), QWebEnginePage::InfoMessageLevel);
QUrl firstPartyUrl = QUrl(server.url().toString() + "sw.js");
@@ -804,7 +804,7 @@ void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor()
});
page.setUrl(server.url("/favicon.html"));
- QTRY_COMPARE(spy.count(), 2);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 2, 20000);
QTRY_VERIFY(fetchFinished);
QString s; QDebug d(&s);
@@ -848,7 +848,7 @@ void tst_QWebEngineUrlRequestInterceptor::replaceOnIntercept()
};
page.setUrl(server.url("/favicon.html"));
- QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 20000);
QTRY_COMPARE(profileInterceptor.requestInfos.size(), 2);
// if interceptor for page was replaced on intercept call in profile then, since request first