| OLD | NEW |
| 1 description("Tests Geolocation when the geolocation service connection fails."); | 1 description("Tests Geolocation when the geolocation service connection fails."); |
| 2 | 2 |
| 3 if (!window.testRunner || !window.mojo) | |
| 4 debug('This test can not run without testRunner or mojo'); | |
| 5 | |
| 6 var error; | 3 var error; |
| 7 | 4 |
| 8 geolocationServiceMock.then(mock => { | 5 geolocationServiceMock.then(mock => { |
| 9 mock.setGeolocationPermission(true); | 6 mock.setGeolocationPermission(true); |
| 10 mock.rejectGeolocationConnections(); | 7 mock.rejectGeolocationConnections(); |
| 11 | 8 |
| 12 navigator.geolocation.getCurrentPosition(function(p) { | 9 navigator.geolocation.getCurrentPosition(function(p) { |
| 13 testFailed('Success callback invoked unexpectedly'); | 10 testFailed('Success callback invoked unexpectedly'); |
| 14 finishJSTest(); | 11 finishJSTest(); |
| 15 }, function(e) { | 12 }, function(e) { |
| 16 error = e; | 13 error = e; |
| 17 shouldBe('error.code', 'error.POSITION_UNAVAILABLE'); | 14 shouldBe('error.code', 'error.POSITION_UNAVAILABLE'); |
| 18 shouldBe('error.message', '"Failed to start Geolocation service"'); | 15 shouldBe('error.message', '"Failed to start Geolocation service"'); |
| 19 finishJSTest(); | 16 finishJSTest(); |
| 20 }); | 17 }); |
| 21 }); | 18 }); |
| 22 | 19 |
| 23 window.jsTestIsAsync = true; | 20 window.jsTestIsAsync = true; |
| OLD | NEW |