Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Geolocation / script-tests / delayed-permission-denied.js
blob13c247c051209516a7ad762e3788e0d16eee4fb1
1 description("Tests that when a position is available, no callbacks are invoked until permission is denied.");
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 denyPermission() {
12 permissionSet = true;
13 internals.setGeolocationPermission(document, false);
16 var error;
17 navigator.geolocation.getCurrentPosition(function() {
18 testFailed('Success callback invoked unexpectedly');
19 finishJSTest();
20 }, function(e) {
21 if (permissionSet) {
22 error = e;
23 shouldBe('error.code', 'error.PERMISSION_DENIED');
24 shouldBe('error.message', '"User denied Geolocation"');
25 finishJSTest();
26 return;
28 testFailed('Error callback invoked unexpectedly');
29 finishJSTest();
30 });
31 window.setTimeout(denyPermission, 100);
33 window.jsTestIsAsync = true;