Bug 566251 - Findbar chrome tests shouldn't use nsIThreadManager directly. r=gavin

This commit is contained in:
Graeme McCutcheon 2010-06-02 11:22:54 +01:00
Родитель 4766cac975
Коммит 52dd41b94d
4 изменённых файлов: 44 добавлений и 71 удалений

Просмотреть файл

@ -43,7 +43,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="600"
height="600"
onload="onLoad();"
onload="SimpleTest.executeSoon(startTest);"
title="263683 test">
<script type="application/javascript"><![CDATA[
@ -54,31 +54,24 @@
var gFindBar = null;
var gBrowser;
function ok(condition, message) {
window.opener.wrappedJSObject.SimpleTest.ok(condition, message);
var imports = ["SimpleTest", "ok"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
}
function finish() {
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();
SimpleTest.finish();
}
function onLoad() {
var _delayedOnLoad = function() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
gBrowser.loadURI('data:text/html,<h2>Text mozilla</h2><input id="inp" type="text" />');
}
let tm = Cc["@mozilla.org/thread-manager;1"].
getService(Ci.nsIThreadManager);
tm.mainThread.dispatch({
run: function() _delayedOnLoad()
}, Ci.nsIThread.DISPATCH_NORMAL);
function startTest() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
gBrowser.loadURI('data:text/html,<h2>Text mozilla</h2><input id="inp" type="text" />');
}
function onPageShow() {
gBrowser.removeEventListener("load", onPageShow, true);
gFindBar.open();
var search = "mozilla";
gFindBar._findField.value = search;

Просмотреть файл

@ -43,7 +43,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="600"
height="600"
onload="onLoad();"
onload="SimpleTest.executeSoon(startTest);"
title="331215 test">
<script type="application/javascript"><![CDATA[
@ -54,27 +54,21 @@
var gFindBar = null;
var gBrowser;
function ok(condition, message) {
window.opener.wrappedJSObject.SimpleTest.ok(condition, message);
var imports = ["SimpleTest", "ok"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
}
function finish() {
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();
SimpleTest.finish();
}
function onLoad() {
var _delayedOnLoad = function() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
gBrowser.loadURI("data:text/plain,latest");
}
let tm = Cc["@mozilla.org/thread-manager;1"].
getService(Ci.nsIThreadManager);
tm.mainThread.dispatch({
run: function() _delayedOnLoad()
}, Ci.nsIThread.DISPATCH_NORMAL);
function startTest() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
gBrowser.loadURI("data:text/plain,latest");
}
function onPageShow() {

Просмотреть файл

@ -43,7 +43,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="600"
height="600"
onload="onLoad();"
onload="SimpleTest.executeSoon(startTest);"
title="451286 test (also tests bug 493658)">
<script type="application/javascript"><![CDATA[
@ -56,38 +56,31 @@
var gFindBar = null;
var gBrowser;
var imports = [ "SimpleTest", "ok", "snapshotWindow", "compareSnapshots"];
var imports = ["SimpleTest", "ok", "snapshotWindow", "compareSnapshots"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
}
function finish() {
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();
SimpleTest.finish();
}
function onLoad() {
var _delayedOnLoad = function() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
function startTest() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
// Bug 451286. An iframe that should be highlighted
var visible = "<iframe id='visible' src='" + DATAURI + "'></iframe>";
// Bug 451286. An iframe that should be highlighted
var visible = "<iframe id='visible' src='" + DATAURI + "'></iframe>";
// Bug 493658. An invisible iframe that shouldn't interfere with
// highlighting matches lying after it in the document
var invisible = "<iframe id='invisible' style='display: none;' " +
"src='" + DATAURI + "'></iframe>";
// Bug 493658. An invisible iframe that shouldn't interfere with
// highlighting matches lying after it in the document
var invisible = "<iframe id='invisible' style='display: none;' " +
"src='" + DATAURI + "'></iframe>";
var uri = DATAURI + invisible + SEARCH_TEXT + visible + SEARCH_TEXT;
gBrowser.loadURI(uri);
}
let tm = Cc["@mozilla.org/thread-manager;1"].
getService(Ci.nsIThreadManager);
tm.mainThread.dispatch({
run: function() _delayedOnLoad()
}, Ci.nsIThread.DISPATCH_NORMAL);
var uri = DATAURI + invisible + SEARCH_TEXT + visible + SEARCH_TEXT;
gBrowser.loadURI(uri);
}
function onPageShow(aEvent) {

Просмотреть файл

@ -61,7 +61,7 @@
sendMeta = true;
}
var imports = [ "SimpleTest", "ok", "finish"];
var imports = [ "SimpleTest", "ok"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
}
@ -72,20 +72,13 @@
SimpleTest.finish();
}
function onLoad() {
var _delayedOnLoad = function() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
var data = 'data:text/html,<input id="inp" type="text" />';
data +='<textarea id="tarea"/>'
gBrowser.loadURI(data);
}
let tm = Cc["@mozilla.org/thread-manager;1"].
getService(Ci.nsIThreadManager);
tm.mainThread.dispatch({
run: function() _delayedOnLoad()
}, Ci.nsIThread.DISPATCH_NORMAL);
function startTest() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
var data = 'data:text/html,<input id="inp" type="text" />';
data +='<textarea id="tarea"/>'
gBrowser.loadURI(data);
}
function resetForNextTest(aElement, aText) {
@ -292,7 +285,7 @@
finishTest();
}
window.opener.wrappedJSObject.SimpleTest.waitForFocus(onLoad, window);
SimpleTest.waitForFocus(startTest, window);
]]></script>
<browser type="content-primary" flex="1" id="content" src="about:blank"/>