| OLD | NEW |
| 1 description("Tests Geolocation error callback using the mock service."); | 1 description("Tests Geolocation error callback using the mock service."); |
| 2 | 2 |
| 3 var mockMessage = "debug"; | 3 var mockMessage = "debug"; |
| 4 | 4 |
| 5 if (!window.testRunner || !window.mojo) | |
| 6 debug('This test can not run without testRunner or mojo'); | |
| 7 | |
| 8 var error; | 5 var error; |
| 9 | 6 |
| 10 geolocationServiceMock.then(mock => { | 7 geolocationServiceMock.then(mock => { |
| 11 mock.setGeolocationPermission(true); | 8 mock.setGeolocationPermission(true); |
| 12 mock.setGeolocationPositionUnavailableError(mockMessage); | 9 mock.setGeolocationPositionUnavailableError(mockMessage); |
| 13 | 10 |
| 14 navigator.geolocation.getCurrentPosition(function(p) { | 11 navigator.geolocation.getCurrentPosition(function(p) { |
| 15 testFailed('Success callback invoked unexpectedly'); | 12 testFailed('Success callback invoked unexpectedly'); |
| 16 finishJSTest(); | 13 finishJSTest(); |
| 17 }, function(e) { | 14 }, function(e) { |
| 18 error = e; | 15 error = e; |
| 19 shouldBe('error.code', 'error.POSITION_UNAVAILABLE'); | 16 shouldBe('error.code', 'error.POSITION_UNAVAILABLE'); |
| 20 shouldBe('error.message', 'mockMessage'); | 17 shouldBe('error.message', 'mockMessage'); |
| 21 shouldBe('error.UNKNOWN_ERROR', 'undefined'); | 18 shouldBe('error.UNKNOWN_ERROR', 'undefined'); |
| 22 shouldBe('error.PERMISSION_DENIED', '1'); | 19 shouldBe('error.PERMISSION_DENIED', '1'); |
| 23 shouldBe('error.POSITION_UNAVAILABLE', '2'); | 20 shouldBe('error.POSITION_UNAVAILABLE', '2'); |
| 24 shouldBe('error.TIMEOUT', '3'); | 21 shouldBe('error.TIMEOUT', '3'); |
| 25 finishJSTest(); | 22 finishJSTest(); |
| 26 }); | 23 }); |
| 27 }); | 24 }); |
| 28 | 25 |
| 29 window.jsTestIsAsync = true; | 26 window.jsTestIsAsync = true; |
| OLD | NEW |