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.");
3 var mockLatitude = 51.478;
4 var mockLongitude = -0.166;
5 var mockAccuracy = 100;
7 if (!window.testRunner || !window.internals)
8 debug('This test can not run without testRunner or internals');
10 internals.setGeolocationClientMock(document);
11 internals.setGeolocationPermission(document, true);
12 internals.setGeolocationPosition(document,
18 navigator.geolocation.getCurrentPosition(function(p) {
20 shouldBe('position.coords.latitude', 'mockLatitude');
21 shouldBe('position.coords.longitude', 'mockLongitude');
22 shouldBe('position.coords.accuracy', 'mockAccuracy');
24 // Yield to allow for the error callback to be invoked. The timer
25 // must be started before the exception is thrown.
26 window.setTimeout(assertWeGotException, 0);
28 throw new Error('Exception in success callback');
30 testFailed('Error callback invoked unexpectedly');
34 function assertWeGotException()
40 window.jsTestIsAsync = true;