Home | History | Annotate | Download | only in resources
      1 description("Tests that when an exception is thrown in the success callback, the error callback is not invoked. Note that this test throws an exception which is not caught.");
      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 
     19     // Yield to allow for the error callback to be invoked. The timer
     20     // must be started before the exception is thrown.
     21     window.setTimeout(completeTest, 0);
     22     throw new Error('Exception in success callback');
     23 }, function(e) {
     24     testFailed('Error callback invoked unexpectedly');
     25     window.layoutTestController.notifyDone();
     26 });
     27 
     28 function completeTest()
     29 {
     30     debug('<br /><span class="pass">TEST COMPLETE</span>');
     31     window.layoutTestController.notifyDone();
     32 }
     33 window.layoutTestController.waitUntilDone();
     34 
     35 var isAsynchronous = true;
     36 var successfullyParsed = true;
     37