summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-02-11 10:03:24 +0100
committerMichal Klocek <michal.klocek@qt.io>2021-05-22 14:10:10 +0200
commit97dcbd4019456b9a1c567faddb0521b7505d80fc (patch)
tree9c77c5640b1563d853c79898cd64d87252fe8c41 /tests/auto
parentdd523573f2981cc58d4da0ec6e2b061a6172a8eb (diff)
Add tests to the cmake build
Use QT_TESTCASE_SOURCEDIR instead of TESTS_SOURCE_DIR. Introduce Test::HttpServer and Test::Util targets. Query shared data location from server. Clean up "shared" resources. Note QT_TESTCASE_SOURCEDIR must be turned into the canonical form since the user can call on windows: "cmake \path\to\foo" instead of "cmake c:\path\to\foo" which will break all file:// urls. Note this patch breaks qmake builds. Task-number: QTBUG-91760 Change-Id: Ibc1f904ac9acd375d1ff70ff80f0c533497e3f20 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/CMakeLists.txt17
-rw-r--r--tests/auto/core/CMakeLists.txt5
-rw-r--r--tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt21
-rw-r--r--tests/auto/core/qwebenginecookiestore/CMakeLists.txt23
-rw-r--r--tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp2
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt41
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp62
-rw-r--r--tests/auto/httpserver/CMakeLists.txt7
-rw-r--r--tests/auto/httpserver/data/hedgehog.html9
-rw-r--r--tests/auto/httpserver/data/hedgehog.pngbin0 -> 11273 bytes
-rw-r--r--tests/auto/httpserver/data/loadprogress/downloadable.tar.gz (renamed from tests/auto/shared/data/loadprogress/downloadable.tar.gz)bin131 -> 131 bytes
-rw-r--r--tests/auto/httpserver/data/loadprogress/main.html (renamed from tests/auto/shared/data/loadprogress/main.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page1.html (renamed from tests/auto/shared/data/loadprogress/page1.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page2.html (renamed from tests/auto/shared/data/loadprogress/page2.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page3.html (renamed from tests/auto/shared/data/loadprogress/page3.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page4.html (renamed from tests/auto/shared/data/loadprogress/page4.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page5.html (renamed from tests/auto/shared/data/loadprogress/page5.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page6.html (renamed from tests/auto/shared/data/loadprogress/page6.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page7.html (renamed from tests/auto/shared/data/loadprogress/page7.html)0
-rw-r--r--tests/auto/httpserver/data/loadprogress/page8.html (renamed from tests/auto/shared/data/loadprogress/page8.html)0
-rw-r--r--tests/auto/httpserver/data/notification.html (renamed from tests/auto/shared/data/notification.html)0
-rw-r--r--tests/auto/httpserver/httpreqrep.cpp (renamed from tests/auto/shared/httpreqrep.cpp)8
-rw-r--r--tests/auto/httpserver/httpreqrep.h (renamed from tests/auto/shared/httpreqrep.h)1
-rw-r--r--tests/auto/httpserver/httpserver.cmake38
-rw-r--r--tests/auto/httpserver/httpserver.cpp (renamed from tests/auto/shared/httpserver.cpp)24
-rw-r--r--tests/auto/httpserver/httpserver.h (renamed from tests/auto/shared/httpserver.h)8
-rw-r--r--tests/auto/httpserver/httpsserver.h (renamed from tests/auto/shared/httpsserver.h)12
-rw-r--r--tests/auto/httpserver/proxy_server.cpp (renamed from tests/auto/widgets/proxy/proxy_server.cpp)8
-rw-r--r--tests/auto/httpserver/proxy_server.h (renamed from tests/auto/widgets/proxy/proxy_server.h)3
-rw-r--r--tests/auto/quick/CMakeLists.txt15
-rw-r--r--tests/auto/quick/certificateerror/CMakeLists.txt26
-rw-r--r--tests/auto/quick/certificateerror/resources/cert.pem (renamed from tests/auto/shared/resources/cert.pem)0
-rw-r--r--tests/auto/quick/certificateerror/resources/key.pem (renamed from tests/auto/shared/resources/key.pem)0
-rw-r--r--tests/auto/quick/certificateerror/tst_certificateerror.cpp4
-rw-r--r--tests/auto/quick/dialogs/CMakeLists.txt25
-rw-r--r--tests/auto/quick/dialogs/server.cpp79
-rw-r--r--tests/auto/quick/dialogs/server.h59
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp18
-rw-r--r--tests/auto/quick/inspectorserver/CMakeLists.txt9
-rw-r--r--tests/auto/quick/inspectorserver/html/basic_page.html (renamed from tests/auto/quick/html/basic_page.html)0
-rw-r--r--tests/auto/quick/inspectorserver/tst_inspectorserver.cpp11
-rw-r--r--tests/auto/quick/publicapi/CMakeLists.txt8
-rw-r--r--tests/auto/quick/qmltests/CMakeLists.txt102
-rw-r--r--tests/auto/quick/qmltests/data/tst_notification.qml4
-rw-r--r--tests/auto/quick/qmltests/resources/cert.pem64
-rw-r--r--tests/auto/quick/qmltests/resources/key.pem27
-rw-r--r--tests/auto/quick/qmltests/tst_qmltests.cpp12
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt10
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html6
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp4
-rw-r--r--tests/auto/quick/qquickwebengineview/CMakeLists.txt13
-rw-r--r--tests/auto/quick/qquickwebengineview/html/basic_page.html6
-rw-r--r--tests/auto/quick/qquickwebengineview/html/basic_page2.html (renamed from tests/auto/quick/html/basic_page2.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/html/direct-image-compositing.html (renamed from tests/auto/quick/html/direct-image-compositing.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/html/inputmethod.html (renamed from tests/auto/quick/html/inputmethod.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/html/resources/simple_image.png (renamed from tests/auto/quick/html/resources/simple_image.png)bin10585 -> 10585 bytes
-rw-r--r--tests/auto/quick/qquickwebengineview/html/scroll.html (renamed from tests/auto/quick/html/scroll.html)0
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp5
-rw-r--r--tests/auto/quick/qtbug-70248/CMakeLists.txt17
-rw-r--r--tests/auto/util/CMakeLists.txt7
-rw-r--r--tests/auto/util/qt_webengine_quicktest.h (renamed from tests/auto/quick/shared/qt_webengine_quicktest.h)4
-rw-r--r--tests/auto/util/quickutil.h (renamed from tests/auto/quick/shared/util.h)0
-rw-r--r--tests/auto/util/testwindow.h (renamed from tests/auto/quick/shared/testwindow.h)0
-rw-r--r--tests/auto/util/util.cmake5
-rw-r--r--tests/auto/util/util.h (renamed from tests/auto/widgets/util.h)4
-rw-r--r--tests/auto/widgets/CMakeLists.txt36
-rw-r--r--tests/auto/widgets/accessibility/CMakeLists.txt9
-rw-r--r--tests/auto/widgets/accessibility/tst_accessibility.cpp2
-rw-r--r--tests/auto/widgets/certificateerror/CMakeLists.txt23
-rw-r--r--tests/auto/widgets/certificateerror/resources/cert.pem64
-rw-r--r--tests/auto/widgets/certificateerror/resources/key.pem27
-rw-r--r--tests/auto/widgets/certificateerror/tst_certificateerror.cpp2
-rw-r--r--tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt20
-rw-r--r--tests/auto/widgets/defaultsurfaceformat/tst_defaultsurfaceformat.cpp2
-rw-r--r--tests/auto/widgets/devtools/CMakeLists.txt7
-rw-r--r--tests/auto/widgets/faviconmanager/CMakeLists.txt29
-rw-r--r--tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp118
-rw-r--r--tests/auto/widgets/loadsignals/CMakeLists.txt60
-rw-r--r--tests/auto/widgets/loadsignals/tst_loadsignals.cpp6
-rw-r--r--tests/auto/widgets/offscreen/CMakeLists.txt22
-rw-r--r--tests/auto/widgets/origins/CMakeLists.txt45
-rw-r--r--tests/auto/widgets/origins/tst_origins.cpp85
-rw-r--r--tests/auto/widgets/printing/CMakeLists.txt34
-rw-r--r--tests/auto/widgets/printing/tst_printing.cpp6
-rw-r--r--tests/auto/widgets/proxy/CMakeLists.txt9
-rw-r--r--tests/auto/widgets/proxypac/CMakeLists.txt46
-rw-r--r--tests/auto/widgets/proxypac/tst_proxypac.cpp8
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt11
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp2
-rw-r--r--tests/auto/widgets/qwebenginehistory/CMakeLists.txt26
-rw-r--r--tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp2
-rw-r--r--tests/auto/widgets/qwebenginepage/CMakeLists.txt61
-rw-r--r--tests/auto/widgets/qwebenginepage/resources/image2.png (renamed from tests/auto/widgets/resources/image2.png)bin14743 -> 14743 bytes
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp28
-rw-r--r--tests/auto/widgets/qwebengineprofile/CMakeLists.txt11
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp4
-rw-r--r--tests/auto/widgets/qwebenginescript/CMakeLists.txt26
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp2
-rw-r--r--tests/auto/widgets/qwebenginesettings/CMakeLists.txt9
-rw-r--r--tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp2
-rw-r--r--tests/auto/widgets/qwebengineview/CMakeLists.txt29
-rw-r--r--tests/auto/widgets/qwebengineview/resources/test.swf (renamed from tests/auto/widgets/resources/test.swf)bin10085 -> 10085 bytes
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp19
-rw-r--r--tests/auto/widgets/schemes/CMakeLists.txt7
-rw-r--r--tests/auto/widgets/shutdown/CMakeLists.txt6
-rw-r--r--tests/auto/widgets/touchinput/CMakeLists.txt10
-rw-r--r--tests/auto/widgets/touchinput/tst_touchinput.cpp2
107 files changed, 1451 insertions, 299 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
new file mode 100644
index 000000000..2227e6e46
--- /dev/null
+++ b/tests/auto/CMakeLists.txt
@@ -0,0 +1,17 @@
+if(QT_FEATURE_qtwebengine_build
+ OR (QT_BUILD_STANDALONE_TESTS AND TARGET Qt::WebEngineCore))
+ add_subdirectory(core)
+ add_subdirectory(httpserver)
+ add_subdirectory(util)
+endif()
+if(QT_FEATURE_qtwebengine_quick_build
+ OR (QT_BUILD_STANDALONE_TESTS AND TARGET Qt::WebEngineQuick))
+ add_subdirectory(quick)
+endif()
+if(QT_FEATURE_qtwebengine_widgets_build
+ OR (QT_BUILD_STANDALONE_TESTS AND TARGET Qt::WebEngineWidgets))
+ add_subdirectory(widgets)
+endif()
+#if(QT_FEATURE_build_qtpdf AND QT_FEATURE_webengine_qtpdf_support)
+# add_subdirectory(pdf)
+#endif()
diff --git a/tests/auto/core/CMakeLists.txt b/tests/auto/core/CMakeLists.txt
new file mode 100644
index 000000000..ee2f010d0
--- /dev/null
+++ b/tests/auto/core/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_subdirectory(qwebenginecookiestore)
+add_subdirectory(qwebengineurlrequestinterceptor)
+if(QT_FEATURE_ssl)
+ add_subdirectory(qwebengineclientcertificatestore)
+endif()
diff --git a/tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt b/tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt
new file mode 100644
index 000000000..18bba2e26
--- /dev/null
+++ b/tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt
@@ -0,0 +1,21 @@
+qt_internal_add_test(tst_qwebengineclientcertificatestore
+ SOURCES
+ tst_qwebengineclientcertificatestore.cpp
+ LIBRARIES
+ Qt::WebEngineCore
+)
+
+set(tst_qwebengineclientcertificatestore_resource_files
+ "resources/certificate.crt"
+ "resources/certificate1.crt"
+ "resources/privatekey.key"
+ "resources/privatekey1.key"
+)
+
+qt_add_resource(tst_qwebengineclientcertificatestore "tst_qwebengineclientcertificatestore"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qwebengineclientcertificatestore_resource_files}
+)
+
diff --git a/tests/auto/core/qwebenginecookiestore/CMakeLists.txt b/tests/auto/core/qwebenginecookiestore/CMakeLists.txt
new file mode 100644
index 000000000..078259ccf
--- /dev/null
+++ b/tests/auto/core/qwebenginecookiestore/CMakeLists.txt
@@ -0,0 +1,23 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebenginecookiestore
+ SOURCES
+ tst_qwebenginecookiestore.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
+
+set(tst_qwebenginecookiestore_resource_files
+ "resources/content.html"
+ "resources/index.html"
+)
+
+qt_add_resource(tst_qwebenginecookiestore "tst_qwebenginecookiestore"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qwebenginecookiestore_resource_files}
+)
diff --git a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
index dbd645a83..e056fef8f 100644
--- a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
+++ b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include "../../widgets/util.h"
+#include <util.h>
#include <QtTest/QtTest>
#include <QtWebEngineCore/qwebenginecallback.h>
#include <QtWebEngineCore/qwebenginecookiestore.h>
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt b/tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt
new file mode 100644
index 000000000..fa6de9ef5
--- /dev/null
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt
@@ -0,0 +1,41 @@
+include(../../util/util.cmake)
+include(../../httpserver/httpserver.cmake)
+
+qt_internal_add_test(tst_qwebengineurlrequestinterceptor
+ SOURCES
+ tst_qwebengineurlrequestinterceptor.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
+
+set(tst_qwebengineurlrequestinterceptor_resource_files
+ "resources/content.html"
+ "resources/favicon.html"
+ "resources/firstparty.html"
+ "resources/fontawesome.woff"
+ "resources/icons/favicon.png"
+ "resources/iframe.html"
+ "resources/iframe2.html"
+ "resources/iframe3.html"
+ "resources/image.html"
+ "resources/image_in_iframe.html"
+ "resources/index.html"
+ "resources/media.html"
+ "resources/media.mp4"
+ "resources/media_in_iframe.html"
+ "resources/resource.html"
+ "resources/resource_in_iframe.html"
+ "resources/script.js"
+ "resources/style.css"
+ "resources/sw.html"
+ "resources/sw.js"
+)
+
+qt_add_resource(tst_qwebengineurlrequestinterceptor "tst_qwebengineurlrequestinterceptor"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qwebengineurlrequestinterceptor_resource_files}
+)
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index 34ef111f2..8a6cbb331 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include "../../widgets/util.h"
+#include <util.h>
#include <QtTest/QtTest>
#include <QtWebEngineCore/qwebengineurlrequestinfo.h>
#include <QtWebEngineCore/qwebengineurlrequestinterceptor.h>
@@ -416,7 +416,8 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrl()
void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes_data()
{
- QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/iframe.html"));
+ QUrl url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/iframe.html"));
QTest::addColumn<QUrl>("requestUrl");
QTest::newRow("ui file") << url;
QTest::newRow("ui qrc") << QUrl("qrc:///resources/iframe.html");
@@ -426,8 +427,13 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes()
{
QFETCH(QUrl, requestUrl);
- if (requestUrl.scheme() == "file" && !QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (requestUrl.scheme() == "file"
+ && !QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QString adjustedUrl = requestUrl.adjusted(QUrl::RemoveFilename).toString();
@@ -461,17 +467,30 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes()
void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType_data()
{
- QUrl firstPartyUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/resource_in_iframe.html"));
- QUrl styleRequestUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/style.css"));
- QUrl scriptRequestUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/script.js"));
- QUrl fontRequestUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/fontawesome.woff"));
- QUrl xhrRequestUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/test"));
- QUrl imageFirstPartyUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/image_in_iframe.html"));
- QUrl imageRequestUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/icons/favicon.png"));
- QUrl mediaFirstPartyUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/media_in_iframe.html"));
- QUrl mediaRequestUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/media.mp4"));
- QUrl faviconFirstPartyUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/favicon.html"));
- QUrl faviconRequestUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/icons/favicon.png"));
+ QUrl firstPartyUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/resource_in_iframe.html"));
+ QUrl styleRequestUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/style.css"));
+ QUrl scriptRequestUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/script.js"));
+ QUrl fontRequestUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/fontawesome.woff"));
+ QUrl xhrRequestUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/test"));
+ QUrl imageFirstPartyUrl =
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/image_in_iframe.html"));
+ QUrl imageRequestUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/favicon.png"));
+ QUrl mediaFirstPartyUrl =
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/media_in_iframe.html"));
+ QUrl mediaRequestUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/media.mp4"));
+ QUrl faviconFirstPartyUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon.html"));
+ QUrl faviconRequestUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/favicon.png"));
QTest::addColumn<QUrl>("requestUrl");
QTest::addColumn<QUrl>("firstPartyUrl");
@@ -498,8 +517,12 @@ void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType_data(
void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QFETCH(QUrl, requestUrl);
QFETCH(QUrl, firstPartyUrl);
QFETCH(int, resourceType);
@@ -583,7 +606,8 @@ void tst_QWebEngineUrlRequestInterceptor::customHeaders()
{
// Create HTTP Server to parse the request.
HttpServer httpServer;
- httpServer.setResourceDirs({ TESTS_SOURCE_DIR "qwebengineurlrequestinterceptor/resources" });
+ httpServer.setResourceDirs({ QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources" });
QVERIFY(httpServer.start());
QWebEngineProfile profile;
@@ -700,7 +724,7 @@ void tst_QWebEngineUrlRequestInterceptor::jsServiceWorker()
{
HttpServer server;
- server.setResourceDirs({ TESTS_SOURCE_DIR "qwebengineurlrequestinterceptor/resources" });
+ server.setResourceDirs({ QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() + "/resources" });
QVERIFY(server.start());
QWebEngineProfile profile(QStringLiteral("Test"));
diff --git a/tests/auto/httpserver/CMakeLists.txt b/tests/auto/httpserver/CMakeLists.txt
new file mode 100644
index 000000000..7d4ddd030
--- /dev/null
+++ b/tests/auto/httpserver/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.18)
+project(minimal LANGUAGES CXX)
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Network)
+
+include(httpserver.cmake)
diff --git a/tests/auto/httpserver/data/hedgehog.html b/tests/auto/httpserver/data/hedgehog.html
new file mode 100644
index 000000000..d8abbcd48
--- /dev/null
+++ b/tests/auto/httpserver/data/hedgehog.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<html>
+ <head>
+ <title>BREAKING NEWS: 15 Hedgehogs With Things That Look Like Hedgehogs</title>
+ </head>
+ <body>
+ <img src="hedgehog.png"/>
+ </body>
+</html>
diff --git a/tests/auto/httpserver/data/hedgehog.png b/tests/auto/httpserver/data/hedgehog.png
new file mode 100644
index 000000000..4d56d8633
--- /dev/null
+++ b/tests/auto/httpserver/data/hedgehog.png
Binary files differ
diff --git a/tests/auto/shared/data/loadprogress/downloadable.tar.gz b/tests/auto/httpserver/data/loadprogress/downloadable.tar.gz
index 741cb8ca6..741cb8ca6 100644
--- a/tests/auto/shared/data/loadprogress/downloadable.tar.gz
+++ b/tests/auto/httpserver/data/loadprogress/downloadable.tar.gz
Binary files differ
diff --git a/tests/auto/shared/data/loadprogress/main.html b/tests/auto/httpserver/data/loadprogress/main.html
index 3b7d2034b..3b7d2034b 100644
--- a/tests/auto/shared/data/loadprogress/main.html
+++ b/tests/auto/httpserver/data/loadprogress/main.html
diff --git a/tests/auto/shared/data/loadprogress/page1.html b/tests/auto/httpserver/data/loadprogress/page1.html
index 9b11ce887..9b11ce887 100644
--- a/tests/auto/shared/data/loadprogress/page1.html
+++ b/tests/auto/httpserver/data/loadprogress/page1.html
diff --git a/tests/auto/shared/data/loadprogress/page2.html b/tests/auto/httpserver/data/loadprogress/page2.html
index 223817c8c..223817c8c 100644
--- a/tests/auto/shared/data/loadprogress/page2.html
+++ b/tests/auto/httpserver/data/loadprogress/page2.html
diff --git a/tests/auto/shared/data/loadprogress/page3.html b/tests/auto/httpserver/data/loadprogress/page3.html
index d38ca31f0..d38ca31f0 100644
--- a/tests/auto/shared/data/loadprogress/page3.html
+++ b/tests/auto/httpserver/data/loadprogress/page3.html
diff --git a/tests/auto/shared/data/loadprogress/page4.html b/tests/auto/httpserver/data/loadprogress/page4.html
index 61976b4fb..61976b4fb 100644
--- a/tests/auto/shared/data/loadprogress/page4.html
+++ b/tests/auto/httpserver/data/loadprogress/page4.html
diff --git a/tests/auto/shared/data/loadprogress/page5.html b/tests/auto/httpserver/data/loadprogress/page5.html
index 47709ff08..47709ff08 100644
--- a/tests/auto/shared/data/loadprogress/page5.html
+++ b/tests/auto/httpserver/data/loadprogress/page5.html
diff --git a/tests/auto/shared/data/loadprogress/page6.html b/tests/auto/httpserver/data/loadprogress/page6.html
index 98042701a..98042701a 100644
--- a/tests/auto/shared/data/loadprogress/page6.html
+++ b/tests/auto/httpserver/data/loadprogress/page6.html
diff --git a/tests/auto/shared/data/loadprogress/page7.html b/tests/auto/httpserver/data/loadprogress/page7.html
index 42538c5de..42538c5de 100644
--- a/tests/auto/shared/data/loadprogress/page7.html
+++ b/tests/auto/httpserver/data/loadprogress/page7.html
diff --git a/tests/auto/shared/data/loadprogress/page8.html b/tests/auto/httpserver/data/loadprogress/page8.html
index 8ebdddf97..8ebdddf97 100644
--- a/tests/auto/shared/data/loadprogress/page8.html
+++ b/tests/auto/httpserver/data/loadprogress/page8.html
diff --git a/tests/auto/shared/data/notification.html b/tests/auto/httpserver/data/notification.html
index 1d1e9c411..1d1e9c411 100644
--- a/tests/auto/shared/data/notification.html
+++ b/tests/auto/httpserver/data/notification.html
diff --git a/tests/auto/shared/httpreqrep.cpp b/tests/auto/httpserver/httpreqrep.cpp
index 96279bbc0..ee9dbbaa9 100644
--- a/tests/auto/shared/httpreqrep.cpp
+++ b/tests/auto/httpserver/httpreqrep.cpp
@@ -57,6 +57,14 @@ void HttpReqRep::sendResponse(int statusCode)
Q_EMIT responseSent();
}
+void HttpReqRep::sendResponse(const QByteArray &response)
+{
+ m_socket->write(response);
+ m_state = State::DISCONNECTING;
+ m_socket->disconnectFromHost();
+ Q_EMIT responseSent();
+}
+
void HttpReqRep::close()
{
if (m_state != State::REQUEST_RECEIVED)
diff --git a/tests/auto/shared/httpreqrep.h b/tests/auto/httpserver/httpreqrep.h
index 84ada0160..e1979e050 100644
--- a/tests/auto/shared/httpreqrep.h
+++ b/tests/auto/httpserver/httpreqrep.h
@@ -41,6 +41,7 @@ public:
explicit HttpReqRep(QTcpSocket *socket, QObject *parent = nullptr);
Q_INVOKABLE void sendResponse(int statusCode = 200);
+ void sendResponse(const QByteArray &response);
void close();
bool isClosed() const { return m_state == State::DISCONNECTED; }
diff --git a/tests/auto/httpserver/httpserver.cmake b/tests/auto/httpserver/httpserver.cmake
new file mode 100644
index 000000000..78d13055c
--- /dev/null
+++ b/tests/auto/httpserver/httpserver.cmake
@@ -0,0 +1,38 @@
+if (NOT TARGET Test::HttpServer)
+
+ set(CMAKE_AUTOMOC ON)
+ set(CMAKE_AUTORCC ON)
+ set(CMAKE_AUTOUIC ON)
+
+ add_library(httpserver STATIC
+ ${CMAKE_CURRENT_LIST_DIR}/httpreqrep.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/httpreqrep.h
+ ${CMAKE_CURRENT_LIST_DIR}/httpserver.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/httpserver.h
+ ${CMAKE_CURRENT_LIST_DIR}/proxy_server.h
+ ${CMAKE_CURRENT_LIST_DIR}/proxy_server.cpp
+ )
+
+ if(QT_FEATURE_ssl)
+ target_sources(httpserver INTERFACE ${CMAKE_CURRENT_LIST_DIR}/httpsserver.h)
+ endif()
+
+ add_library(Test::HttpServer ALIAS httpserver)
+
+ target_include_directories(httpserver INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
+ )
+
+ target_link_libraries(httpserver PUBLIC
+ Qt::Core
+ Qt::Network
+ )
+
+ target_compile_definitions(httpserver PRIVATE
+ SERVER_SOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}"
+ )
+
+ set_target_properties(httpserver PROPERTIES
+ SHARED_DATA "${CMAKE_CURRENT_LIST_DIR}/data"
+ )
+endif()
diff --git a/tests/auto/shared/httpserver.cpp b/tests/auto/httpserver/httpserver.cpp
index 69e8cb6cc..10147ae6c 100644
--- a/tests/auto/shared/httpserver.cpp
+++ b/tests/auto/httpserver/httpserver.cpp
@@ -33,14 +33,21 @@
Q_LOGGING_CATEGORY(gHttpServerLog, "HttpServer")
-HttpServer::HttpServer(QObject *parent) : HttpServer(new QTcpServer, "http", parent)
+HttpServer::HttpServer(QObject *parent)
+ : HttpServer(new QTcpServer, "http", QHostAddress::LocalHost, 0, parent)
{
}
-HttpServer::HttpServer(QTcpServer *tcpServer, const QString &protocol, QObject *parent)
- : QObject(parent), m_tcpServer(tcpServer)
+HttpServer::HttpServer(const QHostAddress &hostAddress, quint16 port, QObject *parent)
+ : HttpServer(new QTcpServer, "http", hostAddress, port, parent)
{
- m_url.setHost(QStringLiteral("127.0.0.1"));
+}
+
+HttpServer::HttpServer(QTcpServer *tcpServer, const QString &protocol,
+ const QHostAddress &hostAddress, quint16 port, QObject *parent)
+ : QObject(parent), m_tcpServer(tcpServer), m_hostAddress(hostAddress), m_port(port)
+{
+ m_url.setHost(hostAddress.toString());
m_url.setScheme(protocol);
connect(tcpServer, &QTcpServer::newConnection, this, &HttpServer::handleNewConnection);
}
@@ -56,7 +63,7 @@ bool HttpServer::start()
m_expectingError = false;
m_ignoreNewConnection = false;
- if (!m_tcpServer->listen()) {
+ if (!m_tcpServer->listen(m_hostAddress, m_port)) {
qCWarning(gHttpServerLog).noquote() << m_tcpServer->errorString();
return false;
}
@@ -110,6 +117,8 @@ void HttpServer::handleNewConnection()
rr->sendResponse(500); // internal server error
}
break;
+ } else {
+ qWarning() << "Can't open resource" << dir + rr->requestPath();
}
}
}
@@ -132,3 +141,8 @@ void HttpServer::handleNewConnection()
connect(rr, &HttpReqRep::closed, rr, &QObject::deleteLater);
}
}
+
+QString HttpServer::sharedDataDir() const
+{
+ return SERVER_SOURCE_DIR + QLatin1String("/data");
+}
diff --git a/tests/auto/shared/httpserver.h b/tests/auto/httpserver/httpserver.h
index 3ec69f8ed..acc742775 100644
--- a/tests/auto/shared/httpserver.h
+++ b/tests/auto/httpserver/httpserver.h
@@ -59,7 +59,9 @@ class HttpServer : public QObject
Q_OBJECT
public:
explicit HttpServer(QObject *parent = nullptr);
- explicit HttpServer(QTcpServer *server, const QString &protocol, QObject *parent = nullptr);
+ HttpServer(const QHostAddress &hostAddress, quint16 port, QObject *parent = nullptr);
+ HttpServer(QTcpServer *server, const QString &protocol, const QHostAddress &address,
+ quint16 port, QObject *parent = nullptr);
~HttpServer() override;
@@ -76,6 +78,8 @@ public:
// Full URL for given relative path
Q_INVOKABLE QUrl url(const QString &path = QStringLiteral("/")) const;
+ Q_INVOKABLE QString sharedDataDir() const;
+
Q_INVOKABLE void setResourceDirs(const QStringList &dirs) { m_dirs = dirs; }
Q_INVOKABLE void setHostDomain(const QString &host) { m_url.setHost(host); }
@@ -94,6 +98,8 @@ private:
bool m_error = false;
bool m_ignoreNewConnection = false;
bool m_expectingError = false;
+ QHostAddress m_hostAddress;
+ quint16 m_port;
};
#endif // !HTTPSERVER_H
diff --git a/tests/auto/shared/httpsserver.h b/tests/auto/httpserver/httpsserver.h
index 219d5f7a1..b257e69a7 100644
--- a/tests/auto/shared/httpsserver.h
+++ b/tests/auto/httpserver/httpsserver.h
@@ -40,9 +40,9 @@
struct SslTcpServer : QTcpServer
{
- SslTcpServer() {
- sslconf.setLocalCertificateChain(QSslCertificate::fromPath(":/resources/cert.pem"));
- sslconf.setPrivateKey(readKey(":/resources/key.pem"));
+ SslTcpServer(const QString &certPath, const QString &keyPath) {
+ sslconf.setLocalCertificateChain(QSslCertificate::fromPath(certPath));
+ sslconf.setPrivateKey(readKey(keyPath));
}
void incomingConnection(qintptr d) override {
@@ -75,7 +75,11 @@ struct SslTcpServer : QTcpServer
struct HttpsServer : HttpServer
{
- HttpsServer(QObject *parent = nullptr) : HttpServer(new SslTcpServer, "https", parent) { }
+ HttpsServer(const QString &certPath, const QString &keyPath, QObject *parent = nullptr)
+ : HttpServer(new SslTcpServer(certPath, keyPath), "https", QHostAddress::LocalHost, 0,
+ parent)
+ {
+ }
};
#endif
diff --git a/tests/auto/widgets/proxy/proxy_server.cpp b/tests/auto/httpserver/proxy_server.cpp
index 3e52de4f2..3c5588603 100644
--- a/tests/auto/widgets/proxy/proxy_server.cpp
+++ b/tests/auto/httpserver/proxy_server.cpp
@@ -36,6 +36,11 @@ ProxyServer::ProxyServer(QObject *parent) : QObject(parent)
connect(&m_server, &QTcpServer::newConnection, this, &ProxyServer::handleNewConnection);
}
+void ProxyServer::setPort(int port)
+{
+ m_port = port;
+}
+
void ProxyServer::setCredentials(const QByteArray &user, const QByteArray password)
{
m_auth.append(user);
@@ -59,7 +64,7 @@ bool ProxyServer::isListening()
void ProxyServer::run()
{
- if (!m_server.listen(QHostAddress::LocalHost, 5555))
+ if (!m_server.listen(QHostAddress::LocalHost, m_port))
qFatal("Could not start the test server");
}
@@ -99,4 +104,5 @@ void ProxyServer::handleReadReady()
emit cookieMatch();
}
m_data.clear();
+ emit requestReceived();
}
diff --git a/tests/auto/widgets/proxy/proxy_server.h b/tests/auto/httpserver/proxy_server.h
index 7bc7b100b..57e69efe7 100644
--- a/tests/auto/widgets/proxy/proxy_server.h
+++ b/tests/auto/httpserver/proxy_server.h
@@ -41,6 +41,7 @@ public:
void setCredentials(const QByteArray &user, const QByteArray password);
void setCookie(const QByteArray &cookie);
bool isListening();
+ void setPort(int port);
public slots:
void run();
@@ -52,8 +53,10 @@ private slots:
signals:
void authenticationSuccess();
void cookieMatch();
+ void requestReceived();
private:
+ int m_port = 5555;
QByteArray m_data;
QTcpServer m_server;
QByteArray m_auth;
diff --git a/tests/auto/quick/CMakeLists.txt b/tests/auto/quick/CMakeLists.txt
new file mode 100644
index 000000000..32d58ec7f
--- /dev/null
+++ b/tests/auto/quick/CMakeLists.txt
@@ -0,0 +1,15 @@
+add_subdirectory(dialogs)
+add_subdirectory(publicapi)
+add_subdirectory(qquickwebenginedefaultsurfaceformat)
+add_subdirectory(qtbug-70248)
+if(QT_FEATURE_ssl)
+ add_subdirectory(certificateerror)
+endif()
+if(NOT boot2qt)
+ add_subdirectory(inspectorserver)
+ add_subdirectory(qmltests)
+ add_subdirectory(qquickwebengineview)
+endif()
+if(QT_FEATURE_webengine_testsupport)
+# add_subdirectory(qquickwebengineviewgraphics)
+endif()
diff --git a/tests/auto/quick/certificateerror/CMakeLists.txt b/tests/auto/quick/certificateerror/CMakeLists.txt
new file mode 100644
index 000000000..4fe350978
--- /dev/null
+++ b/tests/auto/quick/certificateerror/CMakeLists.txt
@@ -0,0 +1,26 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_certificateerror_quick
+ SOURCES
+ testhandler.cpp testhandler.h
+ tst_certificateerror.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Test::HttpServer
+ Test::Util
+)
+
+set(certificateerror_resource_files
+ "resources/cert.pem"
+ "resources/key.pem"
+ "WebView.qml"
+)
+
+qt_add_resource(tst_certificateerror_quick "certificateerror"
+ PREFIX
+ "/"
+ FILES
+ ${certificateerror_resource_files}
+)
diff --git a/tests/auto/shared/resources/cert.pem b/tests/auto/quick/certificateerror/resources/cert.pem
index 3aaaf289c..3aaaf289c 100644
--- a/tests/auto/shared/resources/cert.pem
+++ b/tests/auto/quick/certificateerror/resources/cert.pem
diff --git a/tests/auto/shared/resources/key.pem b/tests/auto/quick/certificateerror/resources/key.pem
index 89922679a..89922679a 100644
--- a/tests/auto/shared/resources/key.pem
+++ b/tests/auto/quick/certificateerror/resources/key.pem
diff --git a/tests/auto/quick/certificateerror/tst_certificateerror.cpp b/tests/auto/quick/certificateerror/tst_certificateerror.cpp
index 3e2dc85fb..dd7799919 100644
--- a/tests/auto/quick/certificateerror/tst_certificateerror.cpp
+++ b/tests/auto/quick/certificateerror/tst_certificateerror.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "testhandler.h"
#include <httpsserver.h>
-#include <util.h>
+#include <quickutil.h>
#include <QWebEngineCertificateError>
#include <QQuickWebEngineProfile>
#include <QQmlApplicationEngine>
@@ -75,7 +75,7 @@ void tst_CertificateError::handleError_data()
void tst_CertificateError::handleError()
{
- HttpsServer server;
+ HttpsServer server(":/resources/cert.pem",":/resources/key.pem");
server.setExpectError(true);
QVERIFY(server.start());
diff --git a/tests/auto/quick/dialogs/CMakeLists.txt b/tests/auto/quick/dialogs/CMakeLists.txt
new file mode 100644
index 000000000..b1fbfe3a3
--- /dev/null
+++ b/tests/auto/quick/dialogs/CMakeLists.txt
@@ -0,0 +1,25 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_dialogs
+ SOURCES
+ testhandler.cpp testhandler.h
+ tst_dialogs.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Test::HttpServer
+ Test::Util
+)
+
+set(dialogs_resource_files
+ "WebView.qml"
+ "index.html"
+)
+
+qt_add_resource(tst_dialogs "dialogs"
+ PREFIX
+ "/"
+ FILES
+ ${dialogs_resource_files}
+)
diff --git a/tests/auto/quick/dialogs/server.cpp b/tests/auto/quick/dialogs/server.cpp
deleted file mode 100644
index dfc7c97ad..000000000
--- a/tests/auto/quick/dialogs/server.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "server.h"
-#include <QDataStream>
-#include <QTcpSocket>
-#include <QDebug>
-
-Server::Server(QObject *parent) : QObject(parent)
-{
- connect(&m_server, &QTcpServer::newConnection, this, &Server::handleNewConnection);
-}
-
-bool Server::isListening()
-{
- return m_server.isListening();
-}
-
-void Server::setReply(const QByteArray &reply)
-{
- m_reply = reply;
-}
-
-void Server::run()
-{
- if (!m_server.listen(QHostAddress::LocalHost, 5555))
- qFatal("Could not start the test server");
-}
-
-void Server::handleNewConnection()
-{
- // do one connection at the time
- Q_ASSERT(m_data.isEmpty());
- QTcpSocket *socket = m_server.nextPendingConnection();
- Q_ASSERT(socket);
- connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater);
- connect(socket, &QAbstractSocket::readyRead, this, &Server::handleReadReady);
-}
-
-void Server::handleReadReady()
-{
- QTcpSocket *socket = qobject_cast<QTcpSocket*>(sender());
- Q_ASSERT(socket);
-
- m_data.append(socket->readAll());
-
- //simply wait for whole request
- if (!m_data.endsWith("\r\n\r\n"))
- return;
-
- socket->write(m_reply);
- m_data.clear();
- socket->disconnectFromHost();
-}
diff --git a/tests/auto/quick/dialogs/server.h b/tests/auto/quick/dialogs/server.h
deleted file mode 100644
index fa9a73811..000000000
--- a/tests/auto/quick/dialogs/server.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SERVER_H
-#define SERVER_H
-
-#include <QObject>
-#include <QTcpServer>
-
-class Server : public QObject
-{
- Q_OBJECT
-
-public:
- explicit Server(QObject *parent = nullptr);
-
- bool isListening();
- void setReply(const QByteArray &reply);
-
-public slots:
- void run();
-
-private slots:
- void handleNewConnection();
- void handleReadReady();
-
-private:
- QByteArray m_data;
- QByteArray m_reply;
- QTcpServer m_server;
-
-};
-
-#endif // SERVER_H
diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp
index 97a39ed01..8543c47da 100644
--- a/tests/auto/quick/dialogs/tst_dialogs.cpp
+++ b/tests/auto/quick/dialogs/tst_dialogs.cpp
@@ -27,8 +27,8 @@
****************************************************************************/
#include "testhandler.h"
-#include "server.h"
-#include "util.h"
+#include <quickutil.h>
+#include <httpserver.h>
#include <QtWebEngineQuick/private/qquickwebenginedialogrequests_p.h>
#include <QtWebEngineCore/qwebenginecontextmenurequest.h>
@@ -147,7 +147,7 @@ void tst_Dialogs::authenticationDialogRequested_data()
QTest::addColumn<QUrl>("url");
QTest::addColumn<QQuickWebEngineAuthenticationDialogRequest::AuthenticationType>("type");
QTest::addColumn<QString>("realm");
- QTest::addColumn<QByteArray>("reply");
+ QTest::addColumn<QByteArray>("response");
QTest::newRow("Http Authentication Dialog") << QUrl("http://localhost:5555/")
<< QQuickWebEngineAuthenticationDialogRequest::AuthenticationTypeHTTP
<< QStringLiteral("Very Restricted Area")
@@ -167,12 +167,13 @@ void tst_Dialogs::authenticationDialogRequested()
QFETCH(QUrl, url);
QFETCH(QQuickWebEngineAuthenticationDialogRequest::AuthenticationType, type);
QFETCH(QString, realm);
+ QFETCH(QByteArray, response);
- QFETCH(QByteArray, reply);
- Server server;
- server.setReply(reply);
- server.run();
- QTRY_VERIFY2(server.isListening(), "Could not setup authentication server");
+ HttpServer server(QHostAddress::LocalHost, 5555);
+ connect(&server, &HttpServer::newRequest, [url, response](HttpReqRep *rr) {
+ rr->sendResponse(response);
+ });
+ QVERIFY(server.start());
QSignalSpy dialogSpy(m_listener, &TestHandler::requestChanged);
m_listener->load(url);
@@ -186,6 +187,7 @@ void tst_Dialogs::authenticationDialogRequested()
QCOMPARE(dialog->realm(),realm);
QCOMPARE(dialog->url(), url);
QCOMPARE(dialog->proxyHost(), QStringLiteral("localhost"));
+ QVERIFY(server.stop());
}
void tst_Dialogs::javaScriptDialogRequested_data()
diff --git a/tests/auto/quick/inspectorserver/CMakeLists.txt b/tests/auto/quick/inspectorserver/CMakeLists.txt
new file mode 100644
index 000000000..e2c3bb2ab
--- /dev/null
+++ b/tests/auto/quick/inspectorserver/CMakeLists.txt
@@ -0,0 +1,9 @@
+qt_internal_add_test(tst_inspectorserver
+ SOURCES
+ tst_inspectorserver.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+)
+
+
diff --git a/tests/auto/quick/html/basic_page.html b/tests/auto/quick/inspectorserver/html/basic_page.html
index 53726e4a6..53726e4a6 100644
--- a/tests/auto/quick/html/basic_page.html
+++ b/tests/auto/quick/inspectorserver/html/basic_page.html
diff --git a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
index bc5aed9ef..de49f143c 100644
--- a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
+++ b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
@@ -70,8 +70,6 @@ tst_InspectorServer::tst_InspectorServer()
void tst_InspectorServer::prepareWebViewComponent()
{
static QQmlEngine* engine = new QQmlEngine(this);
- engine->addImportPath(QString::fromUtf8(IMPORT_DIR));
-
m_component.reset(new QQmlComponent(engine, this));
m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n"
@@ -119,7 +117,8 @@ QJsonArray tst_InspectorServer::fetchPageList() const
void tst_InspectorServer::testPageList()
{
- const QUrl testPageUrl = QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));
+ const QUrl testPageUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/html/basic_page.html"));
QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadRequest)));
webView()->setUrl(testPageUrl);
QTRY_VERIFY(loadSpy.size() && !webView()->isLoading());
@@ -132,7 +131,8 @@ void tst_InspectorServer::testPageList()
void tst_InspectorServer::testRemoteDebuggingMessage()
{
- const QUrl testPageUrl = QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));
+ const QUrl testPageUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/html/basic_page.html"));
QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadRequest)));
webView()->setUrl(testPageUrl);
QTRY_VERIFY(loadSpy.size() && !webView()->isLoading());
@@ -166,7 +166,8 @@ void tst_InspectorServer::testRemoteDebuggingMessage()
void tst_InspectorServer::openRemoteDebuggingSession()
{
- const QUrl testPageUrl = QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"));
+ const QUrl testPageUrl = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/html/basic_page.html"));
QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebEngineLoadRequest)));
webView()->setUrl(testPageUrl);
QTRY_VERIFY(loadSpy.size() && !webView()->isLoading());
diff --git a/tests/auto/quick/publicapi/CMakeLists.txt b/tests/auto/quick/publicapi/CMakeLists.txt
new file mode 100644
index 000000000..abed54a10
--- /dev/null
+++ b/tests/auto/quick/publicapi/CMakeLists.txt
@@ -0,0 +1,8 @@
+qt_internal_add_test(tst_publicapi
+ SOURCES
+ tst_publicapi.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Qt::WebEngineWidgetsPrivate
+)
diff --git a/tests/auto/quick/qmltests/CMakeLists.txt b/tests/auto/quick/qmltests/CMakeLists.txt
new file mode 100644
index 000000000..9aa4ca76c
--- /dev/null
+++ b/tests/auto/quick/qmltests/CMakeLists.txt
@@ -0,0 +1,102 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qmltests
+ SOURCES
+ tst_qmltests.cpp
+ LIBRARIES
+ Qt::WebEngineQuick
+ Qt::QuickTest
+ Test::HttpServer
+ Test::Util
+)
+
+set(testList
+ tst_action.qml
+ tst_activeFocusOnPress.qml
+ tst_audioMuted.qml
+ tst_desktopBehaviorLoadHtml.qml
+ tst_findText.qml
+ tst_focusOnNavigation.qml
+ tst_fullScreenRequest.qml
+ tst_geopermission.qml
+ tst_getUserMedia.qml
+ tst_keyboardEvents.qml
+ tst_keyboardModifierMapping.qml
+ tst_loadHtml.qml
+ tst_loadProgress.qml
+ tst_loadRecursionCrash.qml
+ tst_loadUrl.qml
+ tst_mouseMove.qml
+ tst_navigationRequested.qml
+ tst_newViewRequest.qml
+ tst_notification.qml
+ tst_profile.qml
+ tst_properties.qml
+ tst_runJavaScript.qml
+ tst_scrollPosition.qml
+ tst_settings.qml
+ tst_titleChanged.qml
+ tst_unhandledKeyEventPropagation.qml
+ tst_userScripts.qml
+ tst_viewSource.qml
+)
+
+if(QT_FEATURE_webengine_webchannel)
+ list(APPEND testList tst_webchannel.qml)
+endif()
+
+if(QT_FEATURE_ssl)
+ list(APPEND testList tst_certificateError.qml)
+endif()
+
+if(QT_FEATURE_webengine_testsupport)
+ list(APPEND testList
+ tst_favicon.qml
+ tst_faviconDownload.qml
+ tst_inputMethod.qml
+ tst_linkHovered.qml
+ tst_loadFail.qml
+ tst_mouseClick.qml
+ tst_viewSoure.qml
+ )
+# if(TARGET Qt::QuickControls) #FIXME
+ list(APPEND testList tst_javaScriptDialogs.qml)
+# else()
+# message("\n!!! QuickControls target is missing, some tests are not executed !!! FIXME \n")
+# endif()
+endif()
+
+if(TARGET Qt::QuickControls) #FIXME
+ list(APPEND testList
+ tst_contextMenu.qml
+ tst_download.qml
+ tst_filePicker.qml
+ )
+else()
+ message("\n!!!! QuickControls target is missing, some tests are not executed !!! FIXME \n")
+endif()
+
+if(TARGET Qt::QuickControls2)
+ list(APPEND testList tst_navigationHistory.qml)
+else()
+ message("\n!!!! QuickControls2 target is missing, some tests are not executed !!! FIXME \n")
+endif()
+
+set(content "")
+foreach(test ${testList})
+ set(contents "${contents}${CMAKE_CURRENT_LIST_DIR}/data/${test}\n")
+endforeach()
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/webengine.qmltests ${contents})
+
+set(tst_qmltests_resource_files
+ "resources/cert.pem"
+ "resources/key.pem"
+)
+
+qt_internal_add_resource(tst_qmltests "tst_qmltests"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qmltests_resource_files}
+)
diff --git a/tests/auto/quick/qmltests/data/tst_notification.qml b/tests/auto/quick/qmltests/data/tst_notification.qml
index 773bf4a8e..6f66256f2 100644
--- a/tests/auto/quick/qmltests/data/tst_notification.qml
+++ b/tests/auto/quick/qmltests/data/tst_notification.qml
@@ -29,6 +29,7 @@
import QtQuick 2.2
import QtTest 1.0
import QtWebEngine 1.9
+import Test.Shared 1.0 as Shared
TestWebEngineView {
id: view
@@ -60,7 +61,8 @@ TestWebEngineView {
when: windowShown
function resolverUrl(html) {
- return Qt.resolvedUrl('../../../shared/data/' + html)
+ console.log(Shared.HttpServer.sharedDataDir())
+ return Qt.resolvedUrl(Shared.HttpServer.sharedDataDir() + "/" + html)
}
function init() {
diff --git a/tests/auto/quick/qmltests/resources/cert.pem b/tests/auto/quick/qmltests/resources/cert.pem
new file mode 100644
index 000000000..3aaaf289c
--- /dev/null
+++ b/tests/auto/quick/qmltests/resources/cert.pem
@@ -0,0 +1,64 @@
+-----BEGIN CERTIFICATE-----
+MIIEpDCCAoygAwIBAgIUO90aty9AMjvBvzfUhr1WwdBrKkMwDQYJKoZIhvcNAQEL
+BQAwfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UEAwwpQmFkU1NM
+IEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTkwODI2MTQ0
+NDIxWhcNMTkwODI3MTQ0NDIxWjBjMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs
+aWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEPMA0GA1UECgwGQmFkU1NM
+MRYwFAYDVQQDDA0qLmJhZHNzbC50ZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
+MIIBCgKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb5ZW4
+7IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgmEhDG
+0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11LhEd
+MYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg09IC
+sb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wnLeFP
+UotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABozQwMjAJBgNVHRMEAjAAMCUG
+A1UdEQQeMByCDSouYmFkc3NsLnRlc3SCC2JhZHNzbC50ZXN0MA0GCSqGSIb3DQEB
+CwUAA4ICAQA7Yc+QQzqSK15ibmaYrkqq+cumggsWLCprW8jvzhpWBt9IjToP5nsy
+sKinYPoZR8jvZ1YVotcts7uQT7DkqeWkB+l+88c7gQdgujvBo6v9/g+jrXFKgsJD
+IBmkho8hpd63Slqv2Yp4bYT20O5EvR9CQvwSkwTs+ylBNEs1Q+AbekxmBjuYUxHn
+9xL4/GZ6ufoNv676iCoXo4mnDrCD8e8MRiZoU9Lq4G41HGiLWV0tM/M6BdVJYGzl
+FcBg0ZKnQT9OCWEPRe3zyRS6a+MivPAzxS8z/kYaRN+C7H68Mib3xPDsEETz1MnO
+uzGAPHAAgtYWYJi+CaaNWkgAv4n+UIQa0oyqPn4z5hLcsO+nMBws2Sg0mkQLilBX
+N1ciCdVMi7sHKuLa7GVksq/RQrXnZcQhoYQRrZAaAHKbxyo/M2pNqmDiFJppdH7a
+6Rj2vYf6ig/FXAzDGsDvf/tsGCxgJTFzGly+GsWVe40vyjfWHxWWDU/eGjfGO05k
+Xzjm+kYGJnH2hfiIlX1Jeu/jjIodiSy31F0hvuKlJu8PfaQ7oo5neRzwRO6Wq9rR
+7DMsQN6OtXGnnA+ogC0korA+aXev6wzbwYUhzMf1YTzEjrFNIXeIHsQSzq6lPcIE
+JOly5wjyO/eNF7mpHyDX8brY6Hn+bgyDeKAmsUvhOCEXgaPpKlP4gQ==
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIGeTCCBGGgAwIBAgIUbVL7tFc7sgPIYnt+REVc0wiHdBcwDQYJKoZIhvcNAQEL
+BQAwdzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEqMCgGA1UEAwwhQmFkU1NM
+IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTE5MDgyNjE0NDQyMFoXDTI5
+MDgyMzE0NDQyMFowfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx
+FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UE
+AwwpQmFkU1NMIEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIi
+MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgoU4q43DJEUyoAOeK31uyEgLn
+s5CCd6XFmGp6wln0yupwmYRaDiCoSJ1qpmjYt+gIHpDAFS2ZzR4TbZORFirjY0cQ
+6+IWwpBEQR0hOluWN99CqjdCxfuZwiTvTV3FQv1IJZ13g23Uh2xRbnrzC2muDHzT
+4ZNM3aayvziMGY6n33aksEc6WMZb3p/Qn2OepeC7EzZiy4tXKPf9OaOPbae5aJWZ
+bOzzydFLkV4UqZb5FfySt8toIivPeIlRCiPodWLb2y5DYUXyWBk1dpbIcVa/LusV
+vsBELeJ+BFDRH1NHtwOrhOkZHKMr3SQ1YRlNDEeHUVmQkori397j9JjpPzScQJ6r
+d/W4mGyzgRmguIy9IpKMbxX5/1A6c6l5q0HqMgPv84GWxlhav4xwsOf90iT2vLPZ
+yllVCgCsCfvLEyVFhER18HAo8mTkQqKL7ZO96xXHgugA7dFN/C3BdC9kYP/GbAwd
+J0R6qKrfSiyyk1VbjWfFdFH/G/bT9H0nrjMj5tCT4q/zDCb5HkBp3BOoyUKb9yyt
+a1Cht/Iu3f1SlQzsrDBt9iMMCjXoNNAJcV7ZZ6HCxcWwfAwxgylQgq8UG60shxhn
+CBPhcA8JM+mk2nghTU2pxwY/KpAd0H4/a79b0DE97dCOnNHzyP3tqP8RenG549B0
+gsNO60aG01k6P9jFuQIDAQABo4H0MIHxMB0GA1UdDgQWBBQgvWmDuYqQ6xX7y8xc
+cgky1FO7jzCBtAYDVR0jBIGsMIGpgBTUGo+svIaoSMF/shILSbeiQ1zAQKF7pHkw
+dzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNh
+biBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEqMCgGA1UEAwwhQmFkU1NMIFJv
+b3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5ghR1qCPxzkfCSCwMFHm98245f0pk0zAM
+BgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAnGr6
+t1+KNGZV9hmAE3SyMzHRpgwtqIG4kl94A7Pz3CbA8+q7u7DW8l1GdaNx2J2wo+R5
+rJi02V5e7TNa7ZS5S9WGYHZ2y6QOjXuT28VMAPX+3HAgxk3RMxocpLpkPp8hhD/9
+S5KxA6AQDUN6av8E3xeuuWYWmTvAXNHK5ABXDFxxTp902ozNnZaSk2DxAUqcsOD4
+ago0IhRdkFGe1Q7F8gOxtlUL5owNL4uhRP8BbwOja2Gopn2+kA9CNqdwPI4Ipjlr
+yo61oCqzy3RAXOUct8WAvybacADmJODAxDq9O5fAZuYZScjjj1ASowmbyDH/Wb9z
++WfiKKH4BfgOIukzK3I1M9wiSDefIodCFfEVXbdNudZj8f9Gw4RrZwkUuxDLeRWG
+ReDtzAWq7G0Diw3uX40S4jaj3MeS6oHp2Nrj/VyjSRiYTeN/pnA9N0M5VuCYYvXD
+f50rrigjQfOgb4TmnyJAjXWVkXW7Fa+ooLsbvlfr8wP8f31y1cgWPHTVIv6Kmug7
+Bg88k3x5gLTXmutDjseORonhGMRdAxHgJVf5aKfzdRpwXZTDZJXhsAz9OdlOhNZd
+UrYo680QugA0V3H5D8Egbr2AUUSMDkn133COjeOIDknFxX3qDqeTzqLZCAEBIoKn
+Adpix0jvG1Ys4Ayq6K2wQFdGFjtl6LsiGC7pWWU=
+-----END CERTIFICATE-----
diff --git a/tests/auto/quick/qmltests/resources/key.pem b/tests/auto/quick/qmltests/resources/key.pem
new file mode 100644
index 000000000..89922679a
--- /dev/null
+++ b/tests/auto/quick/qmltests/resources/key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb
+5ZW47IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgm
+EhDG0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11
+LhEdMYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg
+09ICsb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wn
+LeFPUotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABAoIBADRXy3BL98UVo+tD
+2ClBtBFKJBy5N9ADQyvH4SZ8TLO/423L7+xqpaz7eYppHWKfaBHorTuBnFRtquhO
+vo+Xo63iPFMirMFf+NMlq2MgilYBoMQrE9+5N//BZECGWlaGCcekrH5RRIMUXLlg
+rzm98lfE7pbQNIo39bQV97NpAJqBWPuoIvCrbRCysGoA5j7ptZ/EhSlC00eA7ybD
+CeYHmh8NrsapKOTGb5u1v3paV8X/mH6vKmsVs7n6LC0opBxzM8eAHEAQ6h8rmz9H
+y99FWDYha3lOS4SLkTnuRnNHOMLJajPq3Isu+BgzLWuRGnKZ3rmuUFwPNkCZTvsV
+dTdBE4ECgYEAw6jBEil0e8Pc9sGqnz93e8qrYE9wSPso4q3BNJgTbN48kon6mqh7
+gQVgEP/75Th5YrJUrY9Pd/8H9uoMOxbDXgOXG/xNnhC0L+7aM8nhKlxCLndY1e56
+/YymYYH4+D9ZD2u526mK/nmCg2QGOkCVYYp7NXe/mA0g34drKjefmj8CgYEAwIhq
+rZhlfAvQThSOqQA9zA7NXPDh4KzIjr8htVu5YvVcv5W2uhsni9DXFaloPnhuLdJ7
+MnPF2WqzQ9YqFrGn/9/OTqeE23f60ed04qLGM4BApb45y5Kw6sCPnWu7dMYfny9i
+XeZA2A+ODmqVkrU+ZNVzqzS1krYyUP3exd1voyUCgYEAqPRARH6np3gqhqoVvA4C
+D1OjSTdPrrWzSIriG5h2rbv6ck/Tp1l1zKPnoMZrrjRmHWQA2x61cNk4926DwUKW
+0cgn5HKqU6P49Ks8oRvi48FnJNjKTXHxoqChy/GAHF4Xecl8ZMKy06v5l5v4BLVg
+SSpb2n/dYl9z05IMaBhAKeECgYBKB2n1S6ah1q0GiLL92mDoiDyAYwKG8AjBkk40
+vIsAuNUruTYkQvKmuOsqohO6CXZb2hWSpZ9KZNN+3ucaCL9PDE/4QEM+W9iuQu/X
+gLzy6npxAD6avtGVweq2ncjbMp7QB1ksP69pJDn74xGV8miGPuiVyNOUEMgyChtR
+Oz6EnQKBgEth0w80CBg6b3NKuASoc/vC08njZQvWpe5xrzY2DL8epVKb1qf6+8SE
+eX34cIcSaonEZ2g67MAeIG6jtmPwxWk4EYAsO1u4XiyziABkoNyLKVH4hZg61BsV
+jL7R5UrUvBbhKLFOwkcB4Kwdwu7COB/UKa5XJBTMbuw1UTyxlUeI
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp
index 906de29ad..2cf811f91 100644
--- a/tests/auto/quick/qmltests/tst_qmltests.cpp
+++ b/tests/auto/quick/qmltests/tst_qmltests.cpp
@@ -36,8 +36,8 @@
#include <QTemporaryDir>
#include <QtQuickTest/quicktest.h>
#include <QtWebEngineQuick/QQuickWebEngineProfile>
-#include <QQmlEngine>
-#include "qt_webengine_quicktest.h"
+#include <QtQml/QQmlEngine>
+#include <qt_webengine_quicktest.h>
#if defined(Q_OS_LINUX) && defined(QT_DEBUG)
#include <fcntl.h>
@@ -151,17 +151,19 @@ int main(int argc, char **argv)
QTEST_SET_MAIN_SOURCE_PATH
qmlRegisterSingletonType<HttpServer>("Test.Shared", 1, 0, "HttpServer", [&] (QQmlEngine *, QJSEngine *) {
auto server = new HttpServer;
- server->setResourceDirs({ TESTS_SHARED_DATA_DIR, QUICK_TEST_SOURCE_DIR });
+ server->setResourceDirs(
+ { server->sharedDataDir(),
+ QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() + QLatin1String("/data") });
return server;
});
#if QT_CONFIG(ssl)
qmlRegisterSingletonType<HttpsServer>(
"Test.Shared", 1, 0, "HttpsServer",
- [&](QQmlEngine *, QJSEngine *) { return new HttpsServer; });
+ [&](QQmlEngine *, QJSEngine *) { return new HttpsServer(":/resources/cert.pem",":/resources/key.pem"); });
#endif
- int i = quick_test_main(argc, argv, "qmltests", QUICK_TEST_SOURCE_DIR);
+ int i = quick_test_main(argc, argv, "qmltests", qPrintable(QT_TESTCASE_BUILDDIR + QLatin1String("/webengine.qmltests")));
return i;
}
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt
new file mode 100644
index 000000000..07b184b89
--- /dev/null
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt
@@ -0,0 +1,10 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qquickwebenginedefaultsurfaceformat
+ SOURCES
+ tst_qquickwebenginedefaultsurfaceformat.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineQuickPrivate
+ Test::Util
+)
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html
new file mode 100644
index 000000000..53726e4a6
--- /dev/null
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/html/basic_page.html
@@ -0,0 +1,6 @@
+<html>
+<head>
+<title> Basic Page </title>
+</head>
+<h1>Basic page</h1>
+</html>
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
index 016e8232f..4275ae971 100644
--- a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "testwindow.h"
-#include "util.h"
+#include "quickutil.h"
#include <QGuiApplication>
#include <QtQml/QQmlEngine>
@@ -93,7 +93,7 @@ inline QQuickWebEngineView *tst_QQuickWebEngineDefaultSurfaceFormat::webEngineVi
QUrl tst_QQuickWebEngineDefaultSurfaceFormat::urlFromTestPath(const char *localFilePath)
{
- QString testSourceDirPath = QString::fromLocal8Bit(TESTS_SOURCE_DIR);
+ QString testSourceDirPath = QDir(QT_TESTCASE_SOURCEDIR).canonicalPath();
if (!testSourceDirPath.endsWith(QLatin1Char('/')))
testSourceDirPath.append(QLatin1Char('/'));
diff --git a/tests/auto/quick/qquickwebengineview/CMakeLists.txt b/tests/auto/quick/qquickwebengineview/CMakeLists.txt
new file mode 100644
index 000000000..45c44034a
--- /dev/null
+++ b/tests/auto/quick/qquickwebengineview/CMakeLists.txt
@@ -0,0 +1,13 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qquickwebengineview
+ SOURCES
+ tst_qquickwebengineview.cpp
+ LIBRARIES
+ Qt::WebEngineCorePrivate
+ Qt::WebEngineWidgets
+ Qt::WebEngineQuick
+ Qt::GuiPrivate
+ Qt::WebEngineQuickPrivate
+ Test::Util
+)
diff --git a/tests/auto/quick/qquickwebengineview/html/basic_page.html b/tests/auto/quick/qquickwebengineview/html/basic_page.html
new file mode 100644
index 000000000..53726e4a6
--- /dev/null
+++ b/tests/auto/quick/qquickwebengineview/html/basic_page.html
@@ -0,0 +1,6 @@
+<html>
+<head>
+<title> Basic Page </title>
+</head>
+<h1>Basic page</h1>
+</html>
diff --git a/tests/auto/quick/html/basic_page2.html b/tests/auto/quick/qquickwebengineview/html/basic_page2.html
index f8cff2969..f8cff2969 100644
--- a/tests/auto/quick/html/basic_page2.html
+++ b/tests/auto/quick/qquickwebengineview/html/basic_page2.html
diff --git a/tests/auto/quick/html/direct-image-compositing.html b/tests/auto/quick/qquickwebengineview/html/direct-image-compositing.html
index 53a4ca137..53a4ca137 100644
--- a/tests/auto/quick/html/direct-image-compositing.html
+++ b/tests/auto/quick/qquickwebengineview/html/direct-image-compositing.html
diff --git a/tests/auto/quick/html/inputmethod.html b/tests/auto/quick/qquickwebengineview/html/inputmethod.html
index dc9140f9d..dc9140f9d 100644
--- a/tests/auto/quick/html/inputmethod.html
+++ b/tests/auto/quick/qquickwebengineview/html/inputmethod.html
diff --git a/tests/auto/quick/html/resources/simple_image.png b/tests/auto/quick/qquickwebengineview/html/resources/simple_image.png
index 4685399ca..4685399ca 100644
--- a/tests/auto/quick/html/resources/simple_image.png
+++ b/tests/auto/quick/qquickwebengineview/html/resources/simple_image.png
Binary files differ
diff --git a/tests/auto/quick/html/scroll.html b/tests/auto/quick/qquickwebengineview/html/scroll.html
index ce2193b6c..ce2193b6c 100644
--- a/tests/auto/quick/html/scroll.html
+++ b/tests/auto/quick/qquickwebengineview/html/scroll.html
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 30441ac11..d0df5ffe0 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "testwindow.h"
-#include "util.h"
+#include "quickutil.h"
#include <QScopedPointer>
#include <QtCore/qelapsedtimer.h>
@@ -111,7 +111,7 @@ tst_QQuickWebEngineView::tst_QQuickWebEngineView()
QtWebEngine::initialize();
QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true);
- m_testSourceDirPath = QString::fromLocal8Bit(TESTS_SOURCE_DIR);
+ m_testSourceDirPath = QDir(QT_TESTCASE_SOURCEDIR).canonicalPath();
if (!m_testSourceDirPath.endsWith(QLatin1Char('/')))
m_testSourceDirPath.append(QLatin1Char('/'));
@@ -1252,3 +1252,4 @@ static QByteArrayList params = QByteArrayList()
W_QTEST_MAIN(tst_QQuickWebEngineView, params)
#include "tst_qquickwebengineview.moc"
+#include "moc_quickutil.cpp"
diff --git a/tests/auto/quick/qtbug-70248/CMakeLists.txt b/tests/auto/quick/qtbug-70248/CMakeLists.txt
new file mode 100644
index 000000000..cc6f120b0
--- /dev/null
+++ b/tests/auto/quick/qtbug-70248/CMakeLists.txt
@@ -0,0 +1,17 @@
+qt_internal_add_test(tst_qtbug-70248
+ SOURCES
+ tst_qtbug-70248.cpp
+ LIBRARIES
+ Qt::WebEngineQuickPrivate
+)
+
+set(test_resource_files
+ "test.qml"
+)
+
+qt_add_resource(tst_qtbug-70248 "test"
+ PREFIX
+ "/"
+ FILES
+ ${test_resource_files}
+)
diff --git a/tests/auto/util/CMakeLists.txt b/tests/auto/util/CMakeLists.txt
new file mode 100644
index 000000000..fa2f84cec
--- /dev/null
+++ b/tests/auto/util/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.18)
+project(minimal LANGUAGES CXX)
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Network)
+
+include(util.cmake)
diff --git a/tests/auto/quick/shared/qt_webengine_quicktest.h b/tests/auto/util/qt_webengine_quicktest.h
index 3adc9d459..55ccd9f33 100644
--- a/tests/auto/quick/shared/qt_webengine_quicktest.h
+++ b/tests/auto/util/qt_webengine_quicktest.h
@@ -42,10 +42,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QUICK_TEST_SOURCE_DIR
-#define QUICK_TEST_SOURCE_DIR 0
-#endif
-
#ifdef QT_WIDGETS_LIB
#define Application QApplication
#else
diff --git a/tests/auto/quick/shared/util.h b/tests/auto/util/quickutil.h
index 34afbbb45..34afbbb45 100644
--- a/tests/auto/quick/shared/util.h
+++ b/tests/auto/util/quickutil.h
diff --git a/tests/auto/quick/shared/testwindow.h b/tests/auto/util/testwindow.h
index b57443c69..b57443c69 100644
--- a/tests/auto/quick/shared/testwindow.h
+++ b/tests/auto/util/testwindow.h
diff --git a/tests/auto/util/util.cmake b/tests/auto/util/util.cmake
new file mode 100644
index 000000000..84d7f593f
--- /dev/null
+++ b/tests/auto/util/util.cmake
@@ -0,0 +1,5 @@
+if (NOT TARGET Test::Util)
+ add_library(qtestutil INTERFACE)
+ target_include_directories(qtestutil INTERFACE ${CMAKE_CURRENT_LIST_DIR})
+ add_library(Test::Util ALIAS qtestutil)
+endif()
diff --git a/tests/auto/widgets/util.h b/tests/auto/util/util.h
index 3be9a91b9..537b9212b 100644
--- a/tests/auto/widgets/util.h
+++ b/tests/auto/util/util.h
@@ -38,10 +38,6 @@
#include <qwebenginepage.h>
#include <qwebengineview.h>
-#if !defined(TESTS_SOURCE_DIR)
-#define TESTS_SOURCE_DIR ""
-#endif
-
// Disconnect signal on destruction.
class ScopedConnection
{
diff --git a/tests/auto/widgets/CMakeLists.txt b/tests/auto/widgets/CMakeLists.txt
new file mode 100644
index 000000000..7072329c3
--- /dev/null
+++ b/tests/auto/widgets/CMakeLists.txt
@@ -0,0 +1,36 @@
+if(NOT boot2qt)
+ add_subdirectory(defaultsurfaceformat)
+ add_subdirectory(devtools)
+ add_subdirectory(qwebenginepage)
+ add_subdirectory(qwebengineprofile)
+ add_subdirectory(qwebengineview)
+endif()
+add_subdirectory(faviconmanager)
+add_subdirectory(loadsignals)
+add_subdirectory(origins)
+add_subdirectory(proxy)
+add_subdirectory(proxypac)
+add_subdirectory(schemes)
+add_subdirectory(shutdown)
+add_subdirectory(qwebenginedownloadrequest)
+add_subdirectory(qwebenginehistory)
+add_subdirectory(qwebenginescript)
+add_subdirectory(qwebenginesettings)
+if(LINUX)
+ add_subdirectory(offscreen)
+endif()
+if(NOT MACOS)
+ add_subdirectory(touchinput)
+endif()
+if(QT_FEATURE_accessibility AND NOT boot2qt)
+ add_subdirectory(accessibility)
+endif()
+if(QT_FEATURE_webengine_printing_and_pdf)
+ add_subdirectory(printing)
+endif()
+if(QT_FEATURE_ssl)
+ add_subdirectory(certificateerror)
+endif()
+if(QT_FEATURE_webengine_spellchecker AND NOT CMAKE_CROSSCOMPILING AND NOT QT_FEATURE_webengine_native_spellchecker)
+# add_subdirectory(spellchecking)
+endif()
diff --git a/tests/auto/widgets/accessibility/CMakeLists.txt b/tests/auto/widgets/accessibility/CMakeLists.txt
new file mode 100644
index 000000000..9653ef1c0
--- /dev/null
+++ b/tests/auto/widgets/accessibility/CMakeLists.txt
@@ -0,0 +1,9 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_accessibility
+ SOURCES
+ tst_accessibility.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::Util
+)
diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp
index 46d26e6c6..429a40f4d 100644
--- a/tests/auto/widgets/accessibility/tst_accessibility.cpp
+++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp
@@ -18,7 +18,7 @@
*/
#include <qtest.h>
-#include "../util.h"
+#include <util.h>
#include <QHBoxLayout>
#include <QMainWindow>
diff --git a/tests/auto/widgets/certificateerror/CMakeLists.txt b/tests/auto/widgets/certificateerror/CMakeLists.txt
new file mode 100644
index 000000000..71721e8f5
--- /dev/null
+++ b/tests/auto/widgets/certificateerror/CMakeLists.txt
@@ -0,0 +1,23 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_certificateerror
+ SOURCES
+ tst_certificateerror.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
+
+set(tst_certificateerror_resource_files
+ "resources/cert.pem"
+ "resources/key.pem"
+)
+
+qt_internal_add_resource(tst_certificateerror "tst_certificateerror"
+ PREFIX
+ "/"
+ FILES
+ ${tst_certificateerror_resource_files}
+)
diff --git a/tests/auto/widgets/certificateerror/resources/cert.pem b/tests/auto/widgets/certificateerror/resources/cert.pem
new file mode 100644
index 000000000..3aaaf289c
--- /dev/null
+++ b/tests/auto/widgets/certificateerror/resources/cert.pem
@@ -0,0 +1,64 @@
+-----BEGIN CERTIFICATE-----
+MIIEpDCCAoygAwIBAgIUO90aty9AMjvBvzfUhr1WwdBrKkMwDQYJKoZIhvcNAQEL
+BQAwfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UEAwwpQmFkU1NM
+IEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTkwODI2MTQ0
+NDIxWhcNMTkwODI3MTQ0NDIxWjBjMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs
+aWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEPMA0GA1UECgwGQmFkU1NM
+MRYwFAYDVQQDDA0qLmJhZHNzbC50ZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
+MIIBCgKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb5ZW4
+7IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgmEhDG
+0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11LhEd
+MYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg09IC
+sb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wnLeFP
+UotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABozQwMjAJBgNVHRMEAjAAMCUG
+A1UdEQQeMByCDSouYmFkc3NsLnRlc3SCC2JhZHNzbC50ZXN0MA0GCSqGSIb3DQEB
+CwUAA4ICAQA7Yc+QQzqSK15ibmaYrkqq+cumggsWLCprW8jvzhpWBt9IjToP5nsy
+sKinYPoZR8jvZ1YVotcts7uQT7DkqeWkB+l+88c7gQdgujvBo6v9/g+jrXFKgsJD
+IBmkho8hpd63Slqv2Yp4bYT20O5EvR9CQvwSkwTs+ylBNEs1Q+AbekxmBjuYUxHn
+9xL4/GZ6ufoNv676iCoXo4mnDrCD8e8MRiZoU9Lq4G41HGiLWV0tM/M6BdVJYGzl
+FcBg0ZKnQT9OCWEPRe3zyRS6a+MivPAzxS8z/kYaRN+C7H68Mib3xPDsEETz1MnO
+uzGAPHAAgtYWYJi+CaaNWkgAv4n+UIQa0oyqPn4z5hLcsO+nMBws2Sg0mkQLilBX
+N1ciCdVMi7sHKuLa7GVksq/RQrXnZcQhoYQRrZAaAHKbxyo/M2pNqmDiFJppdH7a
+6Rj2vYf6ig/FXAzDGsDvf/tsGCxgJTFzGly+GsWVe40vyjfWHxWWDU/eGjfGO05k
+Xzjm+kYGJnH2hfiIlX1Jeu/jjIodiSy31F0hvuKlJu8PfaQ7oo5neRzwRO6Wq9rR
+7DMsQN6OtXGnnA+ogC0korA+aXev6wzbwYUhzMf1YTzEjrFNIXeIHsQSzq6lPcIE
+JOly5wjyO/eNF7mpHyDX8brY6Hn+bgyDeKAmsUvhOCEXgaPpKlP4gQ==
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIGeTCCBGGgAwIBAgIUbVL7tFc7sgPIYnt+REVc0wiHdBcwDQYJKoZIhvcNAQEL
+BQAwdzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEqMCgGA1UEAwwhQmFkU1NM
+IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTE5MDgyNjE0NDQyMFoXDTI5
+MDgyMzE0NDQyMFowfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx
+FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UE
+AwwpQmFkU1NMIEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIi
+MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgoU4q43DJEUyoAOeK31uyEgLn
+s5CCd6XFmGp6wln0yupwmYRaDiCoSJ1qpmjYt+gIHpDAFS2ZzR4TbZORFirjY0cQ
+6+IWwpBEQR0hOluWN99CqjdCxfuZwiTvTV3FQv1IJZ13g23Uh2xRbnrzC2muDHzT
+4ZNM3aayvziMGY6n33aksEc6WMZb3p/Qn2OepeC7EzZiy4tXKPf9OaOPbae5aJWZ
+bOzzydFLkV4UqZb5FfySt8toIivPeIlRCiPodWLb2y5DYUXyWBk1dpbIcVa/LusV
+vsBELeJ+BFDRH1NHtwOrhOkZHKMr3SQ1YRlNDEeHUVmQkori397j9JjpPzScQJ6r
+d/W4mGyzgRmguIy9IpKMbxX5/1A6c6l5q0HqMgPv84GWxlhav4xwsOf90iT2vLPZ
+yllVCgCsCfvLEyVFhER18HAo8mTkQqKL7ZO96xXHgugA7dFN/C3BdC9kYP/GbAwd
+J0R6qKrfSiyyk1VbjWfFdFH/G/bT9H0nrjMj5tCT4q/zDCb5HkBp3BOoyUKb9yyt
+a1Cht/Iu3f1SlQzsrDBt9iMMCjXoNNAJcV7ZZ6HCxcWwfAwxgylQgq8UG60shxhn
+CBPhcA8JM+mk2nghTU2pxwY/KpAd0H4/a79b0DE97dCOnNHzyP3tqP8RenG549B0
+gsNO60aG01k6P9jFuQIDAQABo4H0MIHxMB0GA1UdDgQWBBQgvWmDuYqQ6xX7y8xc
+cgky1FO7jzCBtAYDVR0jBIGsMIGpgBTUGo+svIaoSMF/shILSbeiQ1zAQKF7pHkw
+dzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNh
+biBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEqMCgGA1UEAwwhQmFkU1NMIFJv
+b3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5ghR1qCPxzkfCSCwMFHm98245f0pk0zAM
+BgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAnGr6
+t1+KNGZV9hmAE3SyMzHRpgwtqIG4kl94A7Pz3CbA8+q7u7DW8l1GdaNx2J2wo+R5
+rJi02V5e7TNa7ZS5S9WGYHZ2y6QOjXuT28VMAPX+3HAgxk3RMxocpLpkPp8hhD/9
+S5KxA6AQDUN6av8E3xeuuWYWmTvAXNHK5ABXDFxxTp902ozNnZaSk2DxAUqcsOD4
+ago0IhRdkFGe1Q7F8gOxtlUL5owNL4uhRP8BbwOja2Gopn2+kA9CNqdwPI4Ipjlr
+yo61oCqzy3RAXOUct8WAvybacADmJODAxDq9O5fAZuYZScjjj1ASowmbyDH/Wb9z
++WfiKKH4BfgOIukzK3I1M9wiSDefIodCFfEVXbdNudZj8f9Gw4RrZwkUuxDLeRWG
+ReDtzAWq7G0Diw3uX40S4jaj3MeS6oHp2Nrj/VyjSRiYTeN/pnA9N0M5VuCYYvXD
+f50rrigjQfOgb4TmnyJAjXWVkXW7Fa+ooLsbvlfr8wP8f31y1cgWPHTVIv6Kmug7
+Bg88k3x5gLTXmutDjseORonhGMRdAxHgJVf5aKfzdRpwXZTDZJXhsAz9OdlOhNZd
+UrYo680QugA0V3H5D8Egbr2AUUSMDkn133COjeOIDknFxX3qDqeTzqLZCAEBIoKn
+Adpix0jvG1Ys4Ayq6K2wQFdGFjtl6LsiGC7pWWU=
+-----END CERTIFICATE-----
diff --git a/tests/auto/widgets/certificateerror/resources/key.pem b/tests/auto/widgets/certificateerror/resources/key.pem
new file mode 100644
index 000000000..89922679a
--- /dev/null
+++ b/tests/auto/widgets/certificateerror/resources/key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb
+5ZW47IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgm
+EhDG0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11
+LhEdMYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg
+09ICsb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wn
+LeFPUotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABAoIBADRXy3BL98UVo+tD
+2ClBtBFKJBy5N9ADQyvH4SZ8TLO/423L7+xqpaz7eYppHWKfaBHorTuBnFRtquhO
+vo+Xo63iPFMirMFf+NMlq2MgilYBoMQrE9+5N//BZECGWlaGCcekrH5RRIMUXLlg
+rzm98lfE7pbQNIo39bQV97NpAJqBWPuoIvCrbRCysGoA5j7ptZ/EhSlC00eA7ybD
+CeYHmh8NrsapKOTGb5u1v3paV8X/mH6vKmsVs7n6LC0opBxzM8eAHEAQ6h8rmz9H
+y99FWDYha3lOS4SLkTnuRnNHOMLJajPq3Isu+BgzLWuRGnKZ3rmuUFwPNkCZTvsV
+dTdBE4ECgYEAw6jBEil0e8Pc9sGqnz93e8qrYE9wSPso4q3BNJgTbN48kon6mqh7
+gQVgEP/75Th5YrJUrY9Pd/8H9uoMOxbDXgOXG/xNnhC0L+7aM8nhKlxCLndY1e56
+/YymYYH4+D9ZD2u526mK/nmCg2QGOkCVYYp7NXe/mA0g34drKjefmj8CgYEAwIhq
+rZhlfAvQThSOqQA9zA7NXPDh4KzIjr8htVu5YvVcv5W2uhsni9DXFaloPnhuLdJ7
+MnPF2WqzQ9YqFrGn/9/OTqeE23f60ed04qLGM4BApb45y5Kw6sCPnWu7dMYfny9i
+XeZA2A+ODmqVkrU+ZNVzqzS1krYyUP3exd1voyUCgYEAqPRARH6np3gqhqoVvA4C
+D1OjSTdPrrWzSIriG5h2rbv6ck/Tp1l1zKPnoMZrrjRmHWQA2x61cNk4926DwUKW
+0cgn5HKqU6P49Ks8oRvi48FnJNjKTXHxoqChy/GAHF4Xecl8ZMKy06v5l5v4BLVg
+SSpb2n/dYl9z05IMaBhAKeECgYBKB2n1S6ah1q0GiLL92mDoiDyAYwKG8AjBkk40
+vIsAuNUruTYkQvKmuOsqohO6CXZb2hWSpZ9KZNN+3ucaCL9PDE/4QEM+W9iuQu/X
+gLzy6npxAD6avtGVweq2ncjbMp7QB1ksP69pJDn74xGV8miGPuiVyNOUEMgyChtR
+Oz6EnQKBgEth0w80CBg6b3NKuASoc/vC08njZQvWpe5xrzY2DL8epVKb1qf6+8SE
+eX34cIcSaonEZ2g67MAeIG6jtmPwxWk4EYAsO1u4XiyziABkoNyLKVH4hZg61BsV
+jL7R5UrUvBbhKLFOwkcB4Kwdwu7COB/UKa5XJBTMbuw1UTyxlUeI
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
index 9865162cb..2f03c3275 100644
--- a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
+++ b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
@@ -86,7 +86,7 @@ void tst_CertificateError::handleError_data()
void tst_CertificateError::handleError()
{
- HttpsServer server;
+ HttpsServer server(":/resources/cert.pem",":/resources/key.pem");
server.setExpectError(true);
QVERIFY(server.start());
diff --git a/tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt b/tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt
new file mode 100644
index 000000000..871c92350
--- /dev/null
+++ b/tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt
@@ -0,0 +1,20 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_defaultsurfaceformat
+ SOURCES
+ tst_defaultsurfaceformat.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::Util
+)
+
+set(tst_defaultsurfaceformat_resource_files
+ "resources/index.html"
+)
+
+qt_add_resource(tst_defaultsurfaceformat "tst_defaultsurfaceformat"
+ PREFIX
+ "/"
+ FILES
+ ${tst_defaultsurfaceformat_resource_files}
+)
diff --git a/tests/auto/widgets/defaultsurfaceformat/tst_defaultsurfaceformat.cpp b/tests/auto/widgets/defaultsurfaceformat/tst_defaultsurfaceformat.cpp
index 697ed3d08..7a52a372a 100644
--- a/tests/auto/widgets/defaultsurfaceformat/tst_defaultsurfaceformat.cpp
+++ b/tests/auto/widgets/defaultsurfaceformat/tst_defaultsurfaceformat.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include <qtest.h>
-#include "../util.h"
+#include <util.h>
#include <QSurfaceFormat>
#include <QTimer>
diff --git a/tests/auto/widgets/devtools/CMakeLists.txt b/tests/auto/widgets/devtools/CMakeLists.txt
new file mode 100644
index 000000000..2ef09df12
--- /dev/null
+++ b/tests/auto/widgets/devtools/CMakeLists.txt
@@ -0,0 +1,7 @@
+qt_internal_add_test(tst_devtools
+ SOURCES
+ tst_devtools.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+)
+
diff --git a/tests/auto/widgets/faviconmanager/CMakeLists.txt b/tests/auto/widgets/faviconmanager/CMakeLists.txt
new file mode 100644
index 000000000..89bee5a2a
--- /dev/null
+++ b/tests/auto/widgets/faviconmanager/CMakeLists.txt
@@ -0,0 +1,29 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_faviconmanager
+ SOURCES
+ tst_faviconmanager.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::Util
+)
+
+set(tst_faviconmanager_resource_files
+ "resources/favicon-misc.html"
+ "resources/favicon-multi.html"
+ "resources/favicon-shortcut.html"
+ "resources/favicon-single.html"
+ "resources/favicon-touch.html"
+ "resources/favicon-unavailable.html"
+ "resources/icons/qt144.png"
+ "resources/icons/qt32.ico"
+ "resources/icons/qtmulti.ico"
+ "resources/test1.html"
+)
+
+qt_add_resource(tst_faviconmanager "tst_faviconmanager"
+ PREFIX
+ "/"
+ FILES
+ ${tst_faviconmanager_resource_files}
+)
diff --git a/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp b/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp
index 46038cdc6..8e9bb2470 100644
--- a/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp
+++ b/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include <QtTest/QtTest>
-#include "../util.h"
+#include <util.h>
#include <qwebenginepage.h>
#include <qwebengineprofile.h>
@@ -97,14 +97,19 @@ void tst_FaviconManager::cleanup()
void tst_FaviconManager::faviconLoad()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
- QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-single.html"));
+ QUrl url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-single.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -113,7 +118,9 @@ void tst_FaviconManager::faviconLoad()
QUrl iconUrl = iconUrlChangedSpy.at(0).at(0).toString();
QCOMPARE(iconUrl, m_page->iconUrl());
- QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/icons/qt32.ico")));
+ QCOMPARE(iconUrl,
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/qt32.ico")));
const QIcon &icon = m_page->icon();
QVERIFY(!icon.isNull());
@@ -150,14 +157,20 @@ void tst_FaviconManager::faviconLoadFromResources()
void tst_FaviconManager::faviconLoadEncodedUrl()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
- QString urlString = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-single.html")).toString();
+ QString urlString = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-single.html"))
+ .toString();
QUrl url(urlString + QLatin1String("?favicon=load should work with#whitespace!"));
m_page->load(url);
@@ -167,7 +180,9 @@ void tst_FaviconManager::faviconLoadEncodedUrl()
QUrl iconUrl = iconUrlChangedSpy.at(0).at(0).toString();
QCOMPARE(m_page->iconUrl(), iconUrl);
- QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/icons/qt32.ico")));
+ QCOMPARE(iconUrl,
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/qt32.ico")));
const QIcon &icon = m_page->icon();
QVERIFY(!icon.isNull());
@@ -179,14 +194,19 @@ void tst_FaviconManager::faviconLoadEncodedUrl()
void tst_FaviconManager::noFavicon()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
- QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/test1.html"));
+ QUrl url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/test1.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -216,14 +236,19 @@ void tst_FaviconManager::aboutBlank()
void tst_FaviconManager::unavailableFavicon()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
- QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-unavailable.html"));
+ QUrl url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-unavailable.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -274,8 +299,12 @@ void tst_FaviconManager::errorPageDisabled()
void tst_FaviconManager::bestFavicon()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
@@ -285,7 +314,8 @@ void tst_FaviconManager::bestFavicon()
QIcon icon;
QSize iconSize;
- url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-misc.html"));
+ url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-misc.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -295,7 +325,9 @@ void tst_FaviconManager::bestFavicon()
iconUrl = iconUrlChangedSpy.at(0).at(0).toString();
QCOMPARE(iconUrl, m_page->iconUrl());
// Touch icon is ignored
- QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/icons/qt32.ico")));
+ QCOMPARE(iconUrl,
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/qt32.ico")));
icon = m_page->icon();
QVERIFY(!icon.isNull());
@@ -308,7 +340,8 @@ void tst_FaviconManager::bestFavicon()
iconUrlChangedSpy.clear();
iconChangedSpy.clear();
- url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-shortcut.html"));
+ url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-shortcut.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -326,7 +359,9 @@ void tst_FaviconManager::bestFavicon()
}
QCOMPARE(iconUrl, m_page->iconUrl());
- QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/icons/qt144.png")));
+ QCOMPARE(iconUrl,
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/qt144.png")));
icon = m_page->icon();
QVERIFY(!icon.isNull());
@@ -337,14 +372,19 @@ void tst_FaviconManager::bestFavicon()
void tst_FaviconManager::touchIcon()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
- QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-touch.html"));
+ QUrl url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-touch.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -357,14 +397,19 @@ void tst_FaviconManager::touchIcon()
void tst_FaviconManager::multiIcon()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
- QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-multi.html"));
+ QUrl url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-multi.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -373,7 +418,9 @@ void tst_FaviconManager::multiIcon()
QUrl iconUrl = iconUrlChangedSpy.at(0).at(0).toString();
QCOMPARE(m_page->iconUrl(), iconUrl);
- QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/icons/qtmulti.ico")));
+ QCOMPARE(iconUrl,
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/qtmulti.ico")));
const QIcon &icon = m_page->icon();
QVERIFY(!icon.isNull());
@@ -385,14 +432,19 @@ void tst_FaviconManager::multiIcon()
void tst_FaviconManager::candidateIcon()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
- QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-shortcut.html"));
+ QUrl url = QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/favicon-shortcut.html"));
m_page->load(url);
QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
@@ -401,7 +453,9 @@ void tst_FaviconManager::candidateIcon()
QUrl iconUrl = iconUrlChangedSpy.at(0).at(0).toString();
QCOMPARE(m_page->iconUrl(), iconUrl);
- QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/icons/qt144.png")));
+ QCOMPARE(iconUrl,
+ QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + QLatin1String("/resources/icons/qt144.png")));
const QIcon &icon = m_page->icon();
QVERIFY(!icon.isNull());
diff --git a/tests/auto/widgets/loadsignals/CMakeLists.txt b/tests/auto/widgets/loadsignals/CMakeLists.txt
new file mode 100644
index 000000000..f648cf6d3
--- /dev/null
+++ b/tests/auto/widgets/loadsignals/CMakeLists.txt
@@ -0,0 +1,60 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_loadsignals
+ SOURCES
+ tst_loadsignals.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
+
+get_target_property(sharedData Test::HttpServer SHARED_DATA)
+
+set_source_files_properties("${sharedData}/loadprogress/downloadable.tar.gz"
+ PROPERTIES QT_RESOURCE_ALIAS "downloadable.tar.gz"
+)
+set_source_files_properties("${sharedData}/loadprogress/page1.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page1.html"
+)
+set_source_files_properties("${sharedData}/loadprogress/page2.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page2.html"
+)
+set_source_files_properties("${sharedData}/loadprogress/page3.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page3.html"
+)
+set_source_files_properties("${sharedData}/loadprogress/page4.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page4.html"
+)
+set_source_files_properties("${sharedData}/loadprogress/page5.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page5.html"
+)
+set_source_files_properties("${sharedData}/loadprogress/page6.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page6.html"
+)
+set_source_files_properties("${sharedData}/loadprogress/page7.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page7.html"
+)
+set_source_files_properties("${sharedData}/loadprogress/page8.html"
+ PROPERTIES QT_RESOURCE_ALIAS "page8.html"
+)
+
+set(tst_loadsignals_resource_files
+ "${sharedData}/loadprogress/downloadable.tar.gz"
+ "${sharedData}/loadprogress/page1.html"
+ "${sharedData}/loadprogress/page2.html"
+ "${sharedData}/loadprogress/page3.html"
+ "${sharedData}/loadprogress/page4.html"
+ "${sharedData}/loadprogress/page5.html"
+ "${sharedData}/loadprogress/page6.html"
+ "${sharedData}/loadprogress/page7.html"
+ "${sharedData}/loadprogress/page8.html"
+)
+
+qt_add_resource(tst_loadsignals "tst_loadsignals"
+ PREFIX
+ "/resources"
+ FILES
+ ${tst_loadsignals_resource_files}
+)
diff --git a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
index fe01bede4..12a497dd9 100644
--- a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
+++ b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
@@ -29,7 +29,7 @@
#include <QtTest/QtTest>
#include "httpserver.h"
-#include "../util.h"
+#include <util.h>
#include "qdebug.h"
#include "qwebenginepage.h"
#include "qwebengineprofile.h"
@@ -276,7 +276,7 @@ void tst_LoadSignals::rejectNavigationRequest()
void tst_LoadSignals::monotonicity()
{
HttpServer server;
- server.setResourceDirs({ TESTS_SHARED_DATA_DIR });
+ server.setResourceDirs({ server.sharedDataDir() });
connect(&server, &HttpServer::newRequest, [] (HttpReqRep *) {
QTest::qWait(250); // just add delay to trigger some progress for every sub resource
});
@@ -376,7 +376,7 @@ void tst_LoadSignals::numberOfStartedAndFinishedSignalsIsSame()
QFETCH(QString, imageResourceUrl);
HttpServer server;
- server.setResourceDirs({ TESTS_SOURCE_DIR "/qwebengineprofile/resources" });
+ server.setResourceDirs({ server.sharedDataDir() });
QVERIFY(server.start());
QUrl serverImage = server.url("/hedgehog.png");
diff --git a/tests/auto/widgets/offscreen/CMakeLists.txt b/tests/auto/widgets/offscreen/CMakeLists.txt
new file mode 100644
index 000000000..1ba5a1e6a
--- /dev/null
+++ b/tests/auto/widgets/offscreen/CMakeLists.txt
@@ -0,0 +1,22 @@
+qt_internal_add_test(tst_offscreen
+ SOURCES
+ tst_offscreen.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+)
+
+set(tst_offscreen_resource_files
+ "test.html"
+)
+
+set_tests_properties(tst_offscreen PROPERTIES
+ ENVIRONMENT QT_QPA_PLATFORM=offscreen
+)
+
+qt_add_resource(tst_offscreen "tst_offscreen"
+ PREFIX
+ "/"
+ FILES
+ ${tst_offscreen_resource_files}
+)
+
diff --git a/tests/auto/widgets/origins/CMakeLists.txt b/tests/auto/widgets/origins/CMakeLists.txt
new file mode 100644
index 000000000..5ba017052
--- /dev/null
+++ b/tests/auto/widgets/origins/CMakeLists.txt
@@ -0,0 +1,45 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_origins
+ SOURCES
+ tst_origins.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
+
+set(tst_origins_resource_files
+ "resources/createObjectURL.html"
+ "resources/dedicatedWorker.html"
+ "resources/dedicatedWorker.js"
+ "resources/mixedSchemes.html"
+ "resources/mixedSchemesWithCsp.html"
+ "resources/mixedSchemes_frame.html"
+ "resources/mixedXHR.html"
+ "resources/mixedXHR.txt"
+ "resources/serviceWorker.html"
+ "resources/serviceWorker.js"
+ "resources/sharedWorker.html"
+ "resources/sharedWorker.js"
+ "resources/subdir/frame2.html"
+ "resources/subdir/index.html"
+ "resources/subdir_frame1.html"
+ "resources/viewSource.html"
+ "resources/websocket.html"
+)
+
+qt_add_resource(tst_origins "tst_origins"
+ PREFIX
+ "/"
+ FILES
+ ${tst_origins_resource_files}
+)
+
+qt_extend_target(tst_origins CONDITION QT_FEATURE_webengine_webchannel AND TARGET Qt::WebSockets
+ DEFINES
+ WEBSOCKETS
+ LIBRARIES
+ Qt::WebSockets
+)
diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp
index b9385516f..a834110b5 100644
--- a/tests/auto/widgets/origins/tst_origins.cpp
+++ b/tests/auto/widgets/origins/tst_origins.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include "../util.h"
+#include <util.h>
#include "httpserver.h"
#include <QtCore/qfile.h>
@@ -47,7 +47,6 @@
#define QSL QStringLiteral
#define QBAL QByteArrayLiteral
-#define THIS_DIR TESTS_SOURCE_DIR "origins/"
void registerSchemes()
{
@@ -185,7 +184,7 @@ private:
return;
}
- QString pathPrefix = QSL(THIS_DIR);
+ QString pathPrefix = QDir(QT_TESTCASE_SOURCEDIR).canonicalPath();
QString pathSuffix = url.path();
QFile *file = new QFile(pathPrefix + pathSuffix, job);
if (!file->open(QIODevice::ReadOnly)) {
@@ -460,7 +459,8 @@ void tst_Origins::subdirWithAccess()
{
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/subdir/index.html")));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/subdir/index.html"));
QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello")));
QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world")));
@@ -488,7 +488,8 @@ void tst_Origins::subdirWithoutAccess()
QTest::ignoreMessage(QtSystemMsg, QRegularExpression(QSL("Uncaught SecurityError")));
QTest::ignoreMessage(QtSystemMsg, QRegularExpression(QSL("Uncaught SecurityError")));
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/subdir/index.html")));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/subdir/index.html"));
QCOMPARE(eval(QSL("msg[0]")), QVariant());
QCOMPARE(eval(QSL("msg[1]")), QVariant());
@@ -513,14 +514,15 @@ void tst_Origins::fileAccessRemoteUrl()
QFETCH(bool, EnableAccess);
HttpServer server;
- server.setResourceDirs({ THIS_DIR "resources" });
+ server.setResourceDirs({ QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() + "/resources" });
QVERIFY(server.start());
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessRemoteUrls, EnableAccess);
if (!EnableAccess)
QTest::ignoreMessage(QtSystemMsg, QRegularExpression(QSL("blocked by CORS policy")));
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/mixedXHR.html")));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.html"));
eval("sendXHR('" + server.url("/mixedXHR.txt").toString() + "')");
QTRY_COMPARE(eval("result"), (EnableAccess ? QString("ok") : QString("error")));
@@ -536,8 +538,10 @@ void tst_Origins::fileAccessRemoteUrl()
// file: scheme.
void tst_Origins::mixedSchemes()
{
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/mixedSchemes.html")));
- eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')"));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedSchemes.html"));
+ eval("setIFrameUrl('file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedSchemes_frame.html')");
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess")));
QTest::ignoreMessage(QtSystemMsg, QRegularExpression(QSL("Uncaught SecurityError")));
eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')"));
@@ -548,7 +552,8 @@ void tst_Origins::mixedSchemes()
QVERIFY(verifyLoad(QSL("qrc:/resources/mixedSchemes.html")));
QTest::ignoreMessage(QtSystemMsg, QRegularExpression(QSL("Uncaught SecurityError")));
- eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')"));
+ eval("setIFrameUrl('file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedSchemes_frame.html')");
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess")));
@@ -558,7 +563,8 @@ void tst_Origins::mixedSchemes()
QVERIFY(verifyLoad(QSL("tst:/resources/mixedSchemes.html")));
QTest::ignoreMessage(QtSystemMsg, QRegularExpression(QSL("Not allowed to load local resource")));
- eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')"));
+ eval("setIFrameUrl('file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedSchemes_frame.html')");
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("cannotLoad")));
QTest::ignoreMessage(QtSystemMsg, QRegularExpression(QSL("Uncaught SecurityError")));
eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')"));
@@ -644,24 +650,32 @@ void tst_Origins::mixedXHR_data()
QTest::addColumn<QString>("url");
QTest::addColumn<QString>("command");
QTest::addColumn<QVariant>("result");
- QTest::newRow("file->file") << QString("file:" THIS_DIR "resources/mixedXHR.html")
- << QString("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")
+ QTest::newRow("file->file") << QString("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.html")
+ << QString("sendXHR('file:"
+ + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.txt')")
<< QVariant(QString("ok"));
- QTest::newRow("file->qrc") << QString("file:" THIS_DIR "resources/mixedXHR.html")
+ QTest::newRow("file->qrc") << QString("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.html")
<< QString("sendXHR('qrc:/resources/mixedXHR.txt')")
<< QVariant(QString("error"));
- QTest::newRow("file->tst") << QString("file:" THIS_DIR "resources/mixedXHR.html")
+ QTest::newRow("file->tst") << QString("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.html")
<< QString("sendXHR('tst:/resources/mixedXHR.txt')")
<< QVariant(QString("error"));
- QTest::newRow("file->data") << QString("file:" THIS_DIR "resources/mixedXHR.html")
- << QString("sendXHR('data:,ok')")
- << QVariant(QString("ok"));
- QTest::newRow("file->cors") << QString("file:" THIS_DIR "resources/mixedXHR.html")
+ QTest::newRow("file->data") << QString("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.html")
+ << QString("sendXHR('data:,ok')") << QVariant(QString("ok"));
+ QTest::newRow("file->cors") << QString("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.html")
<< QString("sendXHR('cors:/resources/mixedXHR.txt')")
<< QVariant(QString("ok"));
QTest::newRow("qrc->file") << QString("qrc:/resources/mixedXHR.html")
- << QString("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")
+ << QString("sendXHR('file:"
+ + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.txt')")
<< QVariant(QString("ok"));
QTest::newRow("qrc->qrc") << QString("qrc:/resources/mixedXHR.html")
<< QString("sendXHR('qrc:/resources/mixedXHR.txt')")
@@ -676,9 +690,10 @@ void tst_Origins::mixedXHR_data()
<< QString("sendXHR('cors:/resources/mixedXHR.txt')")
<< QVariant(QString("ok"));
-
QTest::newRow("tst->file") << QString("tst:/resources/mixedXHR.html")
- << QString("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")
+ << QString("sendXHR('file:"
+ + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/mixedXHR.txt')")
<< QVariant(QString("error"));
QTest::newRow("tst->qrc") << QString("tst:/resources/mixedXHR.html")
<< QString("sendXHR('qrc:/resources/mixedXHR.txt')")
@@ -760,7 +775,8 @@ void tst_Origins::webSocket()
m_page->setWebChannel(&channel);
QVERIFY(echoServer.listen());
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/websocket.html")));
+ QVERIFY(verifyLoad(
+ QSL("file:" QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() "/resources/websocket.html")));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
QVERIFY(verifyLoad(QSL("qrc:/resources/websocket.html")));
@@ -779,7 +795,8 @@ void tst_Origins::webSocket()
// one page, there is not much need for security restrictions.
void tst_Origins::dedicatedWorker()
{
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/dedicatedWorker.html")));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/dedicatedWorker.html"));
QTRY_VERIFY(eval(QSL("done")).toBool());
QCOMPARE(eval(QSL("result")), QVariant(42));
@@ -810,7 +827,8 @@ void tst_Origins::sharedWorker()
{
{
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false);
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/sharedWorker.html"));
QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000);
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("cannot be accessed from origin 'null'")));
@@ -818,7 +836,8 @@ void tst_Origins::sharedWorker()
{
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/sharedWorker.html"));
QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000);
QCOMPARE(eval(QSL("result")), QVariant(42));
}
@@ -842,7 +861,8 @@ void tst_Origins::sharedWorker()
// Service workers have to be explicitly enabled for a scheme.
void tst_Origins::serviceWorker()
{
- QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/serviceWorker.html")));
+ QVERIFY(verifyLoad("file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/serviceWorker.html"));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("The URL protocol of the current origin ('file://') is not supported.")));
@@ -885,11 +905,16 @@ void tst_Origins::serviceWorker()
// Support for view-source must be enabled explicitly.
void tst_Origins::viewSource()
{
- QVERIFY(verifyLoad(QSL("view-source:file:" THIS_DIR "resources/viewSource.html")));
+ QVERIFY(verifyLoad("view-source:file:" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/viewSource.html"));
#ifdef Q_OS_WIN
- QCOMPARE(m_page->requestedUrl().toString(), QSL("file:///" THIS_DIR "resources/viewSource.html"));
+ QCOMPARE(m_page->requestedUrl().toString(),
+ "file:///" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/viewSource.html");
#else
- QCOMPARE(m_page->requestedUrl().toString(), QSL("file://" THIS_DIR "resources/viewSource.html"));
+ QCOMPARE(m_page->requestedUrl().toString(),
+ "file://" + QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()
+ + "/resources/viewSource.html");
#endif
QVERIFY(verifyLoad(QSL("view-source:qrc:/resources/viewSource.html")));
diff --git a/tests/auto/widgets/printing/CMakeLists.txt b/tests/auto/widgets/printing/CMakeLists.txt
new file mode 100644
index 000000000..4c06a1b38
--- /dev/null
+++ b/tests/auto/widgets/printing/CMakeLists.txt
@@ -0,0 +1,34 @@
+include(../../util/util.cmake)
+
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+ pkg_check_modules(POPPLER_CPP poppler-cpp IMPORTED_TARGET)
+endif()
+
+qt_internal_add_test(tst_printing
+ SOURCES
+ tst_printing.cpp
+ PUBLIC_LIBRARIES
+ Qt::WebEngineWidgets
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineCorePrivate
+ Test::Util
+)
+
+qt_internal_extend_target(tst_printing
+ CONDITION POPPLER_CPP_FOUND
+ DEFINES
+ POPPLER_CPP
+ LIBRARIES
+ PkgConfig::POPPLER_CPP
+)
+
+set(tst_printing_resource_files
+ "resources/basic_printing_page.html"
+)
+
+qt_add_resource(tst_printing "tst_printing"
+ PREFIX "/"
+ FILES ${tst_printing_resource_files}
+)
diff --git a/tests/auto/widgets/printing/tst_printing.cpp b/tests/auto/widgets/printing/tst_printing.cpp
index 380fb65ff..d1542af23 100644
--- a/tests/auto/widgets/printing/tst_printing.cpp
+++ b/tests/auto/widgets/printing/tst_printing.cpp
@@ -33,7 +33,7 @@
#include <QSignalSpy>
#include <util.h>
-#if QT_CONFIG(webengine_poppler_cpp)
+#if defined(POPPLER_CPP)
#include <poppler-document.h>
#include <poppler-page.h>
#endif
@@ -44,7 +44,7 @@ class tst_Printing : public QObject
private slots:
void printToPdfBasic();
void printRequest();
-#if QT_CONFIG(webengine_poppler_cpp) && defined(Q_OS_LINUX) && defined(__GLIBCXX__)
+#if defined(POPPLER_CPP) && defined(Q_OS_LINUX) && defined(__GLIBCXX__)
void printToPdfPoppler();
#endif
};
@@ -108,7 +108,7 @@ void tst_Printing::printRequest()
QVERIFY(data.length() > 0);
}
-#if QT_CONFIG(webengine_poppler_cpp) && defined(Q_OS_LINUX) && defined(__GLIBCXX__)
+#if defined(POPPLER_CPP) && defined(Q_OS_LINUX) && defined(__GLIBCXX__)
void tst_Printing::printToPdfPoppler()
{
// check if generated pdf is correct by searching for a know string on the page
diff --git a/tests/auto/widgets/proxy/CMakeLists.txt b/tests/auto/widgets/proxy/CMakeLists.txt
new file mode 100644
index 000000000..0929c050c
--- /dev/null
+++ b/tests/auto/widgets/proxy/CMakeLists.txt
@@ -0,0 +1,9 @@
+include(../../httpserver/httpserver.cmake)
+
+qt_internal_add_test(tst_proxy
+ SOURCES
+ tst_proxy.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+)
diff --git a/tests/auto/widgets/proxypac/CMakeLists.txt b/tests/auto/widgets/proxypac/CMakeLists.txt
new file mode 100644
index 000000000..25d754cf7
--- /dev/null
+++ b/tests/auto/widgets/proxypac/CMakeLists.txt
@@ -0,0 +1,46 @@
+include(../../httpserver/httpserver.cmake)
+
+qt_internal_add_test(tst_proxypac_file
+ SOURCES
+ tst_proxypac.cpp
+ LIBRARIES
+ Qt::WebEngineCore
+ Test::HttpServer
+)
+
+if(WIN32)
+ set(fileEnvArg "--proxy-pac-url=\"file:///${CMAKE_CURRENT_LIST_DIR}/proxy.pac\"")
+elseif(boot2qt)
+ set(fileEnvArg "--single-process --no-sandbox --proxy-pac-url=\"file://${CMAKE_CURRENT_LIST_DIR}/proxy.pac\"")
+else()
+ set(fileEnvArg "--proxy-pac-url=\"file://${CMAKE_CURRENT_LIST_DIR}/proxy.pac\"")
+endif()
+
+set_tests_properties(tst_proxypac_file PROPERTIES
+ ENVIRONMENT QTWEBENGINE_CHROMIUM_FLAGS=${fileEnvArg}
+)
+
+qt_internal_add_test(tst_proxypac_qrc
+ SOURCES
+ tst_proxypac.cpp
+ LIBRARIES
+ Qt::WebEngineCore
+ Test::HttpServer
+)
+
+if(boot2qt)
+ set(qrcEnvArg "--single-process --no-sandbox --proxy-pac-url=\"qrc:///proxy.pac\"")
+else()
+ set(qrcEnvArg "--proxy-pac-url=\"qrc:///proxy.pac\"")
+endif()
+
+set_tests_properties(tst_proxypac_qrc PROPERTIES
+ ENVIRONMENT QTWEBENGINE_CHROMIUM_FLAGS=${qrcEnvArg}
+)
+
+qt_add_resource(tst_proxypac_qrc "proxypac"
+ PREFIX
+ "/"
+ FILES
+ "proxy.pac"
+)
diff --git a/tests/auto/widgets/proxypac/tst_proxypac.cpp b/tests/auto/widgets/proxypac/tst_proxypac.cpp
index 26f9b8aa3..223c995e0 100644
--- a/tests/auto/widgets/proxypac/tst_proxypac.cpp
+++ b/tests/auto/widgets/proxypac/tst_proxypac.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include "proxyserver.h"
+#include "proxy_server.h"
#include <QTest>
#include <QSignalSpy>
#include <QWebEngineProfile>
@@ -47,17 +47,17 @@ void tst_ProxyPac::proxypac()
{
const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_CHROMIUM_FLAGS");
if (!fromEnv.contains("--proxy-pac-url"))
- qFatal("--proxy-pac-url argument is not passed.");
+ qFatal("--proxy-pac-url argument is not passed. Use ctest or set QTWEBENGINE_CHROMIUM_FLAGS");
ProxyServer proxyServer1;
+ QSignalSpy proxySpy1(&proxyServer1, &ProxyServer::requestReceived);
proxyServer1.setPort(5551);
proxyServer1.run();
- QSignalSpy proxySpy1(&proxyServer1, &ProxyServer::requestReceived);
ProxyServer proxyServer2;
+ QSignalSpy proxySpy2(&proxyServer2, &ProxyServer::requestReceived);
proxyServer2.setPort(5552);
proxyServer2.run();
- QSignalSpy proxySpy2(&proxyServer2, &ProxyServer::requestReceived);
QTRY_VERIFY2(proxyServer1.isListening(), "Could not setup proxy server 1");
QTRY_VERIFY2(proxyServer2.isListening(), "Could not setup proxy server 2");
diff --git a/tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt b/tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt
new file mode 100644
index 000000000..3a8244c0f
--- /dev/null
+++ b/tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt
@@ -0,0 +1,11 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebenginedownloadrequest
+ SOURCES
+ tst_qwebenginedownloadrequest.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
diff --git a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp
index a69ceaed0..f95c4ab33 100644
--- a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp
+++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include "../util.h"
+#include <util.h>
#include <QCoreApplication>
#include <QSignalSpy>
diff --git a/tests/auto/widgets/qwebenginehistory/CMakeLists.txt b/tests/auto/widgets/qwebenginehistory/CMakeLists.txt
new file mode 100644
index 000000000..b91281a45
--- /dev/null
+++ b/tests/auto/widgets/qwebenginehistory/CMakeLists.txt
@@ -0,0 +1,26 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebenginehistory
+ SOURCES
+ tst_qwebenginehistory.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::Util
+)
+
+set(tst_qwebenginehistory_resource_files
+ "resources/page1.html"
+ "resources/page2.html"
+ "resources/page3.html"
+ "resources/page4.html"
+ "resources/page5.html"
+ "resources/page6.html"
+)
+
+qt_internal_add_resource(tst_qwebenginehistory "tst_qwebenginehistory"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qwebenginehistory_resource_files}
+)
+
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
index 72a45379b..f67c2e03d 100644
--- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
+++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
@@ -20,7 +20,7 @@
#include <QtTest/QtTest>
#include <QAction>
-#include "../util.h"
+#include <util.h>
#include "qwebenginepage.h"
#include "qwebengineview.h"
#include "qwebenginehistory.h"
diff --git a/tests/auto/widgets/qwebenginepage/CMakeLists.txt b/tests/auto/widgets/qwebenginepage/CMakeLists.txt
new file mode 100644
index 000000000..bb31d9a97
--- /dev/null
+++ b/tests/auto/widgets/qwebenginepage/CMakeLists.txt
@@ -0,0 +1,61 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebenginepage
+ SOURCES
+ tst_qwebenginepage.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
+
+get_target_property(sharedData Test::HttpServer SHARED_DATA)
+
+set(tst_qwebenginepage_resource_files
+ "resources/redirect.html"
+ "resources/bar.txt"
+ "resources/content.html"
+ "resources/dynamicFrame.html"
+ "resources/foo.txt"
+ "resources/frame_a.html"
+ "resources/frame_c.html"
+ "resources/framedindex.html"
+ "resources/fullscreen.html"
+ "resources/iframe.html"
+ "resources/iframe2.html"
+ "resources/iframe3.html"
+ "resources/image.png"
+ "resources/index.html"
+ "resources/lifecycle.html"
+ "resources/pasteimage.html"
+ "resources/path with spaces.txt"
+ "resources/reload.html"
+ "resources/script.html"
+ "resources/style.css"
+ "resources/test1.html"
+ "resources/test2.html"
+ "resources/testiframe.html"
+ "resources/testiframe2.html"
+ "resources/user.css"
+)
+
+qt_internal_add_resource(tst_qwebenginepage "tst_qwebenginepage"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qwebenginepage_resource_files}
+)
+set_source_files_properties("${sharedData}/notification.html"
+ PROPERTIES QT_RESOURCE_ALIAS "notification.html"
+)
+set(tst_qwebenginepage1_resource_files
+ "${sharedData}/notification.html"
+)
+
+qt_internal_add_resource(tst_qwebenginepage "tst_qwebenginepage1"
+ PREFIX
+ "/shared"
+ FILES
+ ${tst_qwebenginepage1_resource_files}
+)
diff --git a/tests/auto/widgets/resources/image2.png b/tests/auto/widgets/qwebenginepage/resources/image2.png
index 8d703640c..8d703640c 100644
--- a/tests/auto/widgets/resources/image2.png
+++ b/tests/auto/widgets/qwebenginepage/resources/image2.png
Binary files differ
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index a8d0e1ac8..fecda7c47 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -19,7 +19,7 @@
Boston, MA 02110-1301, USA.
*/
-#include "../util.h"
+#include <util.h>
#include <QtWebEngineCore/qtwebenginecore-config.h>
#include <QByteArray>
#include <QClipboard>
@@ -2245,10 +2245,15 @@ void tst_QWebEnginePage::setHtmlWithBaseURL()
// This tests if baseUrl is indeed affecting the relative paths from resources.
// As we are using a local file as baseUrl, its security origin should be able to load local resources.
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
- QDir::setCurrent(TESTS_SOURCE_DIR);
+ QDir::setCurrent(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath());
+ qDebug()<<QDir::current();
QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>");
@@ -2257,7 +2262,9 @@ void tst_QWebEnginePage::setHtmlWithBaseURL()
// in few seconds, the image should be completey loaded
QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
- page.setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
+ page.setHtml(html,
+ QUrl::fromLocalFile(
+ QString("%1/foo.html").arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())));
QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished);
QVERIFY(spyFinished.wait());
QCOMPARE(spy.count(), 1);
@@ -3187,7 +3194,8 @@ void tst_QWebEnginePage::viewSourceURL_data()
QTest::newRow("view-source:") << QUrl("view-source:") << true << QUrl("view-source:") << QUrl("about:blank") << QString("view-source:");
QTest::newRow("view-source:about:blank") << QUrl("view-source:about:blank") << true << QUrl("view-source:about:blank") << QUrl("about:blank") << QString("view-source:about:blank");
- QString localFilePath = QString("%1qwebenginepage/resources/test1.html").arg(TESTS_SOURCE_DIR);
+ QString localFilePath =
+ QString("%1/resources/test1.html").arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath());
QUrl testLocalUrl = QUrl(QString("view-source:%1").arg(QUrl::fromLocalFile(localFilePath).toString()));
QUrl testLocalUrlWithoutScheme = QUrl(QString("view-source:%1").arg(localFilePath));
QTest::newRow(testLocalUrl.toString().toStdString().c_str()) << testLocalUrl << true << testLocalUrl << QUrl::fromLocalFile(localFilePath) << QString("test1.html");
@@ -3203,8 +3211,12 @@ void tst_QWebEnginePage::viewSourceURL_data()
void tst_QWebEnginePage::viewSourceURL()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
QFETCH(QUrl, userInputUrl);
QFETCH(bool, loadSucceed);
diff --git a/tests/auto/widgets/qwebengineprofile/CMakeLists.txt b/tests/auto/widgets/qwebengineprofile/CMakeLists.txt
new file mode 100644
index 000000000..744f44405
--- /dev/null
+++ b/tests/auto/widgets/qwebengineprofile/CMakeLists.txt
@@ -0,0 +1,11 @@
+include(../../httpserver/httpserver.cmake)
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebengineprofile
+ SOURCES
+ tst_qwebengineprofile.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::HttpServer
+ Test::Util
+)
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index eb692f351..64c763693 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include "../util.h"
+#include <util.h>
#include <QtCore/qbuffer.h>
#include <QtCore/qmimedatabase.h>
#include <QtTest/QtTest>
@@ -198,7 +198,7 @@ public:
private:
void onNewRequest(HttpReqRep *rr)
{
- const QDir resourceDir(TESTS_SOURCE_DIR "qwebengineprofile/resources");
+ const QDir resourceDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() + "/resources");
QString path = rr->requestPath();
path.remove(0, 1);
diff --git a/tests/auto/widgets/qwebenginescript/CMakeLists.txt b/tests/auto/widgets/qwebenginescript/CMakeLists.txt
new file mode 100644
index 000000000..2e93894d9
--- /dev/null
+++ b/tests/auto/widgets/qwebenginescript/CMakeLists.txt
@@ -0,0 +1,26 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebenginescript
+ SOURCES
+ tst_qwebenginescript.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::Util
+)
+
+set(tst_qwebenginescript_resource_files
+ "resources/test_iframe_inner.html"
+ "resources/test_iframe_main.html"
+ "resources/test_iframe_outer.html"
+ "resources/test_window_open.html"
+ "resources/title_a.html"
+ "resources/title_b.html"
+ "resources/webChannelWithBadString.html"
+)
+
+qt_add_resource(tst_qwebenginescript "tst_qwebenginescript"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qwebenginescript_resource_files}
+)
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
index c141c0754..ca2f0cab9 100644
--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
@@ -25,7 +25,7 @@
#include <qwebenginescriptcollection.h>
#include <qwebenginesettings.h>
#include <qwebengineview.h>
-#include "../util.h"
+#include <util.h>
#if QT_CONFIG(webengine_webchannel)
#include <QWebChannel>
#endif
diff --git a/tests/auto/widgets/qwebenginesettings/CMakeLists.txt b/tests/auto/widgets/qwebenginesettings/CMakeLists.txt
new file mode 100644
index 000000000..f5ec3441e
--- /dev/null
+++ b/tests/auto/widgets/qwebenginesettings/CMakeLists.txt
@@ -0,0 +1,9 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebenginesettings
+ SOURCES
+ tst_qwebenginesettings.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::Util
+)
diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
index a7c3ccb3c..77e46b0bf 100644
--- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
+++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
@@ -17,7 +17,7 @@
Boston, MA 02110-1301, USA.
*/
-#include "../util.h"
+#include <util.h>
#include <QtTest/QtTest>
diff --git a/tests/auto/widgets/qwebengineview/CMakeLists.txt b/tests/auto/widgets/qwebengineview/CMakeLists.txt
new file mode 100644
index 000000000..0f4fe9327
--- /dev/null
+++ b/tests/auto/widgets/qwebengineview/CMakeLists.txt
@@ -0,0 +1,29 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_qwebengineview
+ SOURCES
+ tst_qwebengineview.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Qt::WebEngineCorePrivate
+ Qt::GuiPrivate
+ Qt::QuickWidgets
+ Test::Util
+)
+
+set(tst_qwebengineview_resource_files
+ "resources/dummy.html"
+ "resources/frame_a.html"
+ "resources/image2.png"
+ "resources/index.html"
+ "resources/input_types.html"
+ "resources/keyboardEvents.html"
+ "resources/scrolltest_page.html"
+)
+
+qt_add_resource(tst_qwebengineview "tst_qwebengineview"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qwebengineview_resource_files}
+)
diff --git a/tests/auto/widgets/resources/test.swf b/tests/auto/widgets/qwebengineview/resources/test.swf
index 895298271..895298271 100644
--- a/tests/auto/widgets/resources/test.swf
+++ b/tests/auto/widgets/qwebengineview/resources/test.swf
Binary files differ
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 284f84d9f..2673c0d33 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -18,10 +18,9 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
-
+#include <QtWebEngineCore/private/qtwebenginecore-config_p.h>
#include <qtest.h>
-#include "../util.h"
-
+#include <util.h>
#include <private/qinputmethod_p.h>
#include <qpainter.h>
#include <qpagelayout.h>
@@ -363,17 +362,21 @@ void tst_QWebEngineView::reusePage_data()
void tst_QWebEngineView::reusePage()
{
- if (!QDir(TESTS_SOURCE_DIR).exists())
- W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+ if (!QDir(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'")
+ .arg(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath())
+ .toLatin1()
+ .constData(),
+ SkipAll);
- QDir::setCurrent(TESTS_SOURCE_DIR);
+ QDir::setCurrent(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath());
QFETCH(QString, html);
QWebEngineView* view1 = new QWebEngineView;
QPointer<QWebEnginePage> page = new QWebEnginePage;
view1->setPage(page.data());
page.data()->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
- page->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR));
+ page->setHtml(html, QUrl::fromLocalFile(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath()));
if (html.contains("</embed>")) {
// some reasonable time for the PluginStream to feed test.swf to flash and start painting
QSignalSpy spyFinished(view1, &QWebEngineView::loadFinished);
@@ -3193,8 +3196,10 @@ void tst_QWebEngineView::webUIURLs_data()
QTest::newRow("usb-internals") << QUrl("chrome://usb-internals") << false;
QTest::newRow("user-actions") << QUrl("chrome://user-actions") << true;
QTest::newRow("version") << QUrl("chrome://version") << false;
+#if QT_CONFIG(webengine_webrtc)
QTest::newRow("webrtc-internals") << QUrl("chrome://webrtc-internals") << true;
QTest::newRow("webrtc-logs") << QUrl("chrome://webrtc-logs") << true;
+#endif
}
void tst_QWebEngineView::webUIURLs()
diff --git a/tests/auto/widgets/schemes/CMakeLists.txt b/tests/auto/widgets/schemes/CMakeLists.txt
new file mode 100644
index 000000000..446ae5751
--- /dev/null
+++ b/tests/auto/widgets/schemes/CMakeLists.txt
@@ -0,0 +1,7 @@
+qt_internal_add_test(tst_schemes
+ SOURCES
+ tst_schemes.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+)
+
diff --git a/tests/auto/widgets/shutdown/CMakeLists.txt b/tests/auto/widgets/shutdown/CMakeLists.txt
new file mode 100644
index 000000000..12ca27c3d
--- /dev/null
+++ b/tests/auto/widgets/shutdown/CMakeLists.txt
@@ -0,0 +1,6 @@
+qt_internal_add_test(tst_shutdown
+ SOURCES
+ tst_shutdown.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+)
diff --git a/tests/auto/widgets/touchinput/CMakeLists.txt b/tests/auto/widgets/touchinput/CMakeLists.txt
new file mode 100644
index 000000000..82e3fca4a
--- /dev/null
+++ b/tests/auto/widgets/touchinput/CMakeLists.txt
@@ -0,0 +1,10 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_touchinput
+ SOURCES
+ tst_touchinput.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Qt::GuiPrivate
+ Test::Util
+)
diff --git a/tests/auto/widgets/touchinput/tst_touchinput.cpp b/tests/auto/widgets/touchinput/tst_touchinput.cpp
index 359b11eb2..d60fd1d7b 100644
--- a/tests/auto/widgets/touchinput/tst_touchinput.cpp
+++ b/tests/auto/widgets/touchinput/tst_touchinput.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include "../util.h"
+#include <util.h>
#include <QtGui/qpa/qwindowsysteminterface.h>
#include <QSignalSpy>