Bug 718020. (Av1) test_bug583889.html: Delay "SimpleTest.finish()" call, Add missing 'yield' in bug583889_inner1.html, Add documentation. r=roc.

This commit is contained in:
Serge Gautherie 2012-02-15 21:43:46 +01:00
parent b0e3696e2a
commit c9a691c83d
2 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,7 @@ function postPos() {
function runTest() {
var inner = document.getElementById("inner");
window.onload = grabEventAndGo;
// Wait for onLoad event.
yield;
document.body.scrollTop = 300;
@ -29,6 +30,8 @@ function runTest() {
inner.src = "bug583889_inner2.html#id1";
inner.onload = grabEventAndGo;
// Let parent process sent message.
// Wait for onLoad event from 'inner' iframe.
yield;
postPos();
@ -37,17 +40,24 @@ function runTest() {
dump("hi");
inner.contentWindow.location = "bug583889_inner2.html#id2"
waitAsync();
// Let parent process sent message.
// Let 'inner' iframe update itself.
yield;
postPos();
inner.contentWindow.location.hash = "#id3"
waitAsync();
// Let parent process sent message.
// Let 'inner' iframe update itself.
yield;
postPos();
parent.postMessage("done", "*");
// Let parent process sent messages.
// "End" generator.
yield;
}
var gen = runTest();

View File

@ -23,11 +23,13 @@ function grabEventAndGo(event) {
function runTest() {
window.onload = grabEventAndGo;
// Wait for onLoad event.
yield;
var inner = $("inner");
inner.src = "bug583889_inner1.html";
window.onmessage = grabEventAndGo;
// Wait for message from 'inner' iframe.
event = yield;
while (event.data != "done") {
@ -35,10 +37,13 @@ function runTest() {
is(data.top, 300, "should remain at same top");
is(data.left, 300, "should remain at same left");
// Wait for message from 'inner' iframe.
event = yield;
}
SimpleTest.finish();
// finish(), yet let the test actually end first, to be safe.
SimpleTest.executeSoon(SimpleTest.finish);
// "End" generator.
yield;
}