1description("Tests Geolocation error callback using the mock service.");
2
3var mockCode = 2;
4var mockMessage = "debug";
5
6if (window.layoutTestController) {
7    layoutTestController.setGeolocationPermission(true);
8    layoutTestController.setMockGeolocationError(mockCode, mockMessage);
9} else
10    debug('This test can not be run without the LayoutTestController');
11
12var error;
13navigator.geolocation.getCurrentPosition(function(p) {
14    testFailed('Success callback invoked unexpectedly');
15    finishJSTest();
16}, function(e) {
17    error = e;
18    shouldBe('error.code', 'mockCode');
19    shouldBe('error.message', 'mockMessage');
20    shouldBe('error.UNKNOWN_ERROR', 'undefined');
21    shouldBe('error.PERMISSION_DENIED', '1');
22    shouldBe('error.POSITION_UNAVAILABLE', '2');
23    shouldBe('error.TIMEOUT', '3');
24    finishJSTest();
25});
26
27window.jsTestIsAsync = true;
28window.successfullyParsed = true;
29