| OLD | NEW |
| (Empty) |
| 1 description("Tests that reentrant calls to Geolocation methods from the error ca
llback due to a PERMISSION_DENIED error are OK."); | |
| 2 | |
| 3 var error; | |
| 4 | |
| 5 geolocationServiceMock.then(mock => { | |
| 6 mock.setGeolocationPermission(false); | |
| 7 mock.setGeolocationPosition(51.478, -0.166, 100.0); | |
| 8 | |
| 9 function checkPermissionError(e) { | |
| 10 error = e; | |
| 11 shouldBe('error.code', 'error.PERMISSION_DENIED'); | |
| 12 shouldBe('error.message', '"User denied Geolocation"'); | |
| 13 } | |
| 14 | |
| 15 var errorCallbackInvoked = false; | |
| 16 navigator.geolocation.getCurrentPosition(function(p) { | |
| 17 testFailed('Success callback invoked unexpectedly'); | |
| 18 finishJSTest(); | |
| 19 }, function(e) { | |
| 20 if (errorCallbackInvoked) { | |
| 21 testFailed('Error callback invoked unexpectedly'); | |
| 22 finishJSTest(); | |
| 23 } | |
| 24 errorCallbackInvoked = true; | |
| 25 checkPermissionError(e); | |
| 26 continueTest(); | |
| 27 }); | |
| 28 | |
| 29 function continueTest() { | |
| 30 navigator.geolocation.getCurrentPosition(function(p) { | |
| 31 testFailed('Success callback invoked unexpectedly'); | |
| 32 finishJSTest(); | |
| 33 }, function(e) { | |
| 34 checkPermissionError(e); | |
| 35 finishJSTest(); | |
| 36 }); | |
| 37 } | |
| 38 }); | |
| 39 | |
| 40 window.jsTestIsAsync = true; | |
| OLD | NEW |