|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=716127 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for getCurrentPosition </title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="geolocation_common.js"></script> |
|
10 |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716127">Mozilla Bug 716127</a> |
|
15 <p id="display"></p> |
|
16 <div id="content" style="display: none"> |
|
17 |
|
18 </div> |
|
19 <pre id="test"> |
|
20 <script class="testbody" type="text/javascript"> |
|
21 |
|
22 SimpleTest.waitForExplicitFinish(); |
|
23 |
|
24 resume_geolocationProvider(function() { |
|
25 force_prompt(true, test1); |
|
26 }); |
|
27 |
|
28 function successCallback(position) { |
|
29 check_geolocation(position); |
|
30 |
|
31 SpecialPowers.pushPrefEnv({'set': [['geo.timeout', 100]]}, function() { |
|
32 delay_geolocationProvider(1000, function() { |
|
33 force_prompt(true, function() { |
|
34 navigator.geolocation.getCurrentPosition(success2, handle_error, {maximumAge: 0}); |
|
35 }); |
|
36 }); |
|
37 |
|
38 }); |
|
39 } |
|
40 |
|
41 function errorCallback() { |
|
42 ok(false, "unexpected error"); |
|
43 SimpleTest.finish(); |
|
44 } |
|
45 |
|
46 function test1() { |
|
47 navigator.geolocation.getCurrentPosition(successCallback, errorCallback); |
|
48 } |
|
49 |
|
50 function success2(position) { |
|
51 check_geolocation(position); |
|
52 SimpleTest.finish(); |
|
53 } |
|
54 |
|
55 function handle_error() { |
|
56 ok(false, "geolocation provider should not have timed out"); |
|
57 SimpleTest.finish(); |
|
58 } |
|
59 </script> |
|
60 </pre> |
|
61 </body> |
|
62 </html> |
|
63 |