| 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.internals) | 3 if (!window.testRunner || !window.mojo) |
| 4 debug('This test can not run without testRunner or internals'); | 4 debug('This test can not run without testRunner or mojo'); |
| 5 | |
| 6 internals.setGeolocationClientMock(document); | |
| 7 | |
| 8 internals.setGeolocationPermission(document, false); | |
| 9 internals.setGeolocationPosition(document, 51.478, -0.166, 100.0); | |
| 10 | 5 |
| 11 var error; | 6 var error; |
| 12 navigator.geolocation.getCurrentPosition(function(p) { | 7 |
| 13 testFailed('Success callback invoked unexpectedly'); | 8 geolocationServiceMock.then(mock => { |
| 14 finishJSTest(); | 9 |
| 15 }, function(e) { | 10 mock.setGeolocationPermission(false); |
| 16 error = e; | 11 mock.setGeolocationPosition(51.478, -0.166, 100.0); |
| 17 shouldBe('error.code', 'error.PERMISSION_DENIED'); | 12 |
| 18 shouldBe('error.message', '"User denied Geolocation"'); | 13 navigator.geolocation.getCurrentPosition(function(p) { |
| 19 finishJSTest(); | 14 testFailed('Success callback invoked unexpectedly'); |
| 15 finishJSTest(); |
| 16 }, function(e) { |
| 17 error = e; |
| 18 shouldBe('error.code', 'error.PERMISSION_DENIED'); |
| 19 shouldBe('error.message', '"User denied Geolocation"'); |
| 20 finishJSTest(); |
| 21 }); |
| 20 }); | 22 }); |
| 21 | 23 |
| 22 window.jsTestIsAsync = true; | 24 window.jsTestIsAsync = true; |
| OLD | NEW |