1description("Tests that when timeout is non-zero, the success callback is called as expected.");
2
3var mockLatitude = 51.478;
4var mockLongitude = -0.166;
5var mockAccuracy = 100.0;
6
7if (window.layoutTestController) {
8    layoutTestController.setGeolocationPermission(true);
9    layoutTestController.setMockGeolocationPosition(mockLatitude,
10                                                    mockLongitude,
11                                                    mockAccuracy);
12} else
13    debug('This test can not be run without the LayoutTestController');
14
15var position;
16navigator.geolocation.getCurrentPosition(function(p) {
17    position = p;
18    shouldBe('position.coords.latitude', 'mockLatitude');
19    shouldBe('position.coords.longitude', 'mockLongitude');
20    shouldBe('position.coords.accuracy', 'mockAccuracy');
21    finishJSTest();
22}, function(e) {
23    testFailed('Error callback invoked unexpectedly');
24    finishJSTest();
25}, {
26    timeout: 1000
27});
28
29window.jsTestIsAsync = true;
30window.successfullyParsed = true;
31