diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-07-19 14:12:54 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-11 17:25:32 +0000 |
commit | 7282fb4fb4861320539f2b7288f63e1d4f48749d (patch) | |
tree | 3fb62ed4d45875be975410b08c776888803748ec /tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml | |
parent | 82499104972d24027044acaff1136ea7d758efe2 (diff) |
Adaptations for Chromium 60
Change-Id: I536258e22c2ec143f2fd3f1cbda229e0611b6af4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml | 22 |
1 files changed, 22 insertions, 0 deletions
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()); } |