Bug 657219 - Intermittent timeout in browser/base/content/test/tabview/browser_tabview_undo_group.js r=ian

This commit is contained in:
Raymond Lee 2011-06-01 00:17:09 +08:00
parent fbfdf23f9b
commit b1340cf3ff
2 changed files with 20 additions and 20 deletions

View File

@ -7,17 +7,18 @@ var prefsBranch = Cc["@mozilla.org/preferences-service;1"].
function animateZoom() prefsBranch.getBoolPref("animate_zoom");
function registerCleanupFunction() {
prefsBranch.setUserPref("animate_zoom", true);
}
function test() {
waitForExplicitFinish();
let charsetArg = "charset=" + window.content.document.characterSet;
let win = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
"about:blank", charsetArg, null, null, true);
registerCleanupFunction(function() {
prefsBranch.setBoolPref("animate_zoom", true);
win.close();
});
ok(animateZoom(), "By default, we animate on zoom.");
prefsBranch.setBoolPref("animate_zoom", false);
ok(!animateZoom(), "animate_zoom = false");
@ -29,27 +30,24 @@ function test() {
let tabViewWindow = null;
let transitioned = 0;
let onShown = function() {
win.removeEventListener("tabviewshown", onShown, false);
ok(!transitioned, "There should be no transitions");
win.close();
finish();
};
let initCallback = function() {
tabViewWindow = win.TabView._window;
function onTransitionEnd(event) {
transitioned++;
tabViewWindow.Utils.log(transitioned);
info(transitioned);
}
tabViewWindow.document.addEventListener("transitionend", onTransitionEnd, false);
win.TabView.show();
showTabView(function() {
ok(!transitioned, "There should be no transitions");
tabViewWindow.document.removeEventListener(
"transitionend", onTransitionEnd, false);
finish();
}, win);
};
win.addEventListener("tabviewshown", onShown, false);
win.TabView._initFrame(initCallback);
}
win.addEventListener("load", onLoad, false);

View File

@ -31,7 +31,9 @@ function onTabViewWindowLoaded() {
is(groupItem.getChildren().length, 1, "The new group has a tab item");
// start the tests
testUndoGroup(contentWindow, groupItem);
waitForFocus(function() {
testUndoGroup(contentWindow, groupItem);
}, contentWindow);
};
window.addEventListener("tabviewhidden", onTabViewHidden, false);
window.addEventListener("tabviewshown", onTabViewShown, false);
@ -80,7 +82,7 @@ function testUndoGroup(contentWindow, groupItem) {
});
let closeButton = groupItem.container.getElementsByClassName("close");
ok(closeButton, "Group item close button exists");
ok(closeButton[0], "Group item close button exists");
EventUtils.sendMouseEvent({ type: "click" }, closeButton[0], contentWindow);
}
@ -129,6 +131,6 @@ function testCloseUndoGroup(contentWindow, groupItem) {
});
let closeButton = groupItem.container.getElementsByClassName("close");
ok(closeButton, "Group item close button exists");
ok(closeButton[0], "Group item close button exists");
EventUtils.sendMouseEvent({ type: "click" }, closeButton[0], contentWindow);
}