test_manyCurrentConcurrent.html (1392B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=482260 5 --> 6 <head> 7 <title>Test for getCurrentPosition </title> 8 <script 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 "use strict"; 22 23 SimpleTest.waitForExplicitFinish(); 24 25 resume_geolocationProvider(function() { 26 force_prompt(true, test1); 27 }); 28 29 var successCallbackCalled = 0; 30 var failureCallbackCalled = 0; 31 const totalResults = 100; 32 33 function successCallback(position) { 34 check_geolocation(position); 35 successCallbackCalled++; 36 testPassed(); 37 } 38 39 function failureCallback(_code) { 40 failureCallbackCalled++; 41 testPassed(); 42 } 43 44 function test1() { 45 for (var x = 0; x < totalResults; x++) 46 navigator.geolocation.getCurrentPosition(successCallback, failureCallback); 47 } 48 49 function testPassed() { 50 if (successCallbackCalled + failureCallbackCalled != totalResults) 51 return; 52 is(failureCallbackCalled, 0, "no failure callbacks should have been received"); 53 SimpleTest.finish(); 54 } 55 56 </script> 57 </pre> 58 </body> 59 </html>