| OLD | NEW |
| 1 description("Tests that reentrant calls to Geolocation methods from the success
callback are OK."); | 1 description("Tests that reentrant calls to Geolocation methods from the success
callback are OK."); |
| 2 | 2 |
| 3 var mockLatitude = 51.478; | 3 var mockLatitude = 51.478; |
| 4 var mockLongitude = -0.166; | 4 var mockLongitude = -0.166; |
| 5 var mockAccuracy = 100.0; | 5 var mockAccuracy = 100.0; |
| 6 | 6 |
| 7 if (!window.testRunner || !window.mojo) | |
| 8 debug('This test can not run without testRunner or mojo'); | |
| 9 | |
| 10 var position; | 7 var position; |
| 11 | 8 |
| 12 geolocationServiceMock.then(mock => { | 9 geolocationServiceMock.then(mock => { |
| 13 mock.setGeolocationPermission(true); | 10 mock.setGeolocationPermission(true); |
| 14 mock.setGeolocationPosition(mockLatitude, | 11 mock.setGeolocationPosition(mockLatitude, |
| 15 mockLongitude, | 12 mockLongitude, |
| 16 mockAccuracy); | 13 mockAccuracy); |
| 17 | 14 |
| 18 var successCallbackInvoked = false; | 15 var successCallbackInvoked = false; |
| 19 navigator.geolocation.getCurrentPosition(function(p) { | 16 navigator.geolocation.getCurrentPosition(function(p) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 46 shouldBe('position.coords.accuracy', 'mockAccuracy'); | 43 shouldBe('position.coords.accuracy', 'mockAccuracy'); |
| 47 finishJSTest(); | 44 finishJSTest(); |
| 48 }, function(e) { | 45 }, function(e) { |
| 49 testFailed('Error callback invoked unexpectedly'); | 46 testFailed('Error callback invoked unexpectedly'); |
| 50 finishJSTest(); | 47 finishJSTest(); |
| 51 }); | 48 }); |
| 52 } | 49 } |
| 53 }); | 50 }); |
| 54 | 51 |
| 55 window.jsTestIsAsync = true; | 52 window.jsTestIsAsync = true; |
| OLD | NEW |