Bug 610545, fix tests to disable arrow panel transitions to speed them up and fix mouse targetting issues, r=felipe

This commit is contained in:
Neil Deakin 2014-04-08 08:45:52 -04:00
Родитель 155126a8ea
Коммит 6def64a610
15 изменённых файлов: 55 добавлений и 0 удалений

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

@ -879,10 +879,13 @@ function test() {
Services.obs.addObserver(XPInstallObserver, "addon-install-failed", false);
Services.obs.addObserver(XPInstallObserver, "addon-install-complete", false);
PopupNotifications.transitionsEnabled = false;
registerCleanupFunction(function() {
// Make sure no more test parts run in case we were timed out
TESTS = [];
PopupNotifications.panel.removeEventListener("popupshown", check_notification, false);
PopupNotifications.transitionsEnabled = true;
AddonManager.getAllInstalls(function(aInstalls) {
aInstalls.forEach(function(aInstall) {

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

@ -12,14 +12,17 @@ function test() {
waitForFocus(function () {
let PN = newWin.PopupNotifications;
PN.transitionsEnabled = false;
try {
let notification = PN.show(newWin.gBrowser.selectedBrowser, "some-notification", "Some message");
ok(notification, "showed the notification");
ok(PN.isPanelOpen, "panel is open");
is(PN.panel.anchorNode, newWin.gBrowser.selectedTab, "notification is correctly anchored to the tab");
PN.panel.hidePopup();
} catch (ex) {
ok(false, "threw exception: " + ex);
}
PN.transitionsEnabled = true;
newWin.close();
finish();
}, newWin);

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

@ -8,6 +8,10 @@ function test() {
ok(PopupNotifications, "PopupNotifications object exists");
ok(PopupNotifications.panel, "PopupNotifications panel exists");
// Disable transitions as they slow the test down and we want to click the
// mouse buttons in a predictable location.
PopupNotifications.transitionsEnabled = false;
registerCleanupFunction(cleanUp);
runNextTest();
@ -19,6 +23,7 @@ function cleanUp() {
for (var eventName in gActiveListeners)
PopupNotifications.panel.removeEventListener(eventName, gActiveListeners[eventName], false);
PopupNotifications.buttonDelay = PREF_SECURITY_DELAY_INITIAL;
PopupNotifications.transitionsEnabled = true;
}
const PREF_SECURITY_DELAY_INITIAL = Services.prefs.getIntPref("security.notification_enable_delay");

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

@ -6,12 +6,16 @@ const isOSX = (Services.appinfo.OS === "Darwin");
let originalWindowWidth;
registerCleanupFunction(function() {
overflowPanel.removeAttribute("animate");
window.resizeTo(originalWindowWidth, window.outerHeight);
});
// Right-click on an item within the overflow panel should
// show a context menu with options to move it.
add_task(function() {
overflowPanel.setAttribute("animate", "false");
originalWindowWidth = window.outerWidth;
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");

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

@ -17,6 +17,7 @@ add_task(function testPopup() {
function* checkPopupContextMenu() {
let dropmarker = document.getAnonymousElementByAttribute(bookmarksMenuButton, "anonid", "dropmarker");
BMB_menuPopup.setAttribute("style", "transition: none;");
let popupShownPromise = onPopupEvent(BMB_menuPopup, "shown");
EventUtils.synthesizeMouseAtCenter(dropmarker, {});
info("Waiting for bookmarks menu to be shown.");
@ -28,6 +29,7 @@ function* checkPopupContextMenu() {
ok(!newBookmarkItem.hasAttribute("disabled"), "New bookmark item shouldn't be disabled");
let contextMenuHiddenPromise = onPopupEvent(contextMenu, "hidden");
contextMenu.hidePopup();
BMB_menuPopup.removeAttribute("style");
info("Waiting for context menu on bookmarks menu to be hidden.");
yield contextMenuHiddenPromise;
let popupHiddenPromise = onPopupEvent(BMB_menuPopup, "hidden");

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

@ -103,6 +103,7 @@ let PanelFactory = {
let panel = doc.createElement("panel");
panel.setAttribute("hidden", true);
panel.setAttribute("ignorekeys", true);
panel.setAttribute("animate", false);
panel.setAttribute("consumeoutsideclicks", options.get("consumeOutsideClick"));
panel.setAttribute("noautofocus", options.get("noAutoFocus"));

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

@ -276,6 +276,8 @@ function test() {
return;
}
PopupNotifications.transitionsEnabled = false;
registerCleanupFunction(cleanUp);
ok(sitw.SignInToWebsiteUX, "SignInToWebsiteUX object exists");
@ -313,6 +315,8 @@ function cleanUp() {
info("cleanup");
resetState();
PopupNotifications.transitionsEnabled = true;
for (let topic in gActiveObservers)
Services.obs.removeObserver(gActiveObservers[topic], topic);
for (let eventName in gActiveListeners)

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

@ -23,6 +23,10 @@ let tests = [
let icon = document.getElementById("UITourTooltipIcon");
let buttons = document.getElementById("UITourTooltipButtons");
// Disable the animation to prevent the mouse clicks from hitting the main
// window during the transition instead of the buttons in the popup.
popup.setAttribute("animate", "false");
popup.addEventListener("popupshown", function onPopupShown() {
popup.removeEventListener("popupshown", onPopupShown);
@ -150,6 +154,7 @@ let tests = [
is(gContentWindow.callbackResult, "target", "target callback called");
is(gContentWindow.callbackData.target, "appMenu", "target callback was from the appMenu");
is(gContentWindow.callbackData.type, "popupshown", "target callback was from the mousedown");
popup.removeAttribute("animate");
done();
});
});

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

@ -10,6 +10,9 @@ const notificationID = "indexedDB-permissions-prompt";
function test()
{
waitForExplicitFinish();
PopupNotifications.transitionsEnabled = false;
// We want a prompt.
setPermission(testPageURL, "indexedDB", "allow");
executeSoon(test1);
@ -69,6 +72,7 @@ function test2()
gBrowser.removeCurrentTab();
unregisterAllPopupEventHandlers();
removePermission(testPageURL, "indexedDB");
PopupNotifications.transitionsEnabled = true;
executeSoon(finish);
});

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

@ -11,6 +11,7 @@ function test()
{
waitForExplicitFinish();
// We want the prompt.
PopupNotifications.transitionsEnabled = false;
setPermission(testPageURL, "indexedDB", "allow");
executeSoon(test1);
}
@ -68,6 +69,7 @@ function test2()
gBrowser.selectedBrowser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false;
unregisterAllPopupEventHandlers();
gBrowser.removeCurrentTab();
PopupNotifications.transitionsEnabled = true;
executeSoon(test3);
});

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

@ -12,6 +12,7 @@ function test()
{
waitForExplicitFinish();
requestLongerTimeout(10);
PopupNotifications.transitionsEnabled = false;
removePermission(testPageURL, "indexedDB-unlimited");
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
executeSoon(test1);
@ -108,6 +109,7 @@ function test2()
unregisterAllPopupEventHandlers();
removePermission(testPageURL, "indexedDB");
Services.prefs.clearUserPref("dom.indexedDB.warningQuota");
PopupNotifications.transitionsEnabled = true;
executeSoon(finish);
});
executeSoon(function() { dispatchEvent("indexedDB-done"); });

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

@ -12,6 +12,7 @@ function test()
{
waitForExplicitFinish();
requestLongerTimeout(10);
PopupNotifications.transitionsEnabled = false;
removePermission(testPageURL, "indexedDB-unlimited");
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
executeSoon(test1);
@ -43,6 +44,7 @@ function test1()
gBrowser.removeCurrentTab();
unregisterAllPopupEventHandlers();
addMoreTest1Count = seenPopupCount;
PopupNotifications.transitionsEnabled = true;
executeSoon(finish);
});
executeSoon(function() { dispatchEvent("indexedDB-done"); });

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

@ -12,6 +12,7 @@ function test()
{
waitForExplicitFinish();
requestLongerTimeout(10);
PopupNotifications.transitionsEnabled = false;
removePermission(testPageURL, "indexedDB-unlimited");
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
executeSoon(test1);
@ -54,6 +55,7 @@ function test1()
"Correct permission set");
gBrowser.removeCurrentTab();
unregisterAllPopupEventHandlers();
PopupNotifications.transitionsEnabled = true;
executeSoon(finish);
});
executeSoon(function() { dispatchEvent("indexedDB-done"); });

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

@ -12,6 +12,7 @@ function test()
{
waitForExplicitFinish();
requestLongerTimeout(10);
PopupNotifications.transitionsEnabled = false;
removePermission(testPageURL, "indexedDB-unlimited");
Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
executeSoon(test1);
@ -48,6 +49,7 @@ function test1()
gBrowser.removeCurrentTab();
unregisterAllPopupEventHandlers();
addMoreTest1Count = seenPopupCount;
PopupNotifications.transitionsEnabled = true;
executeSoon(test2);
});
executeSoon(function() { dispatchEvent("indexedDB-done"); });

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

@ -155,6 +155,20 @@ PopupNotifications.prototype = {
return this._iconBox;
},
/**
* Enable or disable the opening/closing transition.
* @param state
* Boolean state
*/
set transitionsEnabled(state) {
if (state) {
this.panel.removeAttribute("animate");
}
else {
this.panel.setAttribute("animate", "false");
}
},
/**
* Retrieve a Notification object associated with the browser/ID pair.
* @param id