blob: e3361de158cfa3181c790b146adc260d25969f4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
description("Tests that reentrant calls to Geolocation methods from the error callback are OK.");
var mockCode = 0;
var mockMessage = 'test';
window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
var error;
var errorCallbackInvoked = false;
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
if (errorCallbackInvoked) {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
}
errorCallbackInvoked = true;
error = e;
shouldBe('error.code', 'mockCode');
shouldBe('error.message', 'mockMessage');
debug('');
continueTest();
});
function continueTest() {
mockCode += 1;
mockMessage += ' repeat';
window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
error = e;
shouldBe('error.code', 'mockCode');
shouldBe('error.message', 'mockMessage');
finishJSTest();
});
}
window.layoutTestController.waitUntilDone();
window.jsTestIsAsync = true;
window.successfullyParsed = true;
|