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