Bug 1214162 - Fix up navigation tests that rely on short timeouts so they are more stable, r=Ms2ger

This commit is contained in:
James Graham 2015-10-13 11:27:56 +01:00
parent 45010d35ee
commit a6ec256317
4 changed files with 26 additions and 28 deletions

View File

@ -9,7 +9,6 @@ var t = async_test();
onload = setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.src="about:blank";
setTimeout(t.step_func(function() {assert_unreached();}), 1000)
}, 100)
</script>
<iframe src="008-1.html"></iframe>

View File

@ -9,7 +9,6 @@ var t = async_test();
onload = setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.src="about:blank";
setTimeout(t.step_func(function() {assert_unreached();}), 1000)
}, 100)
</script>
<iframe src="009-1.html"></iframe>

View File

@ -7,23 +7,24 @@
var t = async_test();
started = false;
pages = []
timer = null;
start_test_wait = t.step_func(
function() {
clearTimeout(timer);
timer = setTimeout(t.step_func(
check_result = t.step_func(
function() {
try {
//The pass condition here is based on the idea that the spec is wrong and browsers are right
assert_array_equals(pages, [2, 3, 2, 3], "Pages opened durning history navigation");
t.done();
} finally {
// win.close();
if (pages.length < 4) {
setTimeout(check_result, 500);
return
}
//The pass condition here is based on the idea that the spec is wrong and browsers are right
assert_array_equals(pages, [2, 3, 2, 3], "Pages opened during history navigation");
t.done();
}
), 500);
)
setTimeout(check_result, 500);
}
);
t.step(function() {win = window.open("history_entry.html?urls=traverse_the_history_write_after_load_1-1.html");
t.step(function() {
win = window.open("history_entry.html?urls=traverse_the_history_write_after_load_1-1.html");
t.add_cleanup(function() {win.close()});
});
</script>

View File

@ -7,23 +7,22 @@
var t = async_test();
started = false;
pages = []
timer = null;
start_test_wait = t.step_func(
function() {
clearTimeout(timer);
timer = setTimeout(t.step_func(
function() {
try {
//The pass condition here is based on the idea that the spec is wrong and browsers are right
assert_array_equals(pages, [3, 4, 2, 3, 4], "Pages opened durning history navigation");
t.done();
} finally {
win.close();
}
}
), 500);
var check_result = t.step_func(function() {
if (pages.length < 5) {
setTimeout(check_result, 500);
return
}
//The pass condition here is based on the idea that the spec is wrong and browsers are right
assert_array_equals(pages, [3, 4, 2, 3, 4], "Pages opened during history navigation");
t.done();
});
setTimeout(check_result, 500);
}
);
t.step(function() {win = window.open("history_entry.html?urls=history_forward-1.html,traverse_the_history_write_onload_2-1.html");
});
t.step(function() {
win = window.open("history_entry.html?urls=history_forward-1.html,traverse_the_history_write_onload_2-1.html");
t.add_cleanup(function() {win.close()});
});
</script>