1 description("Tests that reentrant calls to Geolocation methods from the success callback are OK.");
3 var mockLatitude = 51.478;
4 var mockLongitude = -0.166;
5 var mockAccuracy = 100.0;
7 if (!window.testRunner || !window.internals)
8 debug('This test can not run without testRunner or internals');
10 internals.setGeolocationClientMock(document);
11 internals.setGeolocationPermission(document, true);
12 internals.setGeolocationPosition(document,
18 var successCallbackInvoked = false;
19 navigator.geolocation.getCurrentPosition(function(p) {
20 if (successCallbackInvoked) {
21 testFailed('Success callback invoked unexpectedly');
24 successCallbackInvoked = true;
27 shouldBe('position.coords.latitude', 'mockLatitude');
28 shouldBe('position.coords.longitude', 'mockLongitude');
29 shouldBe('position.coords.accuracy', 'mockAccuracy');
33 testFailed('Error callback invoked unexpectedly');
37 function continueTest() {
38 internals.setGeolocationPosition(document,
43 navigator.geolocation.getCurrentPosition(function(p) {
45 shouldBe('position.coords.latitude', 'mockLatitude');
46 shouldBe('position.coords.longitude', 'mockLongitude');
47 shouldBe('position.coords.accuracy', 'mockAccuracy');
50 testFailed('Error callback invoked unexpectedly');
55 window.jsTestIsAsync = true;