blob: 17143e18a71e98ed203db98a64f97c55dd0d72f6 [file] [log] [blame]
[email protected]9349c562010-08-04 11:13:201<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
tkentc5e88f02017-02-06 22:47:314<script src="../resources/js-test.js"></script>
Reilly Grantbe310ab2017-07-11 01:51:265<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
6<script src="file:///gen/device/geolocation/public/interfaces/geolocation.mojom.js"></script>
7<script src="file:///gen/third_party/WebKit/public/platform/modules/permissions/permission.mojom.js"></script>
sammce6687802016-05-13 04:06:578<script src="resources/geolocation-mock.js"></script>
[email protected]9349c562010-08-04 11:13:209</head>
10<body>
tkent98122ee2017-02-02 07:38:5111<script>
12description("Tests that when a position is available, no callbacks are invoked until permission is allowed.");
13
Reilly Grantbe310ab2017-07-11 01:51:2614let mock = geolocationMock;
15mock.setGeolocationPosition(51.478, -0.166, 100);
tkent98122ee2017-02-02 07:38:5116
Reilly Grantbe310ab2017-07-11 01:51:2617var permissionSet = false;
tkent98122ee2017-02-02 07:38:5118
Reilly Grantbe310ab2017-07-11 01:51:2619function allowPermission() {
20 permissionSet = true;
21 mock.setGeolocationPermission(true);
22}
23
24navigator.geolocation.getCurrentPosition(function() {
25 if (permissionSet) {
26 testPassed('Success callback invoked');
27 finishJSTest();
28 return;
tkent98122ee2017-02-02 07:38:5129 }
Reilly Grantbe310ab2017-07-11 01:51:2630 testFailed('Success callback invoked unexpectedly');
31 finishJSTest();
32}, function() {
33 testFailed('Error callback invoked unexpectedly');
34 finishJSTest();
tkent98122ee2017-02-02 07:38:5135});
Reilly Grantbe310ab2017-07-11 01:51:2636window.setTimeout(allowPermission, 100);
tkent98122ee2017-02-02 07:38:5137
38window.jsTestIsAsync = true;
39</script>
[email protected]9349c562010-08-04 11:13:2040</body>
41</html>