mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 593358 - Avoid use of setTimeout to check geolocation test results. r=dougt a=test-only
--HG-- extra : rebase_source : 32d8978acc50556bb41d4ea084fb8141e56529e2
This commit is contained in:
parent
ae2adc2a2a
commit
95b9e429e1
@ -24,21 +24,30 @@ SimpleTest.waitForExplicitFinish();
|
||||
resume_geolocationProvider();
|
||||
force_prompt(true);
|
||||
|
||||
var successCallbackCalled = false;
|
||||
var successCallbackCalled = 0;
|
||||
var failureCallbackCalled = 0;
|
||||
const totalResults = 100;
|
||||
|
||||
function successCallback(position) {
|
||||
successCallbackCalled = true;
|
||||
successCallbackCalled++;
|
||||
testPassed();
|
||||
}
|
||||
|
||||
for (var x = 0; x < 100; x++)
|
||||
navigator.geolocation.watchPosition(successCallback);
|
||||
function failureCallback(code) {
|
||||
failureCallbackCalled++;
|
||||
testPassed();
|
||||
}
|
||||
|
||||
for (var x = 0; x < totalResults; x++)
|
||||
navigator.geolocation.watchPosition(successCallback, failureCallback);
|
||||
|
||||
function testPassed() {
|
||||
ok(successCallbackCalled, "if nothing crashed, all okay");
|
||||
if (successCallbackCalled + failureCallbackCalled != totalResults)
|
||||
return;
|
||||
is(failureCallbackCalled, 0, "if nothing crashed, all okay");
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
setTimeout(testPassed, 1000);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
Loading…
Reference in New Issue
Block a user