Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Geolocation / script-tests / delayed-permission-allowed.js
blob02c6e88921aafa3b94e34f1a2f43b27326ad4e9d
1 description("Tests that when a position is available, no callbacks are invoked until permission is allowed.");
3 if (!window.testRunner || !window.internals)
4 debug('This test can not run without testRunner or internals');
6 internals.setGeolocationClientMock(document);
7 internals.setGeolocationPosition(document, 51.478, -0.166, 100);
9 var permissionSet = false;
11 function allowPermission() {
12 permissionSet = true;
13 internals.setGeolocationPermission(document, true);
16 navigator.geolocation.getCurrentPosition(function() {
17 if (permissionSet) {
18 testPassed('Success callback invoked');
19 finishJSTest();
20 return;
22 testFailed('Success callback invoked unexpectedly');
23 finishJSTest();
24 }, function() {
25 testFailed('Error callback invoked unexpectedly');
26 finishJSTest();
27 });
28 window.setTimeout(allowPermission, 100);
30 window.jsTestIsAsync = true;