OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 <script src="../../../resources/mojo-helpers.js"></script> | 5 <script src="../resources/mojo-helpers.js"></script> |
6 <script src="resources/geolocation-mock.js"></script> | 6 <script src="resources/geolocation-mock.js"></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <script> | 9 <script> |
10 description("Tests Geolocation when permission is denied, using the mock service
."); | 10 description("Tests Geolocation when permission is denied, using the mock service
."); |
11 | 11 |
12 var error; | 12 var error; |
13 | 13 |
14 geolocationServiceMock.then(mock => { | 14 geolocationServiceMock.then(mock => { |
15 | 15 |
16 mock.setGeolocationPermission(false); | 16 mock.setGeolocationPermission(false); |
17 mock.setGeolocationPosition(51.478, -0.166, 100.0); | 17 mock.setGeolocationPosition(51.478, -0.166, 100.0); |
18 | 18 |
19 navigator.geolocation.getCurrentPosition(function(p) { | 19 navigator.geolocation.getCurrentPosition(function(p) { |
20 testFailed('Success callback invoked unexpectedly'); | 20 testFailed('Success callback invoked unexpectedly'); |
21 finishJSTest(); | 21 finishJSTest(); |
22 }, function(e) { | 22 }, function(e) { |
23 error = e; | 23 error = e; |
24 shouldBe('error.code', 'error.PERMISSION_DENIED'); | 24 shouldBe('error.code', 'error.PERMISSION_DENIED'); |
25 shouldBe('error.message', '"User denied Geolocation"'); | 25 shouldBe('error.message', '"User denied Geolocation"'); |
26 finishJSTest(); | 26 finishJSTest(); |
27 }); | 27 }); |
28 }); | 28 }); |
29 | 29 |
30 window.jsTestIsAsync = true; | 30 window.jsTestIsAsync = true; |
31 </script> | 31 </script> |
32 </body> | 32 </body> |
33 </html> | 33 </html> |
OLD | NEW |