Home | History | Annotate | Download | only in script-tests
      1 description("Tests that when a position is available, no callbacks are invoked until permission is allowed.");
      2 
      3 if (window.layoutTestController)
      4     window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
      5 
      6 function allowPermission() {
      7     permissionSet = true;
      8     if (window.layoutTestController)
      9         layoutTestController.setGeolocationPermission(true);
     10 }
     11 
     12 navigator.geolocation.getCurrentPosition(function() {
     13     if (permissionSet) {
     14         testPassed('Success callback invoked');
     15         finishJSTest();
     16         return;
     17     }
     18     testFailed('Success callback invoked unexpectedly');
     19     finishJSTest();
     20 }, function() {
     21     testFailed('Error callback invoked unexpectedly');
     22     finishJSTest();
     23 });
     24 window.setTimeout(allowPermission, 100);
     25 
     26 window.jsTestIsAsync = true;
     27 window.successfullyParsed = true;
     28