Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 1 | <!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 |
| 14 | var t = async_test('User denies access, check that error callback is called with correct code'), |
| 15 | onSuccess, onError, hasMethodReturned = false; |
| 16 | |
| 17 | t.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 | |