blob: 26fe8899eda0ca2139a98a3b3c469447dcf9e337 [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001<!DOCTYPE HTML>
2<meta charset='utf-8'>
3<title>Geolocation Test: getCurrentPosition location access denied</title>
4<link rel='help' href='http://www.w3.org/TR/geolocation-API/#privacy_for_uas'>
5<script src='/resources/testharness.js'></script>
6<script src='/resources/testharnessreport.js'></script>
7<script src='support.js'></script>
8
9<p>Clear all Geolocation permissions before running this test. If prompted for permission, please deny.</p>
10<div id='log'></div>
11
12<script>
13// Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00001
14var t = async_test('User denies access, check that error callback is called with correct code'),
15 onSuccess, onError, hasMethodReturned = false;
16
17t.step(function() {
18 onSuccess = t.step_func(function(pos) {
19 assert_unreached('A success callback was invoked unexpectedly with position ' + positionToString(pos));
20 });
21
22 onError = t.step_func(function(err) {
23 // http://dev.w3.org/geo/api/test-suite/t.html?00031
24 assert_true(hasMethodReturned, 'Check that getCurrentPosition returns synchronously before any callbacks are invoked');
25 assert_equals(err.code, err.PERMISSION_DENIED,
26 'PossitionError code: ' + err.code, + ', message: ' + err.message);
27 done();
28 });
29
30 geo.getCurrentPosition(onSuccess, onError);
31 hasMethodReturned = true;
32});
33</script>
34