success.js revision e78cbe89e6f337f2f1fe40315be88f742b547151
1description("Tests Geolocation success callback using the mock service.");
2
3var mockLatitude = 51.478;
4var mockLongitude = -0.166;
5var mockAccuracy = 100;
6
7window.layoutTestController.setGeolocationPermission(true);
8window.layoutTestController.setMockGeolocationPosition(mockLatitude,
9                                                       mockLongitude,
10                                                       mockAccuracy);
11
12var position;
13navigator.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    finishJSTest();
19}, function(e) {
20    testFailed('Error callback invoked unexpectedly');
21    finishJSTest();
22});
23window.layoutTestController.waitUntilDone();
24
25window.jsTestIsAsync = true;
26window.successfullyParsed = true;
27