Index: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js |
index a2b0cbde54af831ee25d8aabb4da58ce15477ab7..63ec68946a08a3057e558c88828bc3424be8a23b 100644 |
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js |
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied-for-multiple-requests.js |
@@ -1,58 +1,60 @@ |
description("Tests that when multiple requests are waiting for permission, no callbacks are invoked until permission is denied."); |
-if (!window.testRunner || !window.internals) |
- debug('This test can not run without testRunner or internals'); |
+if (!window.testRunner || !window.mojo) |
+ debug('This test can not run without testRunner or mojo'); |
-internals.setGeolocationClientMock(document); |
-internals.setGeolocationPosition(document, 51.478, -0.166, 100); |
- |
-var permissionSet = false; |
+var error; |
-function denyPermission() { |
- permissionSet = true; |
- internals.setGeolocationPermission(document, false); |
-} |
+geolocationServiceMock.then(mock => { |
+ mock.setGeolocationPosition(51.478, -0.166, 100); |
-var watchCallbackInvoked = false; |
-var oneShotCallbackInvoked = false; |
-var error; |
+ var permissionSet = false; |
-navigator.geolocation.watchPosition(function() { |
- testFailed('Success callback invoked unexpectedly'); |
- finishJSTest(); |
-}, function(e) { |
- if (permissionSet) { |
- error = e; |
- shouldBe('error.code', 'error.PERMISSION_DENIED'); |
- shouldBe('error.message', '"User denied Geolocation"'); |
- watchCallbackInvoked = true; |
- maybeFinishTest(); |
- return; |
+ function denyPermission() { |
+ permissionSet = true; |
+ mock.setGeolocationPermission(false); |
} |
- testFailed('Error callback invoked unexpectedly'); |
- finishJSTest(); |
-}); |
-navigator.geolocation.getCurrentPosition(function() { |
- testFailed('Success callback invoked unexpectedly'); |
- finishJSTest(); |
-}, function(e) { |
- if (permissionSet) { |
- error = e; |
- shouldBe('error.code', 'error.PERMISSION_DENIED'); |
- shouldBe('error.message', '"User denied Geolocation"'); |
- oneShotCallbackInvoked = true; |
- maybeFinishTest(); |
- return; |
- } |
- testFailed('Error callback invoked unexpectedly'); |
- finishJSTest(); |
-}); |
-window.setTimeout(denyPermission, 100); |
+ var watchCallbackInvoked = false; |
+ var oneShotCallbackInvoked = false; |
-function maybeFinishTest() { |
- if (watchCallbackInvoked && oneShotCallbackInvoked) |
+ navigator.geolocation.watchPosition(function() { |
+ testFailed('Success callback invoked unexpectedly'); |
+ finishJSTest(); |
+ }, function(e) { |
+ if (permissionSet) { |
+ error = e; |
+ shouldBe('error.code', 'error.PERMISSION_DENIED'); |
+ shouldBe('error.message', '"User denied Geolocation"'); |
+ watchCallbackInvoked = true; |
+ maybeFinishTest(); |
+ return; |
+ } |
+ testFailed('Error callback invoked unexpectedly'); |
finishJSTest(); |
-} |
+ }); |
+ |
+ navigator.geolocation.getCurrentPosition(function() { |
+ testFailed('Success callback invoked unexpectedly'); |
+ finishJSTest(); |
+ }, function(e) { |
+ if (permissionSet) { |
+ error = e; |
+ shouldBe('error.code', 'error.PERMISSION_DENIED'); |
+ shouldBe('error.message', '"User denied Geolocation"'); |
+ oneShotCallbackInvoked = true; |
+ maybeFinishTest(); |
+ return; |
+ } |
+ testFailed('Error callback invoked unexpectedly'); |
+ finishJSTest(); |
+ }); |
+ window.setTimeout(denyPermission, 100); |
+ |
+ function maybeFinishTest() { |
+ if (watchCallbackInvoked && oneShotCallbackInvoked) |
+ finishJSTest(); |
+ } |
+}); |
window.jsTestIsAsync = true; |