blob: 7017e014dfcf85ca11e2d376ee636c5f178fa7ad [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
<script src="file:///gen/device/geolocation/public/interfaces/geolocation.mojom.js"></script>
<script src="file:///gen/third_party/WebKit/public/platform/modules/permissions/permission.mojom.js"></script>
<script src="resources/geolocation-mock.js"></script>
</head>
<body>
<script>
description("Tests Geolocation error callback using the mock service.");
var mockMessage = "debug";
var error;
let mock = geolocationMock;
mock.setGeolocationPermission(true);
mock.setGeolocationPositionUnavailableError(mockMessage);
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
error = e;
shouldBe('error.code', 'error.POSITION_UNAVAILABLE');
shouldBe('error.message', 'mockMessage');
shouldBe('error.UNKNOWN_ERROR', 'undefined');
shouldBe('error.PERMISSION_DENIED', '1');
shouldBe('error.POSITION_UNAVAILABLE', '2');
shouldBe('error.TIMEOUT', '3');
finishJSTest();
});
window.jsTestIsAsync = true;
</script>
</body>
</html>