Home | History | Annotate | Download | only in resources
      1 description("Tests formatting of position.toString().");
      2 
      3 var mockLatitude = 51.478;
      4 var mockLongitude = -0.166;
      5 var mockAccuracy = 100.0;
      6 
      7 window.layoutTestController.setGeolocationPermission(true);
      8 window.layoutTestController.setMockGeolocationPosition(mockLatitude,
      9                                                        mockLongitude,
     10                                                        mockAccuracy);
     11 
     12 var position;
     13 navigator.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 });
     27 window.layoutTestController.waitUntilDone();
     28 
     29 var isAsynchronous = true;
     30 var successfullyParsed = true;
     31