diff options
Diffstat (limited to 'tests/auto/quick')
5 files changed, 36 insertions, 9 deletions
diff --git a/tests/auto/quick/qmltests/data/confirmclose.html b/tests/auto/quick/qmltests/data/confirmclose.html index ba11da7a4..c2acbb67f 100644 --- a/tests/auto/quick/qmltests/data/confirmclose.html +++ b/tests/auto/quick/qmltests/data/confirmclose.html @@ -1,5 +1,6 @@ <html> -<body onbeforeunload="return 'You are about to miss out on some awesome content.';"> +<body onbeforeunload="return 'You are about to miss out on some awesome content.';" + onmousedown="window.mousePressReceived = true;"> Be greeted, precious viewer! </body> </html> diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml index 73673f511..44836d67c 100644 --- a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml +++ b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml @@ -34,6 +34,7 @@ import "../mock-delegates/TestParams" 1.0 TestWebEngineView { id: webEngineView + anchors.fill: parent testSupport: WebEngineTestSupport { property bool windowCloseRejectedSignalEmitted: false @@ -52,6 +53,7 @@ TestWebEngineView { TestCase { id: test name: "WebEngineViewJavaScriptDialogs" + when: windowShown function init() { JSDialogParams.dialogMessage = ""; @@ -82,11 +84,29 @@ TestWebEngineView { } + function simulateUserGesture() { + // A user gesture after page load is required since Chromium 60 to allow showing + // an onbeforeunload dialog. + // See https://www.chromestatus.com/feature/5082396709879808 + mouseClick(webEngineView, 10, 10, Qt.LeftButton) + + var mousePressReceived; + runJavaScript("window.mousePressReceived", function(result) { + mousePressReceived = result; + }); + + tryVerify(function() { + return mousePressReceived != undefined + }, 5000); + } + function test_confirmClose() { webEngineView.url = Qt.resolvedUrl("confirmclose.html"); verify(webEngineView.waitForLoadSucceeded()); webEngineView.windowCloseRequestedSignalEmitted = false; JSDialogParams.shouldAcceptDialog = true; + + simulateUserGesture() webEngineView.triggerWebAction(WebEngineView.RequestClose); verify(webEngineView.waitForWindowCloseRequested()); } @@ -96,6 +116,8 @@ TestWebEngineView { verify(webEngineView.waitForLoadSucceeded()); webEngineView.testSupport.windowCloseRejectedSignalEmitted = false; JSDialogParams.shouldAcceptDialog = false; + + simulateUserGesture() webEngineView.triggerWebAction(WebEngineView.RequestClose); verify(webEngineView.testSupport.waitForWindowCloseRejected()); } diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp index 5dc909709..2aa24b76c 100644 --- a/tests/auto/quick/qmltests/tst_qmltests.cpp +++ b/tests/auto/quick/qmltests/tst_qmltests.cpp @@ -114,8 +114,17 @@ int main(int argc, char **argv) // 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)); + static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")}; + QVector<const char *> w_argv(argc); \ + for (int i = 0; i < argc; ++i) \ + w_argv[i] = argv[i]; \ + for (int i = 0; i < params.size(); ++i) \ + w_argv.append(params[i].data()); \ + int w_argc = w_argv.size(); \ + + if (!QCoreApplication::instance()) { + app.reset(new Application(w_argc, const_cast<char **>(w_argv.data()))); + } QtWebEngine::initialize(); QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true); diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp index 2afaf03a3..0139d266f 100644 --- a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp +++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp @@ -110,7 +110,7 @@ QUrl tst_QQuickWebEngineDefaultSurfaceFormat::urlFromTestPath(const char *localF void tst_QQuickWebEngineDefaultSurfaceFormat::customDefaultSurfaceFormat() { -#if !defined(Q_OS_MACOSX) +#if !defined(Q_OS_MACOS) QSKIP("OpenGL Core Profile is currently only supported on macOS."); #endif // Setting a new default QSurfaceFormat with a core OpenGL profile, before diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index 8aea72cca..7af2263be 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -261,7 +261,6 @@ void tst_QQuickWebEngineView::loadProgress() void tst_QQuickWebEngineView::show() { - QSKIP("Skip to due 58-based issues. Restore once 60-based is in."); // This should not crash. m_window->show(); QTest::qWait(200); @@ -270,7 +269,6 @@ void tst_QQuickWebEngineView::show() void tst_QQuickWebEngineView::showWebEngineView() { - QSKIP("Skip to due 58-based issues. Restore once 60-based is in."); webEngineView()->setUrl(urlFromTestPath("html/direct-image-compositing.html")); QVERIFY(waitForLoadSucceeded(webEngineView())); m_window->show(); @@ -283,7 +281,6 @@ void tst_QQuickWebEngineView::showWebEngineView() void tst_QQuickWebEngineView::removeFromCanvas() { - QSKIP("Skip to due 58-based issues. Restore once 60-based is in."); showWebEngineView(); // This should not crash. @@ -298,7 +295,6 @@ void tst_QQuickWebEngineView::removeFromCanvas() void tst_QQuickWebEngineView::multipleWebEngineViewWindows() { - QSKIP("Skip to due 58-based issues. Restore once 60-based is in."); showWebEngineView(); // This should not crash. @@ -321,7 +317,6 @@ void tst_QQuickWebEngineView::multipleWebEngineViewWindows() void tst_QQuickWebEngineView::multipleWebEngineViews() { - QSKIP("Skip to due 58-based issues. Restore once 60-based is in."); showWebEngineView(); // This should not crash. |