blob: 13c0b81a23c268b412d731e2ffb8e9b13f5441f7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that when a position is available, no callbacks are invoked until permission is denied.");
if (window.testRunner)
window.testRunner.setMockGeolocationPosition(51.478, -0.166, 100);
function denyPermission() {
permissionSet = true;
if (window.testRunner)
testRunner.setGeolocationPermission(false);
}
var error;
navigator.geolocation.getCurrentPosition(function() {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
if (permissionSet) {
error = e;
shouldBe('error.code', 'error.PERMISSION_DENIED');
shouldBe('error.message', '"User denied Geolocation"');
finishJSTest();
return;
}
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});
window.setTimeout(denyPermission, 100);
window.jsTestIsAsync = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>