| OLD | NEW |
| 1 description("Tests that Geolocation correctly handles multiple concurrent reques
ts."); | 1 description("Tests that Geolocation correctly handles multiple concurrent reques
ts."); |
| 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; | 5 var mockAccuracy = 100; |
| 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 var watchCallbackInvoked = false; | 8 var watchCallbackInvoked = false; |
| 12 var oneShotCallbackInvoked = false; | 9 var oneShotCallbackInvoked = false; |
| 13 | 10 |
| 14 geolocationServiceMock.then(mock => { | 11 geolocationServiceMock.then(mock => { |
| 15 mock.setGeolocationPermission(true); | 12 mock.setGeolocationPermission(true); |
| 16 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); | 13 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); |
| 17 | 14 |
| 18 navigator.geolocation.watchPosition(function(p) { | 15 navigator.geolocation.watchPosition(function(p) { |
| 19 shouldBeFalse('watchCallbackInvoked'); | 16 shouldBeFalse('watchCallbackInvoked'); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 37 position = p; | 34 position = p; |
| 38 shouldBe('position.coords.latitude', 'mockLatitude'); | 35 shouldBe('position.coords.latitude', 'mockLatitude'); |
| 39 shouldBe('position.coords.longitude', 'mockLongitude'); | 36 shouldBe('position.coords.longitude', 'mockLongitude'); |
| 40 shouldBe('position.coords.accuracy', 'mockAccuracy'); | 37 shouldBe('position.coords.accuracy', 'mockAccuracy'); |
| 41 if (watchCallbackInvoked && oneShotCallbackInvoked) | 38 if (watchCallbackInvoked && oneShotCallbackInvoked) |
| 42 finishJSTest(); | 39 finishJSTest(); |
| 43 } | 40 } |
| 44 }); | 41 }); |
| 45 | 42 |
| 46 window.jsTestIsAsync = true; | 43 window.jsTestIsAsync = true; |
| OLD | NEW |