diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-03-08 10:40:49 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-03-08 10:40:49 +0100 |
commit | ccf12049b662fe1b03b5b0ea199d29b32f072eda (patch) | |
tree | 43e3d0042eb1f8ba23349e10c9c7e547fab57fec /tests/auto/quick/qmltests/data/tst_geopermission.qml | |
parent | 56714be7d05afb94c63b658a4fdb2bedd1bee645 (diff) | |
parent | 471d484bea6b8b84749b8d89c603cb8394f1b5ee (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ieab3c4a6d16b1d7b7c0243ff8898f81807e7b1fc
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_geopermission.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_geopermission.qml | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_geopermission.qml b/tests/auto/quick/qmltests/data/tst_geopermission.qml index 1d4703e95..5e5e1a321 100644 --- a/tests/auto/quick/qmltests/data/tst_geopermission.qml +++ b/tests/auto/quick/qmltests/data/tst_geopermission.qml @@ -37,7 +37,7 @@ TestWebEngineView { property bool deniedGeolocation: false property bool geoPermissionRequested: false - property string consoleErrorMessage: "" + signal consoleErrorMessage(string message) SignalSpy { id: featurePermissionSpy @@ -45,6 +45,12 @@ TestWebEngineView { signalName: "featurePermissionRequested" } + SignalSpy { + id: consoleErrorMessageSpy + target: webEngineView + signalName: "consoleErrorMessage" + } + onFeaturePermissionRequested: { if (feature === WebEngineView.Geolocation) { geoPermissionRequested = true @@ -59,7 +65,7 @@ TestWebEngineView { onJavaScriptConsoleMessage: { if (level === WebEngineView.ErrorMessageLevel) - consoleErrorMessage = message + consoleErrorMessage(message) } TestCase { @@ -68,8 +74,8 @@ TestWebEngineView { function init() { deniedGeolocation = false - consoleErrorMessage = "" featurePermissionSpy.clear() + consoleErrorMessageSpy.clear() } function test_geoPermissionRequest() { @@ -78,15 +84,16 @@ TestWebEngineView { featurePermissionSpy.wait() verify(geoPermissionRequested) compare(featurePermissionSpy.count, 1) - if (consoleErrorMessage) // Print the error message if it fails to get user's location - fail(consoleErrorMessage) + if (consoleErrorMessageSpy.count) // Print the error message if it fails to get user's location + fail(consoleErrorMessageSpy.signalArguments[0][0]) } function test_deniedGeolocationByUser() { deniedGeolocation = true webEngineView.url = Qt.resolvedUrl("geolocation.html") featurePermissionSpy.wait() - compare(consoleErrorMessage, "User denied Geolocation") + consoleErrorMessageSpy.wait() + compare(consoleErrorMessageSpy.signalArguments[0][0], "User denied Geolocation") } } } |