1description("Tests that when a position is available, no callbacks are invoked until permission is allowed."); 2 3if (window.layoutTestController) 4 window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100); 5 6function allowPermission() { 7 permissionSet = true; 8 if (window.layoutTestController) 9 layoutTestController.setGeolocationPermission(true); 10} 11 12navigator.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}); 24window.setTimeout(allowPermission, 100); 25 26window.jsTestIsAsync = true; 27window.successfullyParsed = true; 28