Home | History | Annotate | Download | only in resources
      1 description("Tests Geolocation success callback using the mock service.");
      2 
      3 var mockLatitude = 51.478;
      4 var mockLongitude = -0.166;
      5 var mockAccuracy = 100;
      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     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 window.layoutTestController.waitUntilDone();
     25 
     26 var isAsynchronous = true;
     27 var successfullyParsed = true;
     28