summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/proxy')
-rw-r--r--tests/auto/widgets/proxy/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/proxy/tst_proxy.cpp20
2 files changed, 20 insertions, 3 deletions
diff --git a/tests/auto/widgets/proxy/CMakeLists.txt b/tests/auto/widgets/proxy/CMakeLists.txt
index 03af3c35f..95dc903ed 100644
--- a/tests/auto/widgets/proxy/CMakeLists.txt
+++ b/tests/auto/widgets/proxy/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
qt_internal_add_test(tst_webengine_proxy
diff --git a/tests/auto/widgets/proxy/tst_proxy.cpp b/tests/auto/widgets/proxy/tst_proxy.cpp
index 961d29303..3dc72618c 100644
--- a/tests/auto/widgets/proxy/tst_proxy.cpp
+++ b/tests/auto/widgets/proxy/tst_proxy.cpp
@@ -8,7 +8,7 @@
#include <QWebEnginePage>
#include <QWebEngineView>
#include <QWebEngineUrlRequestInterceptor>
-
+#include <QWebEngineLoadingInfo>
struct Interceptor : public QWebEngineUrlRequestInterceptor
{
@@ -28,6 +28,7 @@ public:
private slots:
void proxyAuthentication();
void forwardCookie();
+ void invalidHostName();
};
@@ -49,7 +50,7 @@ void tst_Proxy::proxyAuthentication()
QWebEnginePage page;
QSignalSpy successSpy(&server, &ProxyServer::authenticationSuccess);
page.load(QUrl("http://www.qt.io"));
- QTRY_VERIFY2(successSpy.count() > 0, "Could not get authentication token");
+ QTRY_VERIFY2(successSpy.size() > 0, "Could not get authentication token");
}
void tst_Proxy::forwardCookie()
@@ -69,7 +70,20 @@ void tst_Proxy::forwardCookie()
page.setUrlRequestInterceptor(&interceptor);
QSignalSpy cookieSpy(&server, &ProxyServer::cookieMatch);
page.load(QUrl("http://www.qt.io"));
- QTRY_VERIFY2(cookieSpy.count() > 0, "Could not get cookie");
+ QTRY_VERIFY2(cookieSpy.size() > 0, "Could not get cookie");
+}
+
+// Crash test ( https://bugreports.qt.io/browse/QTBUG-113992 )
+void tst_Proxy::invalidHostName()
+{
+ QNetworkProxy proxy;
+ proxy.setType(QNetworkProxy::HttpProxy);
+ proxy.setHostName("999.0.0.0");
+ QNetworkProxy::setApplicationProxy(proxy);
+ QWebEnginePage page;
+ QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
+ page.load(QUrl("http://www.qt.io"));
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.size(), 1, 20000);
}
#include "tst_proxy.moc"