• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7window.layoutTestController.setGeolocationPermission(true);
8window.layoutTestController.setMockGeolocationPosition(mockLatitude,
9                                                       mockLongitude,
10                                                       mockAccuracy);
11
12var position;
13navigator.geolocation.getCurrentPosition(function(p) {
14    position = p;
15    shouldBe('position.coords.latitude', 'mockLatitude');
16    shouldBe('position.coords.longitude', 'mockLongitude');
17    shouldBe('position.coords.accuracy', 'mockAccuracy');
18    debug('<br /><span class="pass">TEST COMPLETE</span>');
19    window.layoutTestController.notifyDone();
20}, function(e) {
21    testFailed('Error callback invoked unexpectedly');
22    window.layoutTestController.notifyDone();
23}, {
24    timeout: 1000
25});
26window.layoutTestController.waitUntilDone();
27
28var isAsynchronous = true;
29var successfullyParsed = true;
30