1 description("Tests Geolocation when permission is denied, using the mock service."); 2 3 if (window.layoutTestController) { 4 layoutTestController.setGeolocationPermission(false); 5 layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0); 6 } else 7 debug('This test can not be run without the LayoutTestController'); 8 9 var error; 10 navigator.geolocation.getCurrentPosition(function(p) { 11 testFailed('Success callback invoked unexpectedly'); 12 finishJSTest(); 13 }, function(e) { 14 error = e; 15 shouldBe('error.code', 'error.PERMISSION_DENIED'); 16 shouldBe('error.message', '"User denied Geolocation"'); 17 finishJSTest(); 18 }); 19 20 window.jsTestIsAsync = true; 21 window.successfullyParsed = true; 22