diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-04-27 10:03:12 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-04-27 10:03:43 +0200 |
commit | 10e66c6dd0b8a8dd17252d6408c13b689fac6995 (patch) | |
tree | fbdddb33a818b5495b24f3949f7406b0b916e78c /tests/auto | |
parent | d0852f90a24673ccc9ef0b93e224ba37b674644d (diff) | |
parent | 75412200db05ddc5ee2b9aea367b580d8b0c438e (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
configure.pri
src/pdf/api/qpdfpagerenderer.h
Change-Id: I7e68277080e29238bbfe8511539ea75b2db89489
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp | 123 | ||||
-rw-r--r-- | tests/auto/pdf/qpdfpagerenderer/tst_qpdfpagerenderer.cpp | 8 | ||||
-rw-r--r-- | tests/auto/quick/dialogs/BLACKLIST | 8 | ||||
-rw-r--r-- | tests/auto/quick/publicapi/tst_publicapi.cpp | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/qmltests.pro | 60 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/tst_qmltests.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/accepttypes.html (renamed from tests/auto/quick/qmltests/data/accepttypes.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/alert.html (renamed from tests/auto/quick/qmltests/data/alert.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/confirm.html (renamed from tests/auto/quick/qmltests/data/confirm.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/confirmclose.html (renamed from tests/auto/quick/qmltests/data/confirmclose.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/directoryupload.html (renamed from tests/auto/quick/qmltests/data/directoryupload.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-candidates-gray.html (renamed from tests/auto/quick/qmltests/data/favicon-candidates-gray.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-misc.html (renamed from tests/auto/quick/qmltests/data/favicon-misc.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-multi-gray.html (renamed from tests/auto/quick/qmltests/data/favicon-multi-gray.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-multi.html (renamed from tests/auto/quick/qmltests/data/favicon-multi.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-shortcut.html (renamed from tests/auto/quick/qmltests/data/favicon-shortcut.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-single.html (renamed from tests/auto/quick/qmltests/data/favicon-single.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-touch.html (renamed from tests/auto/quick/qmltests/data/favicon-touch.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon-unavailable.html (renamed from tests/auto/quick/qmltests/data/favicon-unavailable.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon.html | 10 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/favicon2.html (renamed from tests/auto/quick/qmltests/data/favicon2.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/favicon.png | bin | 0 -> 3961 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/gray128.png (renamed from tests/auto/quick/qmltests/data/icons/gray128.png) | bin | 146 -> 146 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/gray16.png (renamed from tests/auto/quick/qmltests/data/icons/gray16.png) | bin | 72 -> 72 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/gray255.png (renamed from tests/auto/quick/qmltests/data/icons/gray255.png) | bin | 335 -> 335 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/gray32.png (renamed from tests/auto/quick/qmltests/data/icons/gray32.png) | bin | 79 -> 79 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/gray64.png (renamed from tests/auto/quick/qmltests/data/icons/gray64.png) | bin | 99 -> 99 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/grayicons.ico (renamed from tests/auto/quick/qmltests/data/icons/grayicons.ico) | bin | 22150 -> 22150 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/qt144.png (renamed from tests/auto/quick/qmltests/data/icons/qt144.png) | bin | 8315 -> 8315 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/qt32.ico (renamed from tests/auto/quick/qmltests/data/icons/qt32.ico) | bin | 4286 -> 4286 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/qtmulti.ico (renamed from tests/auto/quick/qmltests/data/icons/qtmulti.ico) | bin | 22382 -> 22382 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/icons/small-favicon.png (renamed from tests/auto/quick/qmltests/data/icons/small-favicon.png) | bin | 878 -> 878 bytes | |||
-rw-r--r-- | tests/auto/quick/qmltests2/data/multifileupload.html (renamed from tests/auto/quick/qmltests/data/multifileupload.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/prompt.html (renamed from tests/auto/quick/qmltests/data/prompt.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/singlefileupload.html (renamed from tests/auto/quick/qmltests/data/singlefileupload.html) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/test1.html | 6 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/test2.html | 6 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/titleupdate.js (renamed from tests/auto/quick/qmltests/data/titleupdate.js) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_favicon.qml (renamed from tests/auto/quick/qmltests/data/tst_favicon.qml) | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_faviconDownload.qml (renamed from tests/auto/quick/qmltests/data/tst_faviconDownload.qml) | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_filePicker.qml (renamed from tests/auto/quick/qmltests/data/tst_filePicker.qml) | 3 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_inputMethod.qml (renamed from tests/auto/quick/qmltests/data/tst_inputMethod.qml) | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml (renamed from tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml) | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_linkHovered.qml (renamed from tests/auto/quick/qmltests/data/tst_linkHovered.qml) | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_loadFail.qml (renamed from tests/auto/quick/qmltests/data/tst_loadFail.qml) | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/data/tst_mouseClick.qml (renamed from tests/auto/quick/qmltests/data/tst_mouseClick.qml) | 2 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/qmldir (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/TestParams/FilePickerParams.qml (renamed from tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/TestParams/JSDialogParams.qml (renamed from tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml) | 0 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/mock-delegates/TestParams/qmldir (renamed from tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir) | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/qmltests2.pro | 78 | ||||
-rw-r--r-- | tests/auto/quick/qmltests2/tst_qmltests2.cpp | 127 | ||||
-rw-r--r-- | tests/auto/quick/qquickwebengineprofile/qquickwebengineprofile.pro | 1 | ||||
-rw-r--r-- | tests/auto/quick/qquickwebengineprofile/tst_qquickwebengineprofile.cpp | 73 | ||||
-rw-r--r-- | tests/auto/quick/qquickwebengineview/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/quick/quick.pro | 5 | ||||
-rw-r--r-- | tests/auto/widgets/accessibility/tst_accessibility.cpp | 21 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac.pri | 5 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac.pro | 15 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac.qrc | 7 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro | 9 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro | 7 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 45 | ||||
-rw-r--r-- | tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp | 6 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp | 2 | ||||
-rw-r--r-- | tests/auto/widgets/util.h | 9 |
72 files changed, 513 insertions, 136 deletions
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 5effb2abf..b8ecce635 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -37,6 +37,8 @@ #include <httpserver.h> #include <httpreqrep.h> +typedef void (QWebEngineProfile::*InterceptorSetter)(QWebEngineUrlRequestInterceptor *interceptor); +Q_DECLARE_METATYPE(InterceptorSetter) class tst_QWebEngineUrlRequestInterceptor : public QObject { Q_OBJECT @@ -52,19 +54,25 @@ public Q_SLOTS: private Q_SLOTS: void initTestCase(); void cleanupTestCase(); + void interceptRequest_data(); void interceptRequest(); + void ipv6HostEncoding_data(); void ipv6HostEncoding(); void requestedUrl_data(); void requestedUrl(); void setUrlSameUrl_data(); void setUrlSameUrl(); + void firstPartyUrl_data(); void firstPartyUrl(); void firstPartyUrlNestedIframes_data(); void firstPartyUrlNestedIframes(); void requestInterceptorByResourceType_data(); void requestInterceptorByResourceType(); + void firstPartyUrlHttp_data(); void firstPartyUrlHttp(); + void passRefererHeader_data(); void passRefererHeader(); + void initiator_data(); void initiator(); }; @@ -118,7 +126,7 @@ public: void interceptRequest(QWebEngineUrlRequestInfo &info) override { - QVERIFY(QThread::currentThread() == QCoreApplication::instance()->thread()); + QCOMPARE(QThread::currentThread() == QCoreApplication::instance()->thread(), !property("deprecated").toBool()); // Since 63 we also intercept some unrelated blob requests.. if (info.requestUrl().scheme() == QLatin1String("blob")) return; @@ -178,13 +186,20 @@ public: } }; +void tst_QWebEngineUrlRequestInterceptor::interceptRequest_data() +{ + QTest::addColumn<InterceptorSetter>("setter"); + QTest::newRow("ui") << &QWebEngineProfile::setUrlRequestInterceptor; + QTest::newRow("io") << &QWebEngineProfile::setRequestInterceptor; +} + void tst_QWebEngineUrlRequestInterceptor::interceptRequest() { + QFETCH(InterceptorSetter, setter); QWebEngineProfile profile; profile.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); TestRequestInterceptor interceptor(/* intercept */ true); - profile.setUrlRequestInterceptor(&interceptor); - + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); @@ -213,7 +228,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest() // Make sure that registering an observer does not modify the request. TestRequestInterceptor observer(/* intercept */ false); - profile.setUrlRequestInterceptor(&observer); + (profile.*setter)(&observer); page.load(QUrl("qrc:///resources/__placeholder__")); QTRY_COMPARE(loadSpy.count(), 1); success = loadSpy.takeFirst().takeFirst(); @@ -242,11 +257,17 @@ public: QList<QUrl> requestedUrls; }; +void tst_QWebEngineUrlRequestInterceptor::ipv6HostEncoding_data() +{ + interceptRequest_data(); +} + void tst_QWebEngineUrlRequestInterceptor::ipv6HostEncoding() { + QFETCH(InterceptorSetter, setter); QWebEngineProfile profile; LocalhostContentProvider contentProvider; - profile.setUrlRequestInterceptor(&contentProvider); + (profile.*setter)(&contentProvider); QWebEnginePage page(&profile); QSignalSpy spyLoadFinished(&page, SIGNAL(loadFinished(bool))); @@ -266,21 +287,23 @@ void tst_QWebEngineUrlRequestInterceptor::ipv6HostEncoding() void tst_QWebEngineUrlRequestInterceptor::requestedUrl_data() { + QTest::addColumn<InterceptorSetter>("setter"); QTest::addColumn<bool>("interceptInPage"); - - QTest::newRow("Profile intercept") << false; - QTest::newRow("Page intercept") << true; + QTest::newRow("ui profile intercept") << &QWebEngineProfile::setUrlRequestInterceptor << false; + QTest::newRow("ui page intercept") << &QWebEngineProfile::setUrlRequestInterceptor << true; + QTest::newRow("io profile intercept") << &QWebEngineProfile::setRequestInterceptor << false; } void tst_QWebEngineUrlRequestInterceptor::requestedUrl() { + QFETCH(InterceptorSetter, setter); QFETCH(bool, interceptInPage); QWebEngineProfile profile; profile.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); TestRequestInterceptor interceptor(/* intercept */ true); if (!interceptInPage) - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); if (interceptInPage) @@ -317,12 +340,13 @@ void tst_QWebEngineUrlRequestInterceptor::setUrlSameUrl_data() void tst_QWebEngineUrlRequestInterceptor::setUrlSameUrl() { + QFETCH(InterceptorSetter, setter); QFETCH(bool, interceptInPage); QWebEngineProfile profile; TestRequestInterceptor interceptor(/* intercept */ true); if (!interceptInPage) - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); if (interceptInPage) @@ -351,11 +375,17 @@ void tst_QWebEngineUrlRequestInterceptor::setUrlSameUrl() QCOMPARE(spy.count(), 4); } +void tst_QWebEngineUrlRequestInterceptor::firstPartyUrl_data() +{ + interceptRequest_data(); +} + void tst_QWebEngineUrlRequestInterceptor::firstPartyUrl() { + QFETCH(InterceptorSetter, setter); QWebEngineProfile profile; TestRequestInterceptor interceptor(/* intercept */ false); - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); @@ -373,14 +403,19 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrl() void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes_data() { QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebengineurlrequestinterceptor/resources/iframe.html")); - + QTest::addColumn<InterceptorSetter>("setter"); QTest::addColumn<QUrl>("requestUrl"); - QTest::newRow("file") << url; - QTest::newRow("qrc") << QUrl("qrc:///resources/iframe.html"); + QTest::newRow("ui file") << &QWebEngineProfile::setUrlRequestInterceptor << url; + QTest::newRow("io file") << &QWebEngineProfile::setRequestInterceptor << url; + QTest::newRow("ui qrc") << &QWebEngineProfile::setUrlRequestInterceptor + << QUrl("qrc:///resources/iframe.html"); + QTest::newRow("io qrc") << &QWebEngineProfile::setRequestInterceptor + << QUrl("qrc:///resources/iframe.html"); } void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes() { + QFETCH(InterceptorSetter, setter); QFETCH(QUrl, requestUrl); if (requestUrl.scheme() == "file" && !QDir(TESTS_SOURCE_DIR).exists()) @@ -390,7 +425,7 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes() QWebEngineProfile profile; TestRequestInterceptor interceptor(/* intercept */ false); - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); @@ -430,31 +465,47 @@ void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType_data( 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")); + QTest::addColumn<InterceptorSetter>("setter"); QTest::addColumn<QUrl>("requestUrl"); QTest::addColumn<QUrl>("firstPartyUrl"); QTest::addColumn<int>("resourceType"); - QTest::newRow("StyleSheet") << styleRequestUrl << firstPartyUrl << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeStylesheet); - QTest::newRow("Script") << scriptRequestUrl << firstPartyUrl << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeScript); - QTest::newRow("Image") << imageRequestUrl << imageFirstPartyUrl << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeImage); - QTest::newRow("FontResource") << fontRequestUrl << firstPartyUrl << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeFontResource); - QTest::newRow("Media") << mediaRequestUrl << mediaFirstPartyUrl << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeMedia); - QTest::newRow("Favicon") << faviconRequestUrl << faviconFirstPartyUrl << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeFavicon); - QTest::newRow("Xhr") << xhrRequestUrl << firstPartyUrl << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeXhr); + QStringList name = { "ui", "io" }; + QVector<InterceptorSetter> setters = { &QWebEngineProfile::setUrlRequestInterceptor, + &QWebEngineProfile::setRequestInterceptor }; + for (int i = 0; i < 2; i++) { + QTest::newRow(qPrintable(name[i] + "StyleSheet")) + << setters[i] << styleRequestUrl << firstPartyUrl + << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeStylesheet); + QTest::newRow(qPrintable(name[i] + "Script")) << setters[i] << scriptRequestUrl << firstPartyUrl + << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeScript); + QTest::newRow(qPrintable(name[i] + "Image")) << setters[i] << imageRequestUrl << imageFirstPartyUrl + << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeImage); + QTest::newRow(qPrintable(name[i] + "FontResource")) + << setters[i] << fontRequestUrl << firstPartyUrl + << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeFontResource); + QTest::newRow(qPrintable(name[i] + "Media")) << setters[i] << mediaRequestUrl << mediaFirstPartyUrl + << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeMedia); + QTest::newRow(qPrintable(name[i] + "Favicon")) + << setters[i] << faviconRequestUrl << faviconFirstPartyUrl + << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeFavicon); + QTest::newRow(qPrintable(name[i] + "Xhr")) << setters[i] << xhrRequestUrl << firstPartyUrl + << static_cast<int>(QWebEngineUrlRequestInfo::ResourceTypeXhr); + } } 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); - + QFETCH(InterceptorSetter, setter); QFETCH(QUrl, requestUrl); QFETCH(QUrl, firstPartyUrl); QFETCH(int, resourceType); QWebEngineProfile profile; TestRequestInterceptor interceptor(/* intercept */ false); - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); @@ -469,11 +520,17 @@ void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType() QCOMPARE(infos.at(0).resourceType, resourceType); } +void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlHttp_data() +{ + interceptRequest_data(); +} + void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlHttp() { + QFETCH(InterceptorSetter, setter); QWebEngineProfile profile; TestRequestInterceptor interceptor(/* intercept */ false); - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); @@ -533,8 +590,14 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlHttp() QCOMPARE(info.firstPartyUrl, firstPartyUrl); } +void tst_QWebEngineUrlRequestInterceptor::passRefererHeader_data() +{ + interceptRequest_data(); +} + void tst_QWebEngineUrlRequestInterceptor::passRefererHeader() { + QFETCH(InterceptorSetter, setter); // Create HTTP Server to parse the request. HttpServer httpServer; @@ -552,7 +615,7 @@ void tst_QWebEngineUrlRequestInterceptor::passRefererHeader() QWebEngineProfile profile; TestRequestInterceptor interceptor(true); - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); @@ -566,11 +629,17 @@ void tst_QWebEngineUrlRequestInterceptor::passRefererHeader() QVERIFY(succeeded); } +void tst_QWebEngineUrlRequestInterceptor::initiator_data() +{ + interceptRequest_data(); +} + void tst_QWebEngineUrlRequestInterceptor::initiator() { + QFETCH(InterceptorSetter, setter); QWebEngineProfile profile; TestRequestInterceptor interceptor(/* intercept */ false); - profile.setUrlRequestInterceptor(&interceptor); + (profile.*setter)(&interceptor); QWebEnginePage page(&profile); QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); diff --git a/tests/auto/pdf/qpdfpagerenderer/tst_qpdfpagerenderer.cpp b/tests/auto/pdf/qpdfpagerenderer/tst_qpdfpagerenderer.cpp index 8eaef7c6e..534fbd9ce 100644 --- a/tests/auto/pdf/qpdfpagerenderer/tst_qpdfpagerenderer.cpp +++ b/tests/auto/pdf/qpdfpagerenderer/tst_qpdfpagerenderer.cpp @@ -57,7 +57,7 @@ void tst_QPdfPageRenderer::defaultValues() QPdfPageRenderer pageRenderer; QCOMPARE(pageRenderer.document(), nullptr); - QCOMPARE(pageRenderer.renderMode(), QPdfPageRenderer::SingleThreadedRenderMode); + QCOMPARE(pageRenderer.renderMode(), QPdfPageRenderer::RenderMode::SingleThreaded); } void tst_QPdfPageRenderer::withNoDocument() @@ -110,7 +110,7 @@ void tst_QPdfPageRenderer::withLoadedDocumentMultiThreaded() QPdfPageRenderer pageRenderer; pageRenderer.setDocument(&document); - pageRenderer.setRenderMode(QPdfPageRenderer::MultiThreadedRenderMode); + pageRenderer.setRenderMode(QPdfPageRenderer::RenderMode::MultiThreaded); QCOMPARE(document.load(QFINDTESTDATA("pdf-sample.pagerenderer.pdf")), QPdfDocument::NoError); @@ -152,7 +152,7 @@ void tst_QPdfPageRenderer::switchingRenderMode() pageRenderedSpy.clear(); // switch to multi threaded - pageRenderer.setRenderMode(QPdfPageRenderer::MultiThreadedRenderMode); + pageRenderer.setRenderMode(QPdfPageRenderer::RenderMode::MultiThreaded); const quint64 secondRequestId = pageRenderer.requestPage(0, imageSize); @@ -167,7 +167,7 @@ void tst_QPdfPageRenderer::switchingRenderMode() pageRenderedSpy.clear(); // switch back to single threaded - pageRenderer.setRenderMode(QPdfPageRenderer::SingleThreadedRenderMode); + pageRenderer.setRenderMode(QPdfPageRenderer::RenderMode::SingleThreaded); const quint64 thirdRequestId = pageRenderer.requestPage(0, imageSize); diff --git a/tests/auto/quick/dialogs/BLACKLIST b/tests/auto/quick/dialogs/BLACKLIST deleted file mode 100644 index 10b7391a0..000000000 --- a/tests/auto/quick/dialogs/BLACKLIST +++ /dev/null @@ -1,8 +0,0 @@ -[contextMenuRequested] -osx-10.13 -[javaScriptDialogRequested] -osx-10.13 -[colorDialogRequested] -osx-10.13 -[fileDialogRequested] -osx-10.13 diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index bc8f61562..e27eb7253 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -126,6 +126,7 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineCertificateError.CertificateContainsErrors --> Error" << "QQuickWebEngineCertificateError.CertificateDateInvalid --> Error" << "QQuickWebEngineCertificateError.CertificateInvalid --> Error" + << "QQuickWebEngineCertificateError.CertificateKnownInterceptionBlocked --> Error" << "QQuickWebEngineCertificateError.CertificateNameConstraintViolation --> Error" << "QQuickWebEngineCertificateError.CertificateNoRevocationMechanism --> Error" << "QQuickWebEngineCertificateError.CertificateNonUniqueName --> Error" diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 071795d96..0b3ff7c7e 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -6,31 +6,17 @@ IMPORTPATH += $$PWD/data OTHER_FILES += \ $$PWD/data/TestWebEngineView.qml \ - $$PWD/data/accepttypes.html \ - $$PWD/data/alert.html \ $$PWD/data/append-document-title.js \ $$PWD/data/big-user-script.js \ $$PWD/data/change-document-title.js \ $$PWD/data/download.zip \ - $$PWD/data/confirm.html \ - $$PWD/data/confirmclose.html \ $$PWD/data/directoryupload.html \ $$PWD/data/favicon.html \ - $$PWD/data/favicon2.html \ - $$PWD/data/favicon-candidates-gray.html \ - $$PWD/data/favicon-misc.html \ - $$PWD/data/favicon-multi.html \ - $$PWD/data/favicon-multi-gray.html \ - $$PWD/data/favicon-single.html \ - $$PWD/data/favicon-shortcut.html \ - $$PWD/data/favicon-touch.html \ - $$PWD/data/favicon-unavailable.html \ $$PWD/data/forms.html \ $$PWD/data/geolocation.html \ $$PWD/data/javascript.html \ $$PWD/data/link.html \ $$PWD/data/localStorage.html \ - $$PWD/data/prompt.html \ $$PWD/data/multifileupload.html \ $$PWD/data/redirect.html \ $$PWD/data/script-with-metadata.js \ @@ -48,22 +34,15 @@ OTHER_FILES += \ $$PWD/data/tst_contextMenu.qml \ $$PWD/data/tst_desktopBehaviorLoadHtml.qml \ $$PWD/data/tst_download.qml \ - $$PWD/data/tst_favicon.qml \ - $$PWD/data/tst_faviconDownload.qml \ $$PWD/data/tst_filePicker.qml \ $$PWD/data/tst_findText.qml \ $$PWD/data/tst_focusOnNavigation.qml \ $$PWD/data/tst_geopermission.qml \ $$PWD/data/tst_getUserMedia.qml \ - $$PWD/data/tst_inputMethod.qml \ - $$PWD/data/tst_javaScriptDialogs.qml \ - $$PWD/data/tst_linkHovered.qml \ - $$PWD/data/tst_loadFail.qml \ $$PWD/data/tst_loadHtml.qml \ $$PWD/data/tst_loadProgress.qml \ $$PWD/data/tst_loadRecursionCrash.qml \ $$PWD/data/tst_loadUrl.qml \ - $$PWD/data/tst_mouseClick.qml \ $$PWD/data/tst_mouseMove.qml \ $$PWD/data/tst_navigationHistory.qml \ $$PWD/data/tst_navigationRequested.qml \ @@ -83,45 +62,6 @@ OTHER_FILES += \ $$PWD/data/tst_keyboardEvents.qml \ $$PWD/data/webchannel-test.html \ $$PWD/data/icons/favicon.png \ - $$PWD/data/icons/gray128.png \ - $$PWD/data/icons/gray16.png \ - $$PWD/data/icons/gray255.png \ - $$PWD/data/icons/gray32.png \ - $$PWD/data/icons/gray64.png \ - $$PWD/data/icons/grayicons.ico \ - $$PWD/data/icons/small-favicon.png \ - $$PWD/data/icons/qt144.png \ - $$PWD/data/icons/qt32.ico \ - $$PWD/data/icons/qtmulti.ico \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/qmldir \ - $$PWD/mock-delegates/TestParams/FilePickerParams.qml \ - $$PWD/mock-delegates/TestParams/JSDialogParams.qml \ - $$PWD/mock-delegates/TestParams/qmldir \ load(qt_build_paths) DEFINES += QUICK_TEST_SOURCE_DIR=\\\"$$re_escape($$PWD$${QMAKE_DIR_SEP}data)\\\" - -!qtConfig(webengine-testsupport) { - PLUGIN_EXTENSION = .so - PLUGIN_PREFIX = lib - osx: PLUGIN_PREFIX = .dylib - win32 { - PLUGIN_EXTENSION = .dll - PLUGIN_PREFIX = - } - - TESTSUPPORT_MODULE = $$shell_path($$[QT_INSTALL_QML]/QtWebEngine/testsupport/$${PLUGIN_PREFIX}qtwebenginetestsupportplugin$${PLUGIN_EXTENSION}) - BUILD_DIR = $$shell_path($$clean_path($$OUT_PWD/../../../..)) - SRC_DIR = $$shell_path($$clean_path($$PWD/../../../..)) - - warning("QML Test Support API is disabled. This means some QML tests that use Test Support API will fail.") - warning("Use the following command to build Test Support module and rebuild WebEngineView API:") - warning("cd $$BUILD_DIR && qmake -r $$shell_path($$SRC_DIR/qtwebengine.pro -- --feature-testsupport=yes) && make -C $$shell_path($$BUILD_DIR/src/webengine) clean && make") - warning("After performing the command above make sure QML module \"QtWebEngine.testsupport\" is deployed at $$TESTSUPPORT_MODULE") -} diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp index d70a43895..9e8d25222 100644 --- a/tests/auto/quick/qmltests/tst_qmltests.cpp +++ b/tests/auto/quick/qmltests/tst_qmltests.cpp @@ -122,8 +122,6 @@ int main(int argc, char **argv) sigaction(SIGSEGV, &sigAction, 0); #endif - // Inject the mock ui delegates module - qputenv("QML2_IMPORT_PATH", QByteArray(TESTS_SOURCE_DIR "qmltests/mock-delegates")); QScopedPointer<Application> app; // Force to use English language for testing due to error message checks diff --git a/tests/auto/quick/qmltests/data/accepttypes.html b/tests/auto/quick/qmltests2/data/accepttypes.html index aff39f96e..aff39f96e 100644 --- a/tests/auto/quick/qmltests/data/accepttypes.html +++ b/tests/auto/quick/qmltests2/data/accepttypes.html diff --git a/tests/auto/quick/qmltests/data/alert.html b/tests/auto/quick/qmltests2/data/alert.html index 89715a727..89715a727 100644 --- a/tests/auto/quick/qmltests/data/alert.html +++ b/tests/auto/quick/qmltests2/data/alert.html diff --git a/tests/auto/quick/qmltests/data/confirm.html b/tests/auto/quick/qmltests2/data/confirm.html index a4fc5b532..a4fc5b532 100644 --- a/tests/auto/quick/qmltests/data/confirm.html +++ b/tests/auto/quick/qmltests2/data/confirm.html diff --git a/tests/auto/quick/qmltests/data/confirmclose.html b/tests/auto/quick/qmltests2/data/confirmclose.html index c2acbb67f..c2acbb67f 100644 --- a/tests/auto/quick/qmltests/data/confirmclose.html +++ b/tests/auto/quick/qmltests2/data/confirmclose.html diff --git a/tests/auto/quick/qmltests/data/directoryupload.html b/tests/auto/quick/qmltests2/data/directoryupload.html index adc408ebb..adc408ebb 100644 --- a/tests/auto/quick/qmltests/data/directoryupload.html +++ b/tests/auto/quick/qmltests2/data/directoryupload.html diff --git a/tests/auto/quick/qmltests/data/favicon-candidates-gray.html b/tests/auto/quick/qmltests2/data/favicon-candidates-gray.html index ebea35b02..ebea35b02 100644 --- a/tests/auto/quick/qmltests/data/favicon-candidates-gray.html +++ b/tests/auto/quick/qmltests2/data/favicon-candidates-gray.html diff --git a/tests/auto/quick/qmltests/data/favicon-misc.html b/tests/auto/quick/qmltests2/data/favicon-misc.html index 9e788bdf4..9e788bdf4 100644 --- a/tests/auto/quick/qmltests/data/favicon-misc.html +++ b/tests/auto/quick/qmltests2/data/favicon-misc.html diff --git a/tests/auto/quick/qmltests/data/favicon-multi-gray.html b/tests/auto/quick/qmltests2/data/favicon-multi-gray.html index 24b71640f..24b71640f 100644 --- a/tests/auto/quick/qmltests/data/favicon-multi-gray.html +++ b/tests/auto/quick/qmltests2/data/favicon-multi-gray.html diff --git a/tests/auto/quick/qmltests/data/favicon-multi.html b/tests/auto/quick/qmltests2/data/favicon-multi.html index cc5f3fd66..cc5f3fd66 100644 --- a/tests/auto/quick/qmltests/data/favicon-multi.html +++ b/tests/auto/quick/qmltests2/data/favicon-multi.html diff --git a/tests/auto/quick/qmltests/data/favicon-shortcut.html b/tests/auto/quick/qmltests2/data/favicon-shortcut.html index 786cdb816..786cdb816 100644 --- a/tests/auto/quick/qmltests/data/favicon-shortcut.html +++ b/tests/auto/quick/qmltests2/data/favicon-shortcut.html diff --git a/tests/auto/quick/qmltests/data/favicon-single.html b/tests/auto/quick/qmltests2/data/favicon-single.html index eb4675c75..eb4675c75 100644 --- a/tests/auto/quick/qmltests/data/favicon-single.html +++ b/tests/auto/quick/qmltests2/data/favicon-single.html diff --git a/tests/auto/quick/qmltests/data/favicon-touch.html b/tests/auto/quick/qmltests2/data/favicon-touch.html index 271783434..271783434 100644 --- a/tests/auto/quick/qmltests/data/favicon-touch.html +++ b/tests/auto/quick/qmltests2/data/favicon-touch.html diff --git a/tests/auto/quick/qmltests/data/favicon-unavailable.html b/tests/auto/quick/qmltests2/data/favicon-unavailable.html index c45664294..c45664294 100644 --- a/tests/auto/quick/qmltests/data/favicon-unavailable.html +++ b/tests/auto/quick/qmltests2/data/favicon-unavailable.html diff --git a/tests/auto/quick/qmltests2/data/favicon.html b/tests/auto/quick/qmltests2/data/favicon.html new file mode 100644 index 000000000..e1b84a9cc --- /dev/null +++ b/tests/auto/quick/qmltests2/data/favicon.html @@ -0,0 +1,10 @@ +<html> +<head> +<link type="image/png" href="icons/favicon.png" sizes="48x48" rel="icon" /> +</head> +<body> +<p>It's expected that you see a favicon displayed for this page when you open it as a local file.</p> +<p>The favicon looks like this:</p> +<img id='image' src="icons/favicon.png"/> +</body> +</html> diff --git a/tests/auto/quick/qmltests/data/favicon2.html b/tests/auto/quick/qmltests2/data/favicon2.html index 81c2690fe..81c2690fe 100644 --- a/tests/auto/quick/qmltests/data/favicon2.html +++ b/tests/auto/quick/qmltests2/data/favicon2.html diff --git a/tests/auto/quick/qmltests2/data/icons/favicon.png b/tests/auto/quick/qmltests2/data/icons/favicon.png Binary files differnew file mode 100644 index 000000000..35717cca5 --- /dev/null +++ b/tests/auto/quick/qmltests2/data/icons/favicon.png diff --git a/tests/auto/quick/qmltests/data/icons/gray128.png b/tests/auto/quick/qmltests2/data/icons/gray128.png Binary files differindex bf1cfaba0..bf1cfaba0 100644 --- a/tests/auto/quick/qmltests/data/icons/gray128.png +++ b/tests/auto/quick/qmltests2/data/icons/gray128.png diff --git a/tests/auto/quick/qmltests/data/icons/gray16.png b/tests/auto/quick/qmltests2/data/icons/gray16.png Binary files differindex 2a1a91a76..2a1a91a76 100644 --- a/tests/auto/quick/qmltests/data/icons/gray16.png +++ b/tests/auto/quick/qmltests2/data/icons/gray16.png diff --git a/tests/auto/quick/qmltests/data/icons/gray255.png b/tests/auto/quick/qmltests2/data/icons/gray255.png Binary files differindex 549169551..549169551 100644 --- a/tests/auto/quick/qmltests/data/icons/gray255.png +++ b/tests/auto/quick/qmltests2/data/icons/gray255.png diff --git a/tests/auto/quick/qmltests/data/icons/gray32.png b/tests/auto/quick/qmltests2/data/icons/gray32.png Binary files differindex b269a528f..b269a528f 100644 --- a/tests/auto/quick/qmltests/data/icons/gray32.png +++ b/tests/auto/quick/qmltests2/data/icons/gray32.png diff --git a/tests/auto/quick/qmltests/data/icons/gray64.png b/tests/auto/quick/qmltests2/data/icons/gray64.png Binary files differindex e02559e5b..e02559e5b 100644 --- a/tests/auto/quick/qmltests/data/icons/gray64.png +++ b/tests/auto/quick/qmltests2/data/icons/gray64.png diff --git a/tests/auto/quick/qmltests/data/icons/grayicons.ico b/tests/auto/quick/qmltests2/data/icons/grayicons.ico Binary files differindex 8d8fee839..8d8fee839 100644 --- a/tests/auto/quick/qmltests/data/icons/grayicons.ico +++ b/tests/auto/quick/qmltests2/data/icons/grayicons.ico diff --git a/tests/auto/quick/qmltests/data/icons/qt144.png b/tests/auto/quick/qmltests2/data/icons/qt144.png Binary files differindex 050b1e066..050b1e066 100644 --- a/tests/auto/quick/qmltests/data/icons/qt144.png +++ b/tests/auto/quick/qmltests2/data/icons/qt144.png diff --git a/tests/auto/quick/qmltests/data/icons/qt32.ico b/tests/auto/quick/qmltests2/data/icons/qt32.ico Binary files differindex 2f6fcb5bc..2f6fcb5bc 100644 --- a/tests/auto/quick/qmltests/data/icons/qt32.ico +++ b/tests/auto/quick/qmltests2/data/icons/qt32.ico diff --git a/tests/auto/quick/qmltests/data/icons/qtmulti.ico b/tests/auto/quick/qmltests2/data/icons/qtmulti.ico Binary files differindex 81e5a22e8..81e5a22e8 100644 --- a/tests/auto/quick/qmltests/data/icons/qtmulti.ico +++ b/tests/auto/quick/qmltests2/data/icons/qtmulti.ico diff --git a/tests/auto/quick/qmltests/data/icons/small-favicon.png b/tests/auto/quick/qmltests2/data/icons/small-favicon.png Binary files differindex 8cf9a50a4..8cf9a50a4 100644 --- a/tests/auto/quick/qmltests/data/icons/small-favicon.png +++ b/tests/auto/quick/qmltests2/data/icons/small-favicon.png diff --git a/tests/auto/quick/qmltests/data/multifileupload.html b/tests/auto/quick/qmltests2/data/multifileupload.html index d41ea15c0..d41ea15c0 100644 --- a/tests/auto/quick/qmltests/data/multifileupload.html +++ b/tests/auto/quick/qmltests2/data/multifileupload.html diff --git a/tests/auto/quick/qmltests/data/prompt.html b/tests/auto/quick/qmltests2/data/prompt.html index 3293c0dcf..3293c0dcf 100644 --- a/tests/auto/quick/qmltests/data/prompt.html +++ b/tests/auto/quick/qmltests2/data/prompt.html diff --git a/tests/auto/quick/qmltests/data/singlefileupload.html b/tests/auto/quick/qmltests2/data/singlefileupload.html index ac91c2c0d..ac91c2c0d 100644 --- a/tests/auto/quick/qmltests/data/singlefileupload.html +++ b/tests/auto/quick/qmltests2/data/singlefileupload.html diff --git a/tests/auto/quick/qmltests2/data/test1.html b/tests/auto/quick/qmltests2/data/test1.html new file mode 100644 index 000000000..5c09f06ed --- /dev/null +++ b/tests/auto/quick/qmltests2/data/test1.html @@ -0,0 +1,6 @@ +<html> +<head><title>Test page 1</title></head> +<body> +Hello. +</body> +</html> diff --git a/tests/auto/quick/qmltests2/data/test2.html b/tests/auto/quick/qmltests2/data/test2.html new file mode 100644 index 000000000..629c2a063 --- /dev/null +++ b/tests/auto/quick/qmltests2/data/test2.html @@ -0,0 +1,6 @@ +<html> +<head><title>Test page with huge link area</title></head> +<body> +<a title="A title" href="test1.html"><img width=200 height=200></a> +</body> +</html> diff --git a/tests/auto/quick/qmltests/data/titleupdate.js b/tests/auto/quick/qmltests2/data/titleupdate.js index c86139c13..c86139c13 100644 --- a/tests/auto/quick/qmltests/data/titleupdate.js +++ b/tests/auto/quick/qmltests2/data/titleupdate.js diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests2/data/tst_favicon.qml index 50a412384..3f522d91a 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests2/data/tst_favicon.qml @@ -31,6 +31,7 @@ import QtTest 1.0 import QtWebEngine 1.3 import QtWebEngine.testsupport 1.0 import QtQuick.Window 2.0 +import "../../qmltests/data" 1.0 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_faviconDownload.qml b/tests/auto/quick/qmltests2/data/tst_faviconDownload.qml index 406dfa3ea..9aa32279c 100644 --- a/tests/auto/quick/qmltests/data/tst_faviconDownload.qml +++ b/tests/auto/quick/qmltests2/data/tst_faviconDownload.qml @@ -29,6 +29,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.3 +import "../../qmltests/data" 1.0 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_filePicker.qml b/tests/auto/quick/qmltests2/data/tst_filePicker.qml index 15eadb2a1..ffd7ef87b 100644 --- a/tests/auto/quick/qmltests/data/tst_filePicker.qml +++ b/tests/auto/quick/qmltests2/data/tst_filePicker.qml @@ -29,6 +29,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.2 +import "../../qmltests/data" 1.0 import "../mock-delegates/TestParams" 1.0 TestWebEngineView { @@ -68,7 +69,7 @@ TestWebEngineView { function cleanup() { // Test that the render process doesn't crash, and make sure if it does it does so now. - wait(1000) + wait(100) verify(terminationSpy.count == 0, "Render process didn't self terminate") // FIXME: Almost every second url loading progress does get stuck at about 90 percent, so the loadFinished signal won't arrive. diff --git a/tests/auto/quick/qmltests/data/tst_inputMethod.qml b/tests/auto/quick/qmltests2/data/tst_inputMethod.qml index c09a8bdd9..0bf9f7eb0 100644 --- a/tests/auto/quick/qmltests/data/tst_inputMethod.qml +++ b/tests/auto/quick/qmltests2/data/tst_inputMethod.qml @@ -30,6 +30,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.4 import QtWebEngine.testsupport 1.0 +import "../../qmltests/data" 1.0 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml index 07236c3be..658071005 100644 --- a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml +++ b/tests/auto/quick/qmltests2/data/tst_javaScriptDialogs.qml @@ -30,6 +30,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.2 import QtWebEngine.testsupport 1.0 +import "../../qmltests/data" 1.0 import "../mock-delegates/TestParams" 1.0 TestWebEngineView { diff --git a/tests/auto/quick/qmltests/data/tst_linkHovered.qml b/tests/auto/quick/qmltests2/data/tst_linkHovered.qml index d632452fe..faf943c55 100644 --- a/tests/auto/quick/qmltests/data/tst_linkHovered.qml +++ b/tests/auto/quick/qmltests2/data/tst_linkHovered.qml @@ -30,6 +30,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.2 import QtWebEngine.testsupport 1.0 +import "../../qmltests/data" 1.0 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests2/data/tst_loadFail.qml index 7b51009a1..db412f252 100644 --- a/tests/auto/quick/qmltests/data/tst_loadFail.qml +++ b/tests/auto/quick/qmltests2/data/tst_loadFail.qml @@ -30,6 +30,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.2 import QtWebEngine.testsupport 1.0 +import "../../qmltests/data" 1.0 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_mouseClick.qml b/tests/auto/quick/qmltests2/data/tst_mouseClick.qml index d81e690fd..eaa012f86 100644 --- a/tests/auto/quick/qmltests/data/tst_mouseClick.qml +++ b/tests/auto/quick/qmltests2/data/tst_mouseClick.qml @@ -29,8 +29,8 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.4 - import QtWebEngine.testsupport 1.0 +import "../../qmltests/data" 1.0 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml index 4ba3be4b9..4ba3be4b9 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml index 9933fc2f7..9933fc2f7 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml index 745f533f5..745f533f5 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml index 36efa7680..36efa7680 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml index e61f4c230..e61f4c230 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml index 7c5b16eab..7c5b16eab 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/qmldir index cf8ac0512..cf8ac0512 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir +++ b/tests/auto/quick/qmltests2/mock-delegates/QtWebEngine/Controls1Delegates/qmldir diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml b/tests/auto/quick/qmltests2/mock-delegates/TestParams/FilePickerParams.qml index 02b0da1d4..02b0da1d4 100644 --- a/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/TestParams/FilePickerParams.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml b/tests/auto/quick/qmltests2/mock-delegates/TestParams/JSDialogParams.qml index 70696803c..70696803c 100644 --- a/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml +++ b/tests/auto/quick/qmltests2/mock-delegates/TestParams/JSDialogParams.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir b/tests/auto/quick/qmltests2/mock-delegates/TestParams/qmldir index a21dd8236..5807f1e6e 100644 --- a/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir +++ b/tests/auto/quick/qmltests2/mock-delegates/TestParams/qmldir @@ -2,4 +2,3 @@ module TestParams singleton FilePickerParams 1.0 FilePickerParams.qml singleton JSDialogParams 1.0 JSDialogParams.qml - diff --git a/tests/auto/quick/qmltests2/qmltests2.pro b/tests/auto/quick/qmltests2/qmltests2.pro new file mode 100644 index 000000000..4c7a8dc72 --- /dev/null +++ b/tests/auto/quick/qmltests2/qmltests2.pro @@ -0,0 +1,78 @@ +include(../tests.pri) + +QT += qmltest + +IMPORTPATH += $$PWD/data + +OTHER_FILES += \ + $$PWD/data/accepttypes.html \ + $$PWD/data/alert.html \ + $$PWD/data/confirm.html \ + $$PWD/data/confirmclose.html \ + $$PWD/data/directoryupload.html \ + $$PWD/data/favicon.html \ + $$PWD/data/favicon2.html \ + $$PWD/data/favicon-candidates-gray.html \ + $$PWD/data/favicon-misc.html \ + $$PWD/data/favicon-multi.html \ + $$PWD/data/favicon-multi-gray.html \ + $$PWD/data/favicon-single.html \ + $$PWD/data/favicon-shortcut.html \ + $$PWD/data/favicon-touch.html \ + $$PWD/data/favicon-unavailable.html \ + $$PWD/data/multifileupload.html \ + $$PWD/data/prompt.html \ + $$PWD/data/singlefileupload.html \ + $$PWD/data/test1.html \ + $$PWD/data/test2.html \ + $$PWD/data/titleupdate.js \ + $$PWD/data/tst_favicon.qml \ + $$PWD/data/tst_faviconDownload.qml \ + $$PWD/data/tst_inputMethod.qml \ + $$PWD/data/tst_javaScriptDialogs.qml \ + $$PWD/data/tst_linkHovered.qml \ + $$PWD/data/tst_loadFail.qml \ + $$PWD/data/tst_mouseClick.qml \ + $$PWD/data/icons/favicon.png \ + $$PWD/data/icons/gray128.png \ + $$PWD/data/icons/gray16.png \ + $$PWD/data/icons/gray255.png \ + $$PWD/data/icons/gray32.png \ + $$PWD/data/icons/gray64.png \ + $$PWD/data/icons/grayicons.ico \ + $$PWD/data/icons/qt144.png \ + $$PWD/data/icons/qt32.ico \ + $$PWD/data/icons/qtmulti.ico \ + $$PWD/data/icons/small-favicon.png \ + $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/qmldir \ + $$PWD/mock-delegates/TestParams/FilePickerParams.qml \ + $$PWD/mock-delegates/TestParams/JSDialogParams.qml \ + $$PWD/mock-delegates/TestParams/qmldir \ + +load(qt_build_paths) +DEFINES += QUICK_TEST_SOURCE_DIR=\\\"$$re_escape($$PWD$${QMAKE_DIR_SEP}data)\\\" + +!qtConfig(webengine-testsupport) { + PLUGIN_EXTENSION = .so + PLUGIN_PREFIX = lib + osx: PLUGIN_PREFIX = .dylib + win32 { + PLUGIN_EXTENSION = .dll + PLUGIN_PREFIX = + } + + TESTSUPPORT_MODULE = $$shell_path($$[QT_INSTALL_QML]/QtWebEngine/testsupport/$${PLUGIN_PREFIX}qtwebenginetestsupportplugin$${PLUGIN_EXTENSION}) + BUILD_DIR = $$shell_path($$clean_path($$OUT_PWD/../../../..)) + SRC_DIR = $$shell_path($$clean_path($$PWD/../../../..)) + + warning("QML Test Support API is disabled. This means some QML tests that use Test Support API will fail.") + warning("Use the following command to build Test Support module and rebuild WebEngineView API:") + warning("cd $$BUILD_DIR && qmake -r $$shell_path($$SRC_DIR/qtwebengine.pro -- --feature-testsupport=yes) && make -C $$shell_path($$BUILD_DIR/src/webengine) clean && make") + warning("After performing the command above make sure QML module \"QtWebEngine.testsupport\" is deployed at $$TESTSUPPORT_MODULE") +} diff --git a/tests/auto/quick/qmltests2/tst_qmltests2.cpp b/tests/auto/quick/qmltests2/tst_qmltests2.cpp new file mode 100644 index 000000000..8c81ed7f5 --- /dev/null +++ b/tests/auto/quick/qmltests2/tst_qmltests2.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 <QtCore/QScopedPointer> +#include <QtQuickTest/quicktest.h> +#include <QtWebEngine/QQuickWebEngineProfile> +#include "qt_webengine_quicktest.h" + +#if defined(Q_OS_LINUX) && defined(QT_DEBUG) +#include <fcntl.h> +#include <signal.h> +#include <unistd.h> +#endif + +#if defined(Q_OS_LINUX) && defined(QT_DEBUG) +static bool debuggerPresent() +{ + int fd = open("/proc/self/status", O_RDONLY); + if (fd == -1) + return false; + char buffer[2048]; + ssize_t size = read(fd, buffer, sizeof(buffer) - 1); + if (size == -1) { + close(fd); + return false; + } + buffer[size] = 0; + const char tracerPidToken[] = "\nTracerPid:"; + char *tracerPid = strstr(buffer, tracerPidToken); + if (!tracerPid) { + close(fd); + return false; + } + tracerPid += sizeof(tracerPidToken); + long int pid = strtol(tracerPid, &tracerPid, 10); + close(fd); + return pid != 0; +} + +static void stackTrace() +{ + bool ok = false; + const int disableStackDump = qEnvironmentVariableIntValue("QTEST_DISABLE_STACK_DUMP", &ok); + if (ok && disableStackDump == 1) + return; + + if (debuggerPresent()) + return; + + fprintf(stderr, "\n========= Received signal, dumping stack ==============\n"); + char cmd[512]; + qsnprintf(cmd, 512, "gdb --pid %d 2>/dev/null <<EOF\n" + "set prompt\n" + "set height 0\n" + "thread apply all where full\n" + "detach\n" + "quit\n" + "EOF\n", + (int)getpid()); + + if (system(cmd) == -1) + fprintf(stderr, "calling gdb failed\n"); + fprintf(stderr, "========= End of stack trace ==============\n"); +} + +static void sigSegvHandler(int signum) +{ + stackTrace(); + qFatal("Received signal %d", signum); +} +#endif + +int main(int argc, char **argv) +{ +#if defined(Q_OS_LINUX) && defined(QT_DEBUG) + struct sigaction sigAction; + + sigemptyset(&sigAction.sa_mask); + sigAction.sa_handler = &sigSegvHandler; + sigAction.sa_flags = 0; + + sigaction(SIGSEGV, &sigAction, 0); +#endif + + // Inject the mock ui delegates module + qputenv("QML2_IMPORT_PATH", QByteArray(TESTS_SOURCE_DIR "qmltests2/mock-delegates")); + QScopedPointer<Application> app; + + // Force to use English language for testing due to error message checks + QLocale::setDefault(QLocale("en")); + + if (!QCoreApplication::instance()) { + app.reset(new Application(argc, argv)); + } + QtWebEngine::initialize(); + QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true); + + QTEST_SET_MAIN_SOURCE_PATH + + int i = quick_test_main(argc, argv, "qmltests2", QUICK_TEST_SOURCE_DIR); + return i; +} diff --git a/tests/auto/quick/qquickwebengineprofile/qquickwebengineprofile.pro b/tests/auto/quick/qquickwebengineprofile/qquickwebengineprofile.pro new file mode 100644 index 000000000..e99c7f493 --- /dev/null +++ b/tests/auto/quick/qquickwebengineprofile/qquickwebengineprofile.pro @@ -0,0 +1 @@ +include(../tests.pri) diff --git a/tests/auto/quick/qquickwebengineprofile/tst_qquickwebengineprofile.cpp b/tests/auto/quick/qquickwebengineprofile/tst_qquickwebengineprofile.cpp new file mode 100644 index 000000000..db7c2ad6e --- /dev/null +++ b/tests/auto/quick/qquickwebengineprofile/tst_qquickwebengineprofile.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** 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 <QtQml/QQmlEngine> +#include <QtTest/QtTest> +#include <QtWebEngine/QQuickWebEngineProfile> + +class tst_QQuickWebEngineProfile : public QObject { + Q_OBJECT +public: + tst_QQuickWebEngineProfile(); + + // TODO: Many tests missings + void usedForGlobalCertificateVerification(); + +private Q_SLOTS: + void init(); + void cleanup(); +}; + +tst_QQuickWebEngineProfile::tst_QQuickWebEngineProfile() +{ + QtWebEngine::initialize(); + QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true); +} + + +void tst_QQuickWebEngineProfile::init() +{ +} + +void tst_QQuickWebEngineProfile::cleanup() +{ +} + +void tst_QQuickWebEngineProfile::usedForGlobalCertificateVerification() +{ + QQuickWebEngineProfile *profile1 = new QQuickWebEngineProfile(); + QQuickWebEngineProfile *profile2 = new QQuickWebEngineProfile(); + QVERIFY(!profile1->isUsedForGlobalVerification()); + QVERIFY(!profile2->isUsedForGlobalVerification()); + + +} + + +QTEST_MAIN(tst_QQuickWebEngineProfile) +#include "tst_qquickwebengineprofile.moc" diff --git a/tests/auto/quick/qquickwebengineview/BLACKLIST b/tests/auto/quick/qquickwebengineview/BLACKLIST deleted file mode 100644 index af97422a9..000000000 --- a/tests/auto/quick/qquickwebengineview/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -# until qt5.git is updated with new qtdeclarative -[focusChild] -* diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index f9d84b3b4..285330460 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -6,6 +6,7 @@ TEMPLATE = subdirs SUBDIRS += \ dialogs \ inspectorserver \ + qmltests \ publicapi \ qquickwebenginedefaultsurfaceformat \ qquickwebengineview \ @@ -13,11 +14,11 @@ SUBDIRS += \ qtConfig(webengine-testsupport) { SUBDIRS += \ - qmltests \ + qmltests2 \ qquickwebengineviewgraphics } !qtHaveModule(quickcontrols): SUBDIRS -= qmltests # QTBUG-66055 -boot2qt: SUBDIRS -= inspectorserver qquickwebengineview qmltests +boot2qt: SUBDIRS -= inspectorserver qquickwebengineview qmltests qmltests2 diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp index 9ec9e6a5b..748837c7f 100644 --- a/tests/auto/widgets/accessibility/tst_accessibility.cpp +++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp @@ -337,17 +337,9 @@ void tst_Accessibility::roles_data() QTest::addColumn<QAccessible::Role>("role"); QTest::newRow("ax::mojom::Role::kAbbr") << QString("<abbr>a</abbr>") << 1 << QAccessible::StaticText; - QTest::newRow("ax::mojom::Role::KAlert") << QString("<div role='alert'>alert</div>") << 0 << QAccessible::AlertMessage; + QTest::newRow("ax::mojom::Role::kAlert") << QString("<div role='alert'>alert</div>") << 0 << QAccessible::AlertMessage; QTest::newRow("ax::mojom::Role::kAlertDialog") << QString("<div role='alertdialog'>alert</div>") << 0 << QAccessible::AlertMessage; QTest::newRow("ax::mojom::Role::kAnchor") << QString("<a id='a'>Chapter a</a>") << 1 << QAccessible::Link; - - // REMINDER: annotation roles are removed from Chromium 80: https://chromium-review.googlesource.com/c/chromium/src/+/1907074 - //QTest::newRow("ax::mojom::Role::kAnnotationAttribution") << QString("<div role='annotation-attribution'></div>") << 0 << QAccessible::Section; // FIXME: Aria role 'annotation-attribution' should work - //QTest::newRow("ax::mojom::Role::kAnnotationCommentary") << QString("<div role='annotation-commentary'></div>") << 0 << QAccessible::Section; // FIXME: Aria role 'annotation-commentary' should work - //QTest::newRow("ax::mojom::Role::kAnnotationPresence") << QString("<div role='annotation-presence'></div>") << 0 << QAccessible::Section; // FIXME: Aria role 'annotation-presence' should work - //QTest::newRow("ax::mojom::Role::kAnnotationRevision") << QString("<div role='annotation-revision'></div>") << 0 << QAccessible::Section; // FIXME: Aria role 'annotation-revision' should work - //QTest::newRow("ax::mojom::Role::kAnnotationSuggestion") << QString("<div role='annotation-suggestion'></div>") << 0 << QAccessible::Section; // FIXME: Aria role 'annotation-suggestion' should work - QTest::newRow("ax::mojom::Role::kApplication") << QString("<div role='application'>landmark</div>") << 0 << QAccessible::Document; QTest::newRow("ax::mojom::Role::kArticle") << QString("<article>a</article>") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kAudio") << QString("<audio controls><source src='test.mp3' type='audio/mpeg'></audio>") << 1 << QAccessible::Sound; @@ -360,6 +352,7 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kCell") << QString("<table role=table><tr><td>a</td></tr></table>") << 2 << QAccessible::Cell; QTest::newRow("ax::mojom::Role::kCheckBox") << QString("<input type='checkbox'>a</input>") << 1 << QAccessible::CheckBox; QTest::newRow("ax::mojom::Role::kClient") << QString("") << 0 << QAccessible::Client; + QTest::newRow("ax::mojom::Role::kCode") << QString("<code>a</code>") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kColorWell") << QString("<input type='color'>a</input>") << 1 << QAccessible::ColorChooser; //QTest::newRow("ax::mojom::Role::kColumn") << QString("<table><tr><td>a</td></tr></table>") << 0 << QAccessible::Column; // FIXME: The test case might be wrong (see AXTableColumn.h) QTest::newRow("ax::mojom::Role::kColumnHeader") << QString("<table role=table><tr><th>a</th></tr><tr><td>a</td></tr></table>") << 2 << QAccessible::ColumnHeader; @@ -367,6 +360,8 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kComboBoxMenuButton") << QString("<div tabindex=0 role='combobox'>Select</div>") << 0 << QAccessible::ComboBox; QTest::newRow("ax::mojom::Role::kTextFieldWithComboBox") << QString("<input role='combobox'>") << 1 << QAccessible::ComboBox; QTest::newRow("ax::mojom::Role::kComplementary") << QString("<aside>a</aside>") << 0 << QAccessible::ComplementaryContent; + QTest::newRow("ax::mojom::Role::kComment") << QString("<div role='comment'></div>") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kCommenSection") << QString("<div role='commentsection'></div>") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kContentDeletion") << QString("<div role='deletion'></div>") << 0 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kContentInsertion") << QString("<div role='insertion'></div>") << 0 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kContentInfo") << QString("<div role='contentinfo'></div>") << 0 << QAccessible::Section; @@ -423,6 +418,7 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kDocToc") << QString("<div role='doc-toc'></div>") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kDocument") << QString("<div role='document'>a</div>") << 0 << QAccessible::Document; QTest::newRow("ax::mojom::Role::kEmbeddedObject") << QString("<object width='10' height='10'></object>") << 1 << QAccessible::Grouping; + QTest::newRow("ax::mojom::Role::kEmphasis") << QString("<em>a</em>") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kFeed") << QString("<div role='feed'>a</div>") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kFigcaption") << QString("<figcaption>a</figcaption>") << 0 << QAccessible::Heading; QTest::newRow("ax::mojom::Role::kFigure") << QString("<figure>a</figure>") << 0 << QAccessible::Section; @@ -484,7 +480,9 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kRadioButton") << QString("<input type='radio'></input>") << 1 << QAccessible::RadioButton; QTest::newRow("ax::mojom::Role::kRadioGroup") << QString("<fieldset role='radiogroup'></fieldset>") << 0 << QAccessible::Grouping; QTest::newRow("ax::mojom::Role::kRegion") << QString("<div role='region'>a</div>") << 0 << QAccessible::Section; + QTest::newRow("ax::mojom::Role::kRevision") << QString("<div role='revision'></div>") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kRow") << QString("<table role=table><tr><td>a</td></tr></table>") << 1 << QAccessible::Row; + QTest::newRow("ax::mojom::Role::kRowGroup") << QString("<table role=table><tbody role=rowgroup><tr><td>a</td></tr></tbody></table>") << 1 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kRowHeader") << QString("<table role=table><tr><th>a</td><td>b</td></tr></table>") << 2 << QAccessible::RowHeader; QTest::newRow("ax::mojom::Role::kRuby") << QString("<ruby>a</ruby>") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kRubyAnnotation") << QString("<ruby><rt>a</rt></ruby>") << 2 << QAccessible::StaticText; @@ -499,6 +497,8 @@ void tst_Accessibility::roles_data() QTest::newRow("ax::mojom::Role::kSplitter") << QString("<hr>") << 0 << QAccessible::Splitter; QTest::newRow("ax::mojom::Role::kStaticText") << QString("a") << 1 << QAccessible::StaticText; QTest::newRow("ax::mojom::Role::kStatus") << QString("<output>a</output>") << 1 << QAccessible::Indicator; + QTest::newRow("ax::mojom::Role::kStrong") << QString("<strong>a</strong>") << 1 << QAccessible::StaticText; + QTest::newRow("ax::mojom::Role::kSuggestion") << QString("<div role='suggestion'></div>") << 0 << QAccessible::Section; QTest::newRow("ax::mojom::Role::kSvgRoot") << QString("<svg width='10' height='10'></svg>") << 1 << QAccessible::Graphic; QTest::newRow("ax::mojom::Role::kSwitch") << QString("<button aria-checked='false'>a</button>") << 1 << QAccessible::Button; QTest::newRow("ax::mojom::Role::kTable") << QString("<table role=table><td>a</td></table>") << 0 << QAccessible::Table; @@ -554,7 +554,8 @@ void tst_Accessibility::roles() } static QByteArrayList params = QByteArrayList() - << "--force-renderer-accessibility"; + << "--force-renderer-accessibility" + << "--enable-features=AccessibilityExposeARIAAnnotations"; W_QTEST_MAIN(tst_Accessibility, params) #include "tst_accessibility.moc" diff --git a/tests/auto/widgets/proxypac/proxypac.pri b/tests/auto/widgets/proxypac/proxypac.pri new file mode 100644 index 000000000..b3b2856c8 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +CONFIG += testcase +QT += testlib network webenginewidgets webengine +HEADERS += $$PWD/proxyserver.h +SOURCES += $$PWD/proxyserver.cpp $$PWD/tst_proxypac.cpp diff --git a/tests/auto/widgets/proxypac/proxypac.pro b/tests/auto/widgets/proxypac/proxypac.pro index 2aacb4366..f2a43d41f 100644 --- a/tests/auto/widgets/proxypac/proxypac.pro +++ b/tests/auto/widgets/proxypac/proxypac.pro @@ -1,13 +1,4 @@ -include(../tests.pri) -QT += webengine -HEADERS += proxyserver.h -SOURCES += proxyserver.cpp - -proxy_pac.name = QTWEBENGINE_CHROMIUM_FLAGS - -win32:proxy_pac.value = --proxy-pac-url="file:///$$PWD/proxy.pac" -else:proxy_pac.value = --proxy-pac-url="file://$$PWD/proxy.pac" -boot2qt:proxy_pac.value = "--single-process --no-sandbox --proxy-pac-url=file://$$PWD/proxy.pac" - -QT_TOOL_ENV += proxy_pac +TEMPLATE = subdirs +SUBDIRS = proxypac_file proxypac_qrc +CONFIG += ordered diff --git a/tests/auto/widgets/proxypac/proxypac.qrc b/tests/auto/widgets/proxypac/proxypac.qrc new file mode 100644 index 000000000..9047585a0 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac.qrc @@ -0,0 +1,7 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> +<qresource profix="/"> + <file>proxy.pac</file> +</qresource> +</RCC> + diff --git a/tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro b/tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro new file mode 100644 index 000000000..037123054 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro @@ -0,0 +1,9 @@ +include(../proxypac.pri) + +proxy_pac.name = QTWEBENGINE_CHROMIUM_FLAGS +win32:proxy_pac.value = --proxy-pac-url="file:///$$PWD/../proxy.pac" +else:proxy_pac.value = --proxy-pac-url="file://$$PWD/../proxy.pac" +boot2qt:proxy_pac.value = "--single-process --no-sandbox --proxy-pac-url=file://$$PWD/../proxy.pac" + +QT_TOOL_ENV += proxy_pac + diff --git a/tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro b/tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro new file mode 100644 index 000000000..a5ab64605 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro @@ -0,0 +1,7 @@ +include(../proxypac.pri) + +proxy_pac.name = QTWEBENGINE_CHROMIUM_FLAGS +proxy_pac.value = --proxy-pac-url="qrc:///proxy.pac" +boot2qt:proxy_pac.value = "--single-process --no-sandbox --proxy-pac-url=qrc:///proxy.pac" +QT_TOOL_ENV += proxy_pac +RESOURCES+= $$PWD/../proxypac.qrc diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 78f1b4bdb..098656390 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -226,6 +226,7 @@ private Q_SLOTS: void customUserAgentInNewTab(); void renderProcessCrashed(); void renderProcessPid(); + void backgroundColor(); private: static QPoint elementCenter(QWebEnginePage *page, const QString &id); @@ -826,6 +827,7 @@ void tst_QWebEnginePage::localStorageVisibility() // Toggle local setting for every page and... webPage1.settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false); webPage2.settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true); + // TODO: note this setting is flaky, consider settings().commit() // ...first check second page (for storage to appear) as applying settings is batched and done asynchronously QTRY_VERIFY(evaluateJavaScriptSync(&webPage2, QString("(window.localStorage != undefined)")).toBool()); // Switching the feature off does not actively remove the object from webPage1. @@ -4387,6 +4389,49 @@ void tst_QWebEnginePage::renderProcessPid() QCOMPARE(m_page->renderProcessPid(), 0); } +void tst_QWebEnginePage::backgroundColor() +{ + QWebEngineProfile profile; + QWebEngineView view; + QWebEnginePage *page = new QWebEnginePage(&profile, &view); + + view.resize(640, 480); + view.setStyleSheet("background: yellow"); + view.show(); + QPoint center(view.size().width() / 2, view.size().height() / 2); + + QCOMPARE(page->backgroundColor(), Qt::white); + QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::white); + + page->setBackgroundColor(Qt::red); + view.setPage(page); + + QCOMPARE(page->backgroundColor(), Qt::red); + QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::red); + + page->setHtml(QString("<html>" + "<head><style>html, body { margin:0; padding:0; }</style></head>" + "<body><div style=\"width:100%; height:10px; background-color:black\"/></body>" + "</html>")); + QSignalSpy spyFinished(page, &QWebEnginePage::loadFinished); + QVERIFY(spyFinished.wait()); + // Make sure the page is rendered and the test is not grabbing the color of the RenderWidgetHostViewQtDelegateWidget. + QTRY_COMPARE(view.grab().toImage().pixelColor(QPoint(5, 5)), Qt::black); + + QCOMPARE(page->backgroundColor(), Qt::red); + QCOMPARE(view.grab().toImage().pixelColor(center), Qt::red); + + page->setBackgroundColor(Qt::transparent); + + QCOMPARE(page->backgroundColor(), Qt::transparent); + QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::yellow); + + page->setBackgroundColor(Qt::green); + + QCOMPARE(page->backgroundColor(), Qt::green); + QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::green); +} + static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")}; W_QTEST_MAIN(tst_QWebEnginePage, params) diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 80c6740b4..6350c8510 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -237,6 +237,7 @@ static bool loadSync(QWebEngineView *view, const QUrl &url, bool ok = true) void tst_QWebEngineProfile::clearDataFromCache() { TestServer server; + QSignalSpy serverSpy(&server, &HttpServer::newRequest); QVERIFY(server.start()); AutoDir cacheDir("./tst_QWebEngineProfile_clearDataFromCache"); @@ -247,6 +248,8 @@ void tst_QWebEngineProfile::clearDataFromCache() QWebEnginePage page(&profile); QVERIFY(loadSync(&page, server.url("/hedgehog.html"))); + // Wait for GET /favicon.ico + QTRY_COMPARE(serverSpy.size(), 3); QVERIFY(cacheDir.exists("Cache")); qint64 sizeBeforeClear = totalSize(cacheDir); @@ -945,7 +948,8 @@ void tst_QWebEngineProfile::changeUseForGlobalCertificateVerification() profile.setUseForGlobalCertificateVerification(true); page.reset(new QWebEnginePage(&profile)); QVERIFY(loadSync(page.get(), server.url("/hedgehog.html"))); - QVERIFY(server.stop()); + // Don't check for error: there can be disconnects during GET hedgehog.png. + server.stop(); } void tst_QWebEngineProfile::changePersistentCookiesPolicy() diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp index b4061b984..a09901e69 100644 --- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp +++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp @@ -168,7 +168,7 @@ protected: if (isMainFrame && url.scheme().startsWith("data")) settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true); - + // TODO: note this setting is flaky, consider settings().commit() return true; } }; diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h index 20241be8b..ca03c5833 100644 --- a/tests/auto/widgets/util.h +++ b/tests/auto/widgets/util.h @@ -83,10 +83,13 @@ public: QObject::connect(&timeoutTimer, SIGNAL(timeout()), &eventLoop, SLOT(quit())); } - T waitForResult() { - if (!called) { - timeoutTimer.start(20000); + T waitForResult(int timeout = 20000) { + const int step = 1000; + int elapsed = 0; + while (elapsed < timeout && !called) { + timeoutTimer.start(step); eventLoop.exec(); + elapsed += step; } return result; } |