| OLD | NEW |
| 1 description("Tests Geolocation when permission is denied, using the mock service
."); | 1 description("Tests Geolocation when permission is denied, using the mock service
."); |
| 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 | 6 |
| 10 mock.setGeolocationPermission(false); | 7 mock.setGeolocationPermission(false); |
| 11 mock.setGeolocationPosition(51.478, -0.166, 100.0); | 8 mock.setGeolocationPosition(51.478, -0.166, 100.0); |
| 12 | 9 |
| 13 navigator.geolocation.getCurrentPosition(function(p) { | 10 navigator.geolocation.getCurrentPosition(function(p) { |
| 14 testFailed('Success callback invoked unexpectedly'); | 11 testFailed('Success callback invoked unexpectedly'); |
| 15 finishJSTest(); | 12 finishJSTest(); |
| 16 }, function(e) { | 13 }, function(e) { |
| 17 error = e; | 14 error = e; |
| 18 shouldBe('error.code', 'error.PERMISSION_DENIED'); | 15 shouldBe('error.code', 'error.PERMISSION_DENIED'); |
| 19 shouldBe('error.message', '"User denied Geolocation"'); | 16 shouldBe('error.message', '"User denied Geolocation"'); |
| 20 finishJSTest(); | 17 finishJSTest(); |
| 21 }); | 18 }); |
| 22 }); | 19 }); |
| 23 | 20 |
| 24 window.jsTestIsAsync = true; | 21 window.jsTestIsAsync = true; |
| OLD | NEW |