| Index: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js
|
| index e19e79c11b8e5206d5c09120922ad25a4a0231ee..a37a6e8165112a3e579a48696edcd0d23e2dc1a7 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed-for-multiple-requests.js
|
| @@ -1,54 +1,55 @@
|
| description("Tests that when multiple requests are waiting for permission, no callbacks are invoked until permission is allowed.");
|
|
|
| -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);
|
| +geolocationServiceMock.then(mock => {
|
| + mock.setGeolocationPosition(51.478, -0.166, 100);
|
|
|
| -var permissionSet = false;
|
| + var permissionSet = false;
|
|
|
| -function allowPermission() {
|
| - permissionSet = true;
|
| - internals.setGeolocationPermission(document, true);
|
| -}
|
| + function allowPermission() {
|
| + permissionSet = true;
|
| + mock.setGeolocationPermission(true);
|
| + }
|
|
|
| -var watchCallbackInvoked = false;
|
| -var oneShotCallbackInvoked = false;
|
| + var watchCallbackInvoked = false;
|
| + var oneShotCallbackInvoked = false;
|
| +
|
| + navigator.geolocation.watchPosition(function() {
|
| + if (permissionSet) {
|
| + testPassed('Success callback invoked');
|
| + watchCallbackInvoked = true;
|
| + maybeFinishTest();
|
| + return;
|
| + }
|
| + testFailed('Success callback invoked unexpectedly');
|
| + finishJSTest();
|
| + }, function(err) {
|
| + testFailed('Error callback invoked unexpectedly');
|
| + finishJSTest();
|
| + });
|
| +
|
| + navigator.geolocation.getCurrentPosition(function() {
|
| + if (permissionSet) {
|
| + testPassed('Success callback invoked');
|
| + oneShotCallbackInvoked = true;
|
| + maybeFinishTest();
|
| + return;
|
| + }
|
| + testFailed('Success callback invoked unexpectedly');
|
| + finishJSTest();
|
| + }, function(err) {
|
| + testFailed('Error callback invoked unexpectedly');
|
| + finishJSTest();
|
| + });
|
|
|
| -navigator.geolocation.watchPosition(function() {
|
| - if (permissionSet) {
|
| - testPassed('Success callback invoked');
|
| - watchCallbackInvoked = true;
|
| - maybeFinishTest();
|
| - return;
|
| - }
|
| - testFailed('Success callback invoked unexpectedly');
|
| - finishJSTest();
|
| -}, function(err) {
|
| - testFailed('Error callback invoked unexpectedly');
|
| - finishJSTest();
|
| -});
|
| + window.setTimeout(allowPermission, 100);
|
|
|
| -navigator.geolocation.getCurrentPosition(function() {
|
| - if (permissionSet) {
|
| - testPassed('Success callback invoked');
|
| - oneShotCallbackInvoked = true;
|
| - maybeFinishTest();
|
| - return;
|
| + function maybeFinishTest() {
|
| + if (watchCallbackInvoked && oneShotCallbackInvoked)
|
| + finishJSTest();
|
| }
|
| - testFailed('Success callback invoked unexpectedly');
|
| - finishJSTest();
|
| -}, function(err) {
|
| - testFailed('Error callback invoked unexpectedly');
|
| - finishJSTest();
|
| });
|
|
|
| -window.setTimeout(allowPermission, 100);
|
| -
|
| -function maybeFinishTest() {
|
| - if (watchCallbackInvoked && oneShotCallbackInvoked)
|
| - finishJSTest();
|
| -}
|
| -
|
| window.jsTestIsAsync = true;
|
|
|