summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2023-05-03 08:44:05 +0200
committerMichal Klocek <michal.klocek@qt.io>2023-05-03 12:35:32 +0200
commit6fc3c079851f4d11e70579cf3a5e423800b362f7 (patch)
treea5a158cccfd2ea6fff0e6d483ae7c69dbfafdf0f
parent4aca44bbf6d63c6a73cb9c3220055a39c4cbd2b1 (diff)
downloadqtwebengine-6fc3c079851f4d11e70579cf3a5e423800b362f7.tar.gz
Increase load timeout for tst_qwebengineglobalsettings
Increase the timeout for load function as it tries to use network. Do not allocate HTTPS server on heap as in case of failure it is never deallocated and next test also fails. Fixes: QTBUG-113350 Change-Id: Ifab6045afeb694a2b457604fa4d9e9c002483659 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Yigit Akcay <yigit.akcay@qt.io>
-rw-r--r--tests/auto/core/qwebengineglobalsettings/tst_qwebengineglobalsettings.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/auto/core/qwebengineglobalsettings/tst_qwebengineglobalsettings.cpp b/tests/auto/core/qwebengineglobalsettings/tst_qwebengineglobalsettings.cpp
index 40bd525bc..409b0eb0c 100644
--- a/tests/auto/core/qwebengineglobalsettings/tst_qwebengineglobalsettings.cpp
+++ b/tests/auto/core/qwebengineglobalsettings/tst_qwebengineglobalsettings.cpp
@@ -66,19 +66,18 @@ void tst_QWebEngineGlobalSettings::dnsOverHttps()
bool isDnsServerCalled = false;
bool isLoadSuccessful = false;
- HttpsServer *httpsServer;
+ HttpsServer httpsServer(":/cert/localhost.crt", ":/cert/localhost.key", ":/cert/RootCA.pem",
+ 3000, this);
if (isWithCustomDnsServer) {
- httpsServer = new HttpsServer(":/cert/localhost.crt", ":/cert/localhost.key",
- ":/cert/RootCA.pem", 3000, this);
QObject::connect(
- httpsServer, &HttpsServer::newRequest, this, [&isDnsServerCalled](HttpReqRep *rr) {
+ &httpsServer, &HttpsServer::newRequest, this, [&isDnsServerCalled](HttpReqRep *rr) {
QVERIFY(rr->requestPath().contains(QByteArrayLiteral("/dns-query?dns=")));
isDnsServerCalled = true;
rr->close();
});
- QVERIFY(httpsServer->start());
- httpsServer->setExpectError(true);
- httpsServer->setVerifyMode(QSslSocket::PeerVerifyMode::VerifyNone);
+ QVERIFY(httpsServer.start());
+ httpsServer.setExpectError(true);
+ httpsServer.setVerifyMode(QSslSocket::PeerVerifyMode::VerifyNone);
}
QWebEngineProfile profile;
@@ -92,13 +91,13 @@ void tst_QWebEngineGlobalSettings::dnsOverHttps()
globalSettings->configureDnsOverHttps(dnsMode, uriTemplate);
page.load(QUrl("https://google.com/"));
- QVERIFY(loadSpy.wait());
+ if (!loadSpy.wait(10000)) {
+ QSKIP("Couldn't load page from network, skipping test.");
+ }
QTRY_COMPARE(isDnsServerCalled, isWithCustomDnsServer);
QCOMPARE(isLoadSuccessful, isDnsResolutionSuccessExpected);
-
- if (isWithCustomDnsServer)
- QVERIFY(httpsServer->stop());
+ QVERIFY(httpsServer.stop());
}
static QByteArrayList params = QByteArrayList() << "--ignore-certificate-errors";