• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1description("Tests formatting of position.toString().");
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    // shouldBe can't use local variables yet.
15    position = p
16    shouldBe('position.coords.latitude', 'mockLatitude');
17    shouldBe('position.coords.longitude', 'mockLongitude');
18    shouldBe('position.coords.accuracy', 'mockAccuracy');
19    shouldBe('position.toString()', '"[object Geoposition]"');
20    shouldBe('position.coords.toString()', '"[object Coordinates]"');
21    debug('<br /><span class="pass">TEST COMPLETE</span>');
22    window.layoutTestController.notifyDone();
23}, function(e) {
24    testFailed('Error callback invoked unexpectedly');
25    window.layoutTestController.notifyDone();
26});
27window.layoutTestController.waitUntilDone();
28
29var isAsynchronous = true;
30var successfullyParsed = true;
31