diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-03-11 10:25:38 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-03-11 10:25:38 +0000 |
commit | c305cc06c74cb95ef2ddfacee0ede1d82e3dbb3c (patch) | |
tree | e09e2ccbc9bda8f46737c89e8b2297061d6daade /tests/auto/quick/qmltests/data/tst_geopermission.qml | |
parent | f658dcb0893e7869cc0c029bfe0be82838af4bb8 (diff) | |
parent | ccf12049b662fe1b03b5b0ea199d29b32f072eda (diff) |
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
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") } } } |