fix up tests

This commit is contained in:
Dão Gottwald
2010-03-13 17:55:44 +01:00
parent 91af974279
commit 0ae2a73e51
3 changed files with 13 additions and 13 deletions

View File

@@ -7,17 +7,17 @@ var menu;
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
// Navigate to a normal site
gBrowser.addEventListener("load", testNormal, false);
gBrowser.addEventListener("DOMContentLoaded", testNormal, false);
content.location = "http://example.com/";
}
function testNormal() {
gBrowser.removeEventListener("load", testNormal, false);
gBrowser.removeEventListener("DOMContentLoaded", testNormal, false);
// open the menu, to force it to update
menu = document.getElementById("menu_HelpPopup");
ok(menu, "Help menu should exist!");
@@ -38,7 +38,7 @@ function testNormal_PopupListener() {
// Now launch the phishing test. Can't use onload here because error pages don't
// fire normal load events.
content.location = "http://www.mozilla.com/firefox/its-a-trap.html";
window.setTimeout(testPhishing, 2000);
setTimeout(testPhishing, 2000);
}
function testPhishing() {

View File

@@ -73,8 +73,8 @@ function test() {
let newWin = openDialog(location, "", "chrome,all,dialog=no", testURL);
newWin.addEventListener("load", function(aEvent) {
newWin.gBrowser.addEventListener("load", function(aEvent) {
newWin.gBrowser.removeEventListener("load", arguments.callee, true);
newWin.gBrowser.selectedBrowser.addEventListener("load", function(aEvent) {
newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
executeSoon(function() {
newWin.gBrowser.addTab().linkedBrowser.stop();
@@ -101,8 +101,8 @@ function test() {
"The reopened window was removed from Recently Closed Windows");
newWin2.addEventListener("load", function(aEvent) {
newWin2.gBrowser.addEventListener("SSTabRestored", function(aEvent) {
newWin2.gBrowser.removeEventListener("SSTabRestored", arguments.callee, true);
newWin2.gBrowser.tabContainer.addEventListener("SSTabRestored", function(aEvent) {
newWin2.gBrowser.tabContainer.removeEventListener("SSTabRestored", arguments.callee, true);
is(newWin2.gBrowser.tabContainer.childNodes.length, 2,
"The window correctly restored 2 tabs");
@@ -157,8 +157,8 @@ function test() {
let url = "http://window" + windowsToOpen.length + ".example.com";
let win = openDialog(location, "", settings, url);
win.addEventListener("load", function(aEvent) {
win.gBrowser.addEventListener("load", function(aEvent) {
win.gBrowser.removeEventListener("load", arguments.callee, true);
win.gBrowser.selectedBrowser.addEventListener("DOMContentLoaded", function(aEvent) {
win.gBrowser.selectedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
// the window _should_ have state with a tab of url, but it doesn't
// always happend before window.close(). addTab ensure we don't treat
// this window as a stateless window

View File

@@ -49,11 +49,11 @@ function test() {
is(gPageA.uri.spec, "chrome://mochikit/content/browser/browser/fuel/test/ContentA.html", "Checking 'BrowserTab.uri' after opening");
is(gPageB.uri.spec, "chrome://mochikit/content/browser/browser/fuel/test/ContentB.html", "Checking 'BrowserTab.uri' after opening");
// check event
is(gTabOpenCount, 2, "Checking event handler for tab open");
// check cached values from TabOpen event
is(gPageA.uri.spec, gTabOpenPageA.uri.spec, "Checking first browser tab open is equal to page A");
is(gPageB.uri.spec, gTabOpenPageB.uri.spec, "Checking second browser tab open is equal to page B");
// check event
is(gTabOpenCount, 2, "Checking event handler for tab open");
// test document access
var test1 = gPageA.document.getElementById("test1");