|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=482260 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for watchPosition </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=482260">Mozilla Bug 482260</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 var successCallbackCalled = 0; |
|
29 var failureCallbackCalled = 0; |
|
30 const totalResults = 100; |
|
31 |
|
32 function successCallback(position) { |
|
33 successCallbackCalled++; |
|
34 testPassed(); |
|
35 } |
|
36 |
|
37 function failureCallback(code) { |
|
38 failureCallbackCalled++; |
|
39 testPassed(); |
|
40 } |
|
41 |
|
42 function test1() { |
|
43 for (var x = 0; x < totalResults; x++) |
|
44 navigator.geolocation.watchPosition(successCallback, failureCallback); |
|
45 } |
|
46 |
|
47 function testPassed() { |
|
48 if (successCallbackCalled + failureCallbackCalled != totalResults) |
|
49 return; |
|
50 is(failureCallbackCalled, 0, "no failure callbacks should have been received"); |
|
51 SimpleTest.finish(); |
|
52 } |
|
53 |
|
54 </script> |
|
55 </pre> |
|
56 </body> |
|
57 </html> |