1 description("Tests that when multiple requests are waiting for permission, 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() {
13 internals
.setGeolocationPermission(document
, true);
16 var watchCallbackInvoked
= false;
17 var oneShotCallbackInvoked
= false;
19 navigator
.geolocation
.watchPosition(function() {
21 testPassed('Success callback invoked');
22 watchCallbackInvoked
= true;
26 testFailed('Success callback invoked unexpectedly');
29 testFailed('Error callback invoked unexpectedly');
33 navigator
.geolocation
.getCurrentPosition(function() {
35 testPassed('Success callback invoked');
36 oneShotCallbackInvoked
= true;
40 testFailed('Success callback invoked unexpectedly');
43 testFailed('Error callback invoked unexpectedly');
47 window
.setTimeout(allowPermission
, 100);
49 function maybeFinishTest() {
50 if (watchCallbackInvoked
&& oneShotCallbackInvoked
)
54 window
.jsTestIsAsync
= true;