mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 650579 - Avoid using flaky timeout values in geolocation tests; r=sicking
This commit is contained in:
parent
66991a593c
commit
7f07264cdc
@ -3,7 +3,10 @@
|
||||
<title>Simple access of geolocation</title>
|
||||
<head>
|
||||
<script>
|
||||
navigator.geolocation.getCurrentPosition(function () {}, null, {timeout:30000});
|
||||
function loadedWindow() {
|
||||
opener.postMessage("loaded", "*");
|
||||
}
|
||||
navigator.geolocation.getCurrentPosition(loadedWindow, loadedWindow, {timeout:30000});
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
|
@ -36,11 +36,13 @@ function successCallback(position) {
|
||||
if (hasBeenCleared == true) {
|
||||
successWasCalledAfterClear = true;
|
||||
}
|
||||
SimpleTest.executeSoon(clearWatch);
|
||||
}
|
||||
|
||||
function clearWatch() {
|
||||
navigator.geolocation.clearWatch(watchID);
|
||||
hasBeenCleared = true;
|
||||
SimpleTest.executeSoon(testAccepted);
|
||||
}
|
||||
|
||||
function testAccepted() {
|
||||
@ -52,10 +54,6 @@ function testAccepted() {
|
||||
|
||||
watchID = navigator.geolocation.watchPosition(successCallback, failureCallback, null);
|
||||
|
||||
setTimeout(clearWatch, 250);
|
||||
|
||||
setTimeout(testAccepted, 2000);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -28,10 +28,17 @@ force_prompt(true);
|
||||
/** Test for Bug **/
|
||||
|
||||
var numberOfWindows = 5; // 20 seems to be the default max popups during the mochitest run
|
||||
var totalWindows = numberOfWindows;
|
||||
var loadedWindows = 0;
|
||||
|
||||
var windows = new Array(numberOfWindows);
|
||||
|
||||
addEventListener("message", function() {
|
||||
++loadedWindows;
|
||||
if (loadedWindows == numberOfWindows) {
|
||||
SimpleTest.executeSoon(closeWindows);
|
||||
}
|
||||
}, false);
|
||||
|
||||
for(var i = 0; i < numberOfWindows; i++) {
|
||||
windows[i] = window.open("geolocation.html", "_blank", "width=700,height=400");
|
||||
}
|
||||
@ -40,27 +47,19 @@ function closeWindows()
|
||||
{
|
||||
for(var i = 0; i < numberOfWindows; i++) {
|
||||
windows[i].close();
|
||||
totalWindows --;
|
||||
}
|
||||
SimpleTest.waitForFocus(done);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function checkDone()
|
||||
function done()
|
||||
{
|
||||
if (totalWindows == 0)
|
||||
{
|
||||
ok(navigator.geolocation, "Opened a bunch of windows and didn't crash.");
|
||||
clearInterval(timer);
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
ok(navigator.geolocation, "Opened a bunch of windows and didn't crash.");
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
var timer = setInterval(checkDone, 1000);
|
||||
|
||||
setTimeout(closeWindows, 5000);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user