remove FUEL usage from these tests. a=tests-only

--HG--
extra : rebase_source : 646bf40bb3acf773ded5471bc42f745e3c356003
This commit is contained in:
Dão Gottwald 2010-11-28 21:02:03 +01:00
parent cc39bb05b0
commit cabbfa8f10
3 changed files with 46 additions and 67 deletions

View File

@ -44,6 +44,9 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \
browser_bug92473.js \
test-form_sjis.html \
browser_bug134911.js \
browser_bug349769.js \
browser_bug388121-1.js \
browser_bug388121-2.js \
@ -53,14 +56,5 @@ _BROWSER_TEST_FILES = \
browser_bug554155.js \
$(NULL)
# the tests below use FUEL, which is a Firefox-specific feature
ifdef MOZ_PHOENIX
_BROWSER_TEST_FILES += \
browser_bug92473.js \
test-form_sjis.html \
browser_bug134911.js \
$(NULL)
endif
libs:: $(_BROWSER_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

View File

@ -4,42 +4,35 @@ const rightText="\u30E6\u30CB\u30B3\u30FC\u30C9\u306F\u3001\u3059\u3079\u3066\u3
const enteredText1="The quick brown fox jumps over the lazy dog";
const enteredText2="\u03BE\u03B5\u03C3\u03BA\u03B5\u03C0\u03AC\u03B6\u03C9\u0020\u03C4\u1F74\u03BD\u0020\u03C8\u03C5\u03C7\u03BF\u03C6\u03B8\u03CC\u03C1\u03B1\u0020\u03B2\u03B4\u03B5\u03BB\u03C5\u03B3\u03BC\u03AF\u03B1";
var testPage;
function test() {
testPage = Application.activeWindow.open(url("about:blank"));
testPage.events.addListener("load", afterOpen);
var rootDir = getRootDirectory(gTestPath);
testPage.load(url(rootDir + "test-form_sjis.html"));
testPage.focus();
waitForExplicitFinish();
var rootDir = getRootDirectory(gTestPath);
gBrowser.selectedTab = gBrowser.addTab(rootDir + "test-form_sjis.html");
gBrowser.selectedBrowser.addEventListener("load", afterOpen, true);
}
function afterOpen() {
testPage.events.removeListener("load", afterOpen);
testPage.events.addListener("load", afterChangeCharset);
testPage.document.getElementById("testtextarea").value=enteredText1;
testPage.document.getElementById("testinput").value=enteredText2;
gBrowser.selectedBrowser.removeEventListener("load", afterOpen, true);
gBrowser.selectedBrowser.addEventListener("load", afterChangeCharset, true);
/* Force the page encoding to Shift_JIS */
SetForcedCharset("Shift_JIS");
gBrowser.contentDocument.getElementById("testtextarea").value = enteredText1;
gBrowser.contentDocument.getElementById("testinput").value = enteredText2;
/* Force the page encoding to Shift_JIS */
SetForcedCharset("Shift_JIS");
}
function afterChangeCharset() {
testPage.events.removeListener("load", afterChangeCharset);
is(testPage.document.getElementById("testpar").innerHTML, rightText,
"encoding successfully changed");
is(testPage.document.getElementById("testtextarea").value, enteredText1,
"text preserved in <textarea>");
is(testPage.document.getElementById("testinput").value, enteredText2,
"text preserved in <input>");
gBrowser.selectedBrowser.removeEventListener("load", afterChangeCharset, true);
testPage.close();
finish();
}
is(gBrowser.contentDocument.getElementById("testpar").innerHTML, rightText,
"encoding successfully changed");
is(gBrowser.contentDocument.getElementById("testtextarea").value, enteredText1,
"text preserved in <textarea>");
is(gBrowser.contentDocument.getElementById("testinput").value, enteredText2,
"text preserved in <input>");
function url(spec) {
return Services.io.newURI(spec, null, null);
gBrowser.removeCurrentTab();
finish();
}

View File

@ -5,47 +5,39 @@ const rightText="\u30E6\u30CB\u30B3\u30FC\u30C9\u306F\u3001\u3059\u3079\u3066\u3
text; anything else is unexpected. */
const wrongText="\u0453\u2020\u0453\u006A\u0453\u0052\u0403\u005B\u0453\u0068\u201A\u041D\u0403\u0041\u201A\u00B7\u201A\u0427\u201A\u0414\u201A\u041C\u2022\u00B6\u040B\u0459\u201A\u0419\u040A\u0415\u2014\u004C\u201A\u041C\u201D\u0424\u040C\u2020\u201A\u0440\u2022\u0074\u2014\u005E\u201A\u00B5\u201A\u042C\u201A\u00B7";
var testPage;
function url(spec) {
return Services.io.newURI(spec, null, null);
}
function testContent(text) {
is(testPage.document.getElementById("testpar").innerHTML, text,
"<p> contains expected text");
is(testPage.document.getElementById("testtextarea").innerHTML, text,
"<textarea> contains expected text");
is(testPage.document.getElementById("testinput").value, text,
"<input> contains expected text");
is(gBrowser.contentDocument.getElementById("testpar").innerHTML, text,
"<p> contains expected text");
is(gBrowser.contentDocument.getElementById("testtextarea").innerHTML, text,
"<textarea> contains expected text");
is(gBrowser.contentDocument.getElementById("testinput").value, text,
"<input> contains expected 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);
gBrowser.selectedBrowser.removeEventListener("load", afterOpen, true);
gBrowser.selectedBrowser.addEventListener("load", afterChangeCharset, true);
/* Force the page encoding to Shift_JIS */
SetForcedCharset("Shift_JIS");
/* Test that the content on load is the expected wrong decoding */
testContent(wrongText);
/* Force the page encoding to Shift_JIS */
SetForcedCharset("Shift_JIS");
}
function afterChangeCharset() {
testPage.events.removeListener("load", afterChangeCharset);
/* test that the content is decoded correctly */
testContent(rightText);
testPage.close();
finish();
gBrowser.selectedBrowser.removeEventListener("load", afterChangeCharset, true);
/* test that the content is decoded correctly */
testContent(rightText);
gBrowser.removeCurrentTab();
finish();
}
function test() {
var activeWin = Application.activeWindow;
testPage = activeWin.open(url("about:blank"));
testPage.events.addListener("load", afterOpen);
var rootDir = getRootDirectory(gTestPath);
testPage.load(url(rootDir + "test-form_sjis.html"));
testPage.focus();
waitForExplicitFinish();
var rootDir = getRootDirectory(gTestPath);
gBrowser.selectedTab = gBrowser.addTab(rootDir + "test-form_sjis.html");
gBrowser.selectedBrowser.addEventListener("load", afterOpen, true);
}