| OLD | NEW |
| (Empty) |
| 1 description("Tests that when Geolocation permission is denied, watches are stopp
ed, as well as one-shots."); | |
| 2 | |
| 3 var error; | |
| 4 | |
| 5 geolocationServiceMock.then(mock => { | |
| 6 | |
| 7 // Configure the mock Geolocation service to report a position to cause perm
ission | |
| 8 // to be requested, then deny it. | |
| 9 mock.setGeolocationPermission(false); | |
| 10 mock.setGeolocationPosition(51.478, -0.166, 100.0); | |
| 11 | |
| 12 var errorCallbackInvoked = false; | |
| 13 navigator.geolocation.watchPosition(function(p) { | |
| 14 testFailed('Success callback invoked unexpectedly'); | |
| 15 finishJSTest(); | |
| 16 }, function(e) { | |
| 17 if (errorCallbackInvoked) { | |
| 18 testFailed('Error callback invoked unexpectedly : ' + error.message)
; | |
| 19 finishJSTest(); | |
| 20 } | |
| 21 errorCallbackInvoked = true; | |
| 22 | |
| 23 error = e; | |
| 24 shouldBe('error.code', 'error.PERMISSION_DENIED'); | |
| 25 shouldBe('error.message', '"User denied Geolocation"'); | |
| 26 | |
| 27 // Update the mock Geolocation service to report a new position, then | |
| 28 // yield to allow a chance for the success callback to be invoked. | |
| 29 mock.setGeolocationPosition(55.478, -0.166, 100); | |
| 30 window.setTimeout(finishJSTest, 0); | |
| 31 }); | |
| 32 }); | |
| 33 | |
| 34 window.jsTestIsAsync = true; | |
| OLD | NEW |