diff options
Diffstat (limited to 'LayoutTests/fast/dom/Geolocation/script-tests/timeout.js')
-rw-r--r-- | LayoutTests/fast/dom/Geolocation/script-tests/timeout.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js new file mode 100644 index 0000000..49cab29 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout.js @@ -0,0 +1,28 @@ +description("Tests that when timeout is non-zero, the success callback is called as expected."); + +var mockLatitude = 51.478; +var mockLongitude = -0.166; +var mockAccuracy = 100.0; + +window.layoutTestController.setGeolocationPermission(true); +window.layoutTestController.setMockGeolocationPosition(mockLatitude, + mockLongitude, + mockAccuracy); + +var position; +navigator.geolocation.getCurrentPosition(function(p) { + position = p; + shouldBe('position.coords.latitude', 'mockLatitude'); + shouldBe('position.coords.longitude', 'mockLongitude'); + shouldBe('position.coords.accuracy', 'mockAccuracy'); + finishJSTest(); +}, function(e) { + testFailed('Error callback invoked unexpectedly'); + finishJSTest(); +}, { + timeout: 1000 +}); +window.layoutTestController.waitUntilDone(); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; |