mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-19 15:51:33 +00:00
Replace timeouts by event listeners in test cases for bug 92473 and bug 134911
This commit is contained in:
parent
b95b463271
commit
90c570e3d9
@ -10,23 +10,26 @@ const enteredText2="\u03BE\u03B5\u03C3\u03BA\u03B5\u03C0\u03AC\u03B6\u03C9\u0020
|
||||
var testPage;
|
||||
|
||||
function test() {
|
||||
testPage = Application.activeWindow.open(url("chrome://mochikit/content/browser/docshell/test/browser/test-form_sjis.html"));
|
||||
testPage = Application.activeWindow.open(url("about:blank"));
|
||||
testPage.events.addListener("load", afterOpen);
|
||||
testPage.load(url("chrome://mochikit/content/browser/docshell/test/browser/test-form_sjis.html"));
|
||||
testPage.focus();
|
||||
|
||||
waitForExplicitFinish();
|
||||
setTimeout(afterOpen, 1000);
|
||||
}
|
||||
|
||||
function afterOpen() {
|
||||
testPage.events.removeListener("load", afterOpen);
|
||||
testPage.events.addListener("load", afterChangeCharset);
|
||||
testPage.document.getElementById("testtextarea").value=enteredText1;
|
||||
testPage.document.getElementById("testinput").value=enteredText2;
|
||||
|
||||
/* Force the page encoding to Shift_JIS */
|
||||
SetForcedCharset("Shift_JIS");
|
||||
setTimeout(afterChangeCharset, 3000);
|
||||
}
|
||||
|
||||
function afterChangeCharset() {
|
||||
testPage.events.removeListener("load", afterChangeCharset);
|
||||
is(testPage.document.getElementById("testpar").innerHTML, rightText,
|
||||
"encoding successfully changed");
|
||||
is(testPage.document.getElementById("testtextarea").value, enteredText1,
|
||||
|
@ -25,15 +25,17 @@ function testContent(text) {
|
||||
}
|
||||
|
||||
function afterOpen() {
|
||||
testPage.events.removeListener("load", afterOpen);
|
||||
testPage.events.addListener("load", afterChangeCharset);
|
||||
/* Test that the content on load is the expected wrong decoding */
|
||||
testContent(wrongText);
|
||||
|
||||
/* Force the page encoding to Shift_JIS */
|
||||
SetForcedCharset("Shift_JIS");
|
||||
setTimeout(afterChangeCharset, 3000);
|
||||
}
|
||||
|
||||
function afterChangeCharset() {
|
||||
testPage.events.removeListener("load", afterChangeCharset);
|
||||
/* test that the content is decoded correctly */
|
||||
testContent(rightText);
|
||||
testPage.close();
|
||||
@ -42,9 +44,10 @@ function afterChangeCharset() {
|
||||
|
||||
function test() {
|
||||
var activeWin = Application.activeWindow;
|
||||
testPage = activeWin.open(url("chrome://mochikit/content/browser/docshell/test/browser/test-form_sjis.html"));
|
||||
testPage = activeWin.open(url("about:blank"));
|
||||
testPage.events.addListener("load", afterOpen);
|
||||
testPage.load(url("chrome://mochikit/content/browser/docshell/test/browser/test-form_sjis.html"));
|
||||
testPage.focus();
|
||||
|
||||
waitForExplicitFinish();
|
||||
setTimeout(afterOpen, 1000);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user