| OLD | NEW |
| 1 description("Tests that when Geolocation permission has been denied prior to a c
all to a Geolocation method, the error callback is invoked with code PERMISSION_
DENIED, when the Geolocation service has a good position."); | 1 description("Tests that when Geolocation permission has been denied prior to a c
all to a Geolocation method, the error callback is invoked with code PERMISSION_
DENIED, when the Geolocation service has a good position."); |
| 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 // Prime the Geolocation instance by denying permission. | 7 // Prime the Geolocation instance by denying permission. |
| 11 mock.setGeolocationPermission(false); | 8 mock.setGeolocationPermission(false); |
| 12 mock.setGeolocationPosition(51.478, -0.166, 100); | 9 mock.setGeolocationPosition(51.478, -0.166, 100); |
| 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'); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 31 }, function(e) { | 28 }, function(e) { |
| 32 error = e; | 29 error = e; |
| 33 shouldBe('error.code', 'error.PERMISSION_DENIED'); | 30 shouldBe('error.code', 'error.PERMISSION_DENIED'); |
| 34 shouldBe('error.message', '"User denied Geolocation"'); | 31 shouldBe('error.message', '"User denied Geolocation"'); |
| 35 finishJSTest(); | 32 finishJSTest(); |
| 36 }); | 33 }); |
| 37 } | 34 } |
| 38 }); | 35 }); |
| 39 | 36 |
| 40 window.jsTestIsAsync = true; | 37 window.jsTestIsAsync = true; |
| OLD | NEW |