Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 description("Tests Geolocation error callback using the mock service."); | 1 description("Tests Geolocation when the geolocation service connection fails."); |
| 2 | 2 |
| 3 var mockMessage = "debug"; | |
| 4 | |
| 5 if (!window.testRunner || !window.mojo) | 3 if (!window.testRunner || !window.mojo) |
| 6 debug('This test can not run without testRunner or mojo'); | 4 debug('This test can not run without testRunner or mojo'); |
| 7 | 5 |
| 8 var error; | 6 var error; |
| 9 | 7 |
| 10 geolocationServiceMock.then(mock => { | 8 geolocationServiceMock.then(mock => { |
| 11 mock.setGeolocationPermission(true); | 9 mock.setGeolocationPermission(true); |
| 12 mock.setGeolocationPositionUnavailableError(mockMessage); | 10 mock.rejectGeolocationConnections(); |
| 13 | 11 |
| 14 navigator.geolocation.getCurrentPosition(function(p) { | 12 navigator.geolocation.getCurrentPosition(function(p) { |
| 15 testFailed('Success callback invoked unexpectedly'); | 13 testFailed('Success callback invoked unexpectedly'); |
| 16 finishJSTest(); | 14 finishJSTest(); |
| 17 }, function(e) { | 15 }, function(e) { |
| 18 error = e; | 16 error = e; |
| 19 shouldBe('error.code', 'error.POSITION_UNAVAILABLE'); | 17 shouldBe('error.code', 'error.POSITION_UNAVAILABLE'); |
| 20 shouldBe('error.message', 'mockMessage'); | 18 shouldBe('error.message', '"Failed to start Geolocation service"'); |
| 21 shouldBe('error.UNKNOWN_ERROR', 'undefined'); | |
| 22 shouldBe('error.PERMISSION_DENIED', '1'); | |
| 23 shouldBe('error.POSITION_UNAVAILABLE', '2'); | |
| 24 shouldBe('error.TIMEOUT', '3'); | |
|
Michael van Ouwerkerk
2016/05/11 12:38:30
Why drop the coverage for these constants?
Sam McNally
2016/05/12 07:17:20
git cl upload is detecting this as a copy of anoth
| |
| 25 finishJSTest(); | 19 finishJSTest(); |
| 26 }); | 20 }); |
| 27 }); | 21 }); |
| 28 | 22 |
| 29 window.jsTestIsAsync = true; | 23 window.jsTestIsAsync = true; |
| OLD | NEW |