| Index: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js
|
| index d4c44a347c927bde7ac5389f88d76cc8c78b79e2..8e2feb7233f61b289a90abed478d657c52423851 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js
|
| @@ -1,36 +1,37 @@
|
| description("Tests that when Geolocation permission is denied, watches are stopped, as well as one-shots.");
|
|
|
| -if (!window.testRunner || !window.internals)
|
| - debug('This test can not run without testRunner or internals');
|
| -
|
| -internals.setGeolocationClientMock(document);
|
| -
|
| -// Configure the mock Geolocation service to report a position to cause permission
|
| -// to be requested, then deny it.
|
| -internals.setGeolocationPermission(document, false);
|
| -internals.setGeolocationPosition(document, 51.478, -0.166, 100.0);
|
| +if (!window.testRunner || !window.mojo)
|
| + debug('This test can not run without testRunner or mojo');
|
|
|
| var error;
|
| -var errorCallbackInvoked = false;
|
| -navigator.geolocation.watchPosition(function(p) {
|
| - testFailed('Success callback invoked unexpectedly');
|
| - finishJSTest();
|
| -}, function(e) {
|
| - if (errorCallbackInvoked) {
|
| - testFailed('Error callback invoked unexpectedly : ' + error.message);
|
| - finishJSTest();
|
| - }
|
| - errorCallbackInvoked = true;
|
|
|
| - error = e;
|
| - shouldBe('error.code', 'error.PERMISSION_DENIED');
|
| - shouldBe('error.message', '"User denied Geolocation"');
|
| +geolocationServiceMock.then(mock => {
|
|
|
| - // Update the mock Geolocation service to report a new position, then
|
| - // yield to allow a chance for the success callback to be invoked.
|
| - internals.setGeolocationPosition(document, 55.478, -0.166, 100);
|
| - window.setTimeout(finishJSTest, 0);
|
| -});
|
| + // Configure the mock Geolocation service to report a position to cause permission
|
| + // to be requested, then deny it.
|
| + mock.setGeolocationPermission(false);
|
| + mock.setGeolocationPosition(51.478, -0.166, 100.0);
|
|
|
| + var errorCallbackInvoked = false;
|
| + navigator.geolocation.watchPosition(function(p) {
|
| + testFailed('Success callback invoked unexpectedly');
|
| + finishJSTest();
|
| + }, function(e) {
|
| + if (errorCallbackInvoked) {
|
| + testFailed('Error callback invoked unexpectedly : ' + error.message);
|
| + finishJSTest();
|
| + }
|
| + errorCallbackInvoked = true;
|
| +
|
| + error = e;
|
| + shouldBe('error.code', 'error.PERMISSION_DENIED');
|
| + shouldBe('error.message', '"User denied Geolocation"');
|
| +
|
| + // Update the mock Geolocation service to report a new position, then
|
| + // yield to allow a chance for the success callback to be invoked.
|
| + mock.setGeolocationPosition(55.478, -0.166, 100);
|
| + window.setTimeout(finishJSTest, 0);
|
| + });
|
| +});
|
|
|
| window.jsTestIsAsync = true;
|
|
|