| 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 encounters an error."); | 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 encounters an error."); |
| 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(false); | 6 mock.setGeolocationPermission(false); |
| 10 mock.setGeolocationPosition(51.478, -0.166, 100); | 7 mock.setGeolocationPosition(51.478, -0.166, 100); |
| 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) { |
| (...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 |