OLD | NEW |
1 description("Tests that when timeout value is over maximum of unsigned, the succ
ess callback is called as expected."); | 1 description("Tests that when timeout value is over maximum of unsigned, the succ
ess callback is called as expected."); |
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.internals) | 7 if (!window.testRunner || !window.mojo) |
8 debug('This test can not run without testRunner or internals'); | 8 debug('This test can not run without testRunner or mojo'); |
9 | |
10 internals.setGeolocationClientMock(document); | |
11 internals.setGeolocationPermission(document, true); | |
12 internals.setGeolocationPosition(document, | |
13 mockLatitude, | |
14 mockLongitude, | |
15 mockAccuracy); | |
16 | 9 |
17 var position; | 10 var position; |
18 navigator.geolocation.getCurrentPosition(function(p) { | 11 |
19 position = p; | 12 geolocationServiceMock.then(mock => { |
20 shouldBe('position.coords.latitude', 'mockLatitude'); | 13 mock.setGeolocationPermission(true); |
21 shouldBe('position.coords.longitude', 'mockLongitude'); | 14 mock.setGeolocationPosition(mockLatitude, |
22 shouldBe('position.coords.accuracy', 'mockAccuracy'); | 15 mockLongitude, |
23 finishJSTest(); | 16 mockAccuracy); |
24 }, function(e) { | 17 |
25 testFailed('Error callback invoked unexpectedly'); | 18 navigator.geolocation.getCurrentPosition(function(p) { |
26 finishJSTest(); | 19 position = p; |
27 }, { | 20 shouldBe('position.coords.latitude', 'mockLatitude'); |
28 timeout: 4294967296 | 21 shouldBe('position.coords.longitude', 'mockLongitude'); |
| 22 shouldBe('position.coords.accuracy', 'mockAccuracy'); |
| 23 finishJSTest(); |
| 24 }, function(e) { |
| 25 testFailed('Error callback invoked unexpectedly'); |
| 26 finishJSTest(); |
| 27 }, { |
| 28 timeout: 4294967296 |
| 29 }); |
29 }); | 30 }); |
30 | 31 |
31 window.jsTestIsAsync = true; | 32 window.jsTestIsAsync = true; |
OLD | NEW |