Bug 610545, fix tests to disable arrow panel transitions to speed them up and fix mouse targetting issues, r=felipe
authorNeil Deakin <neil@mozilla.com>
Tue, 08 Apr 2014 08:45:52 -0400
changeset 177560 127895063bb0df411b40c0b431403b56f7628c68
parent 177559 c65c5250c1f2ee5723479459c017d4152372049d
child 177561 96fe808574232416a57b24cc635bcec908dbc929
push id26556
push userryanvm@gmail.com
push dateTue, 08 Apr 2014 22:16:57 +0000
treeherdermozilla-central@5811efc11011 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs610545
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 610545, fix tests to disable arrow panel transitions to speed them up and fix mouse targetting issues, r=felipe
browser/base/content/test/general/browser_bug553455.js
browser/base/content/test/general/browser_customize_popupNotification.js
browser/base/content/test/general/browser_popupNotification.js
browser/components/customizableui/test/browser_884402_customize_from_overflow.js
browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
browser/devtools/shared/widgets/Tooltip.js
browser/modules/test/browser_SignInToWebsite.js
browser/modules/test/browser_UITour3.js
dom/indexedDB/test/browser_permissionsPromptAllow.js
dom/indexedDB/test/browser_permissionsPromptDeny.js
dom/indexedDB/test/browser_quotaPromptAllow.js
dom/indexedDB/test/browser_quotaPromptDatabases.js
dom/indexedDB/test/browser_quotaPromptDelete.js
dom/indexedDB/test/browser_quotaPromptDeny.js
toolkit/modules/PopupNotifications.jsm
--- a/browser/base/content/test/general/browser_bug553455.js
+++ b/browser/base/content/test/general/browser_bug553455.js
@@ -874,20 +874,23 @@ function test() {
   Services.prefs.setBoolPref("extensions.logging.enabled", true);
   Services.prefs.setBoolPref("extensions.strictCompatibility", true);
 
   Services.obs.addObserver(XPInstallObserver, "addon-install-started", false);
   Services.obs.addObserver(XPInstallObserver, "addon-install-blocked", false);
   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) {
         aInstall.cancel();
       });
     });
 
     Services.prefs.clearUserPref("extensions.logging.enabled");
--- a/browser/base/content/test/general/browser_customize_popupNotification.js
+++ b/browser/base/content/test/general/browser_customize_popupNotification.js
@@ -7,21 +7,24 @@ function test() {
   waitForExplicitFinish();
   let newWin = OpenBrowserWindow();
   whenDelayedStartupFinished(newWin, function () {
     // Remove the URL bar
     newWin.gURLBar.parentNode.removeChild(newWin.gURLBar);
 
     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);
   });
 }
--- a/browser/base/content/test/general/browser_popupNotification.js
+++ b/browser/base/content/test/general/browser_popupNotification.js
@@ -3,27 +3,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function test() {
   waitForExplicitFinish();
 
   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();
 }
 
 function cleanUp() {
   for (var topic in gActiveObservers)
     Services.obs.removeObserver(gActiveObservers[topic], topic);
   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");
 
 var gActiveListeners = {};
 var gActiveObservers = {};
 var gShownState = {};
 
--- a/browser/components/customizableui/test/browser_884402_customize_from_overflow.js
+++ b/browser/components/customizableui/test/browser_884402_customize_from_overflow.js
@@ -1,22 +1,26 @@
 "use strict";
 
 let overflowPanel = document.getElementById("widget-overflow");
 
 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.");
   let oldChildCount = navbar.customizationTarget.childElementCount;
   window.resizeTo(400, window.outerHeight);
 
   yield waitForCondition(() => navbar.hasAttribute("overflowing"));
   ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
--- a/browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
+++ b/browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
@@ -12,27 +12,29 @@ add_task(function testPopup() {
   CustomizableUI.addWidgetToArea("bookmarks-menu-button", CustomizableUI.AREA_PANEL);
   CustomizableUI.addWidgetToArea("bookmarks-menu-button", CustomizableUI.AREA_NAVBAR, pos);
   info("Checking popup context menu after moving the bookmarks button");
   yield checkPopupContextMenu();
 });
 
 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.");
   yield popupShownPromise;
   let contextMenuShownPromise = onPopupEvent(contextMenu, "shown");
   EventUtils.synthesizeMouseAtCenter(BMB_showAllBookmarks, {type: "contextmenu", button: 2 });
   info("Waiting for context menu on bookmarks menu to be shown.");
   yield contextMenuShownPromise;
   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");
   // Can't use synthesizeMouseAtCenter because the dropdown panel is in the way
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   info("Waiting for bookmarks menu to be hidden.");
   yield popupHiddenPromise;
 }
--- a/browser/devtools/shared/widgets/Tooltip.js
+++ b/browser/devtools/shared/widgets/Tooltip.js
@@ -98,16 +98,17 @@ let PanelFactory = {
    * @param {OptionsStore} options
    *        An options store to get some configuration from
    */
   get: function(doc, options) {
     // Create the tooltip
     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"));
     panel.setAttribute("type", "arrow");
     panel.setAttribute("level", "top");
 
     panel.setAttribute("class", "devtools-tooltip theme-tooltip-panel");
     doc.querySelector("window").appendChild(panel);
--- a/browser/modules/test/browser_SignInToWebsite.js
+++ b/browser/modules/test/browser_SignInToWebsite.js
@@ -271,16 +271,18 @@ function test() {
   try {
     Components.utils.import("resource:///modules/SignInToWebsite.jsm", sitw);
   } catch (ex) {
     ok(true, "Skip the test since SignInToWebsite.jsm isn't packaged outside outside mozilla-central");
     finish();
     return;
   }
 
+  PopupNotifications.transitionsEnabled = false;
+
   registerCleanupFunction(cleanUp);
 
   ok(sitw.SignInToWebsiteUX, "SignInToWebsiteUX object exists");
   if (!Services.prefs.getBoolPref("dom.identity.enabled")) {
     // If the pref isn't enabled then init wasn't called so do that for the test.
     sitw.SignInToWebsiteUX.init();
   }
 
@@ -308,16 +310,18 @@ function resetState() {
   IdentityService.reset();
 }
 
 // Cleanup after all tests
 function cleanUp() {
   info("cleanup");
   resetState();
 
+  PopupNotifications.transitionsEnabled = true;
+
   for (let topic in gActiveObservers)
     Services.obs.removeObserver(gActiveObservers[topic], topic);
   for (let eventName in gActiveListeners)
     PopupNotifications.panel.removeEventListener(eventName, gActiveListeners[eventName], false);
   delete IdentityService.RP._rpFlows[outerWinId];
 
   // Put the JSM functions back to how they were
   IdentityService.IDP.setAuthenticationFlow = window.setAuthenticationFlow;
--- a/browser/modules/test/browser_UITour3.js
+++ b/browser/modules/test/browser_UITour3.js
@@ -18,16 +18,20 @@ function test() {
 let tests = [
   function test_info_icon(done) {
     let popup = document.getElementById("UITourTooltip");
     let title = document.getElementById("UITourTooltipTitle");
     let desc = document.getElementById("UITourTooltipDescription");
     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);
 
       is(title.textContent, "a title", "Popup should have correct title");
       is(desc.textContent, "some text", "Popup should have correct description text");
 
       let imageURL = getRootDirectory(gTestPath) + "image.png";
       imageURL = imageURL.replace("chrome://mochitests/content/", "https://example.com/");
@@ -145,16 +149,17 @@ let tests = [
   function test_info_target_callback(done) {
     let popup = document.getElementById("UITourTooltip");
     popup.addEventListener("popupshown", function onPopupShown() {
       popup.removeEventListener("popupshown", onPopupShown);
       PanelUI.show().then(() => {
         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();
       });
     });
 
     let infoOptions = gContentWindow.makeInfoOptions();
     gContentAPI.showInfo("appMenu", "I want to know when the target is clicked", "*click*", null, null, infoOptions);
   },
 ];
--- a/dom/indexedDB/test/browser_permissionsPromptAllow.js
+++ b/dom/indexedDB/test/browser_permissionsPromptAllow.js
@@ -5,16 +5,19 @@
 
 const testPageURL = "http://mochi.test:8888/browser/" +
   "dom/indexedDB/test/browser_permissionsPrompt.html";
 const notificationID = "indexedDB-permissions-prompt";
 
 function test()
 {
   waitForExplicitFinish();
+
+  PopupNotifications.transitionsEnabled = false;
+
   // We want a prompt.
   setPermission(testPageURL, "indexedDB", "allow");
   executeSoon(test1);
 }
 
 function test1()
 {
   info("creating tab");
@@ -64,16 +67,17 @@ function test2()
          "First database creation was successful");
       ok(!exception, "No exception");
       is(getPermission(testPageURL, "indexedDB"),
          Components.interfaces.nsIPermissionManager.UNKNOWN_ACTION,
          "Correct permission set");
       gBrowser.removeCurrentTab();
       unregisterAllPopupEventHandlers();
       removePermission(testPageURL, "indexedDB");
+      PopupNotifications.transitionsEnabled = true;
       executeSoon(finish);
     });
 
     registerPopupEventHandler("popupshowing", function () {
       ok(false, "Shouldn't show a popup this time");
     });
     registerPopupEventHandler("popupshown", function () {
       ok(false, "Shouldn't show a popup this time");
--- a/dom/indexedDB/test/browser_permissionsPromptDeny.js
+++ b/dom/indexedDB/test/browser_permissionsPromptDeny.js
@@ -6,16 +6,17 @@
 const testPageURL = "http://mochi.test:8888/browser/" +
   "dom/indexedDB/test/browser_permissionsPrompt.html";
 const notificationID = "indexedDB-permissions-prompt";
 
 function test()
 {
   waitForExplicitFinish();
   // We want the prompt.
+  PopupNotifications.transitionsEnabled = false;
   setPermission(testPageURL, "indexedDB", "allow");
   executeSoon(test1);
 }
 
 function test1()
 {
   info("creating tab");
   gBrowser.selectedTab = gBrowser.addTab();
@@ -63,16 +64,17 @@ function test2()
       ok(!result, "No database created");
       is(exception, "InvalidStateError", "Correct exception");
       is(getPermission(testPageURL, "indexedDB"),
          Components.interfaces.nsIPermissionManager.DENY_ACTION,
          "Correct permission set");
       gBrowser.selectedBrowser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false;
       unregisterAllPopupEventHandlers();
       gBrowser.removeCurrentTab();
+      PopupNotifications.transitionsEnabled = true;
       executeSoon(test3);
     });
 
     registerPopupEventHandler("popupshowing", function () {
       ok(false, "prompt showing");
     });
     registerPopupEventHandler("popupshown", function () {
       ok(false, "prompt shown");
--- a/dom/indexedDB/test/browser_quotaPromptAllow.js
+++ b/dom/indexedDB/test/browser_quotaPromptAllow.js
@@ -7,16 +7,17 @@
 const testPageURL = "http://bug704464-1.example.com/browser/" +
   "dom/indexedDB/test/browser_quotaPrompt.html";
 const notificationID = "indexedDB-quota-prompt";
 
 function test()
 {
   waitForExplicitFinish();
   requestLongerTimeout(10);
+  PopupNotifications.transitionsEnabled = false;
   removePermission(testPageURL, "indexedDB-unlimited");
   Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
   executeSoon(test1);
 }
 
 let addMoreTest1Count = 0;
 
 function test1()
@@ -103,16 +104,17 @@ function test2()
             is(getPermission(testPageURL, "indexedDB-unlimited"),
                Components.interfaces.nsIPermissionManager.ALLOW_ACTION,
                "Correct permission set");
 
             gBrowser.removeCurrentTab();
             unregisterAllPopupEventHandlers();
             removePermission(testPageURL, "indexedDB");
             Services.prefs.clearUserPref("dom.indexedDB.warningQuota");
+            PopupNotifications.transitionsEnabled = true;
             executeSoon(finish);
           });
           executeSoon(function() { dispatchEvent("indexedDB-done"); });
         }
         else {
           ++addMoreCount;
           executeSoon(function() { dispatchEvent("indexedDB-addMore"); });
         }
--- a/dom/indexedDB/test/browser_quotaPromptDatabases.js
+++ b/dom/indexedDB/test/browser_quotaPromptDatabases.js
@@ -7,16 +7,17 @@
 const testPageURL = "http://bug704464-3.example.com/browser/" +
   "dom/indexedDB/test/browser_quotaPromptDatabases.html";
 const notificationID = "indexedDB-quota-prompt";
 
 function test()
 {
   waitForExplicitFinish();
   requestLongerTimeout(10);
+  PopupNotifications.transitionsEnabled = false;
   removePermission(testPageURL, "indexedDB-unlimited");
   Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
   executeSoon(test1);
 }
 
 let addMoreTest1Count = 0;
 
 function test1()
@@ -38,16 +39,17 @@ function test1()
           setFinishedCallback(function(result) {
             is(result, "finished", "Got 'finished' result");
             is(getPermission(testPageURL, "indexedDB-unlimited"),
                Components.interfaces.nsIPermissionManager.ALLOW_ACTION,
                "Correct permission set");
             gBrowser.removeCurrentTab();
             unregisterAllPopupEventHandlers();
             addMoreTest1Count = seenPopupCount;
+            PopupNotifications.transitionsEnabled = true;
             executeSoon(finish);
           });
           executeSoon(function() { dispatchEvent("indexedDB-done"); });
         }
         else {
           ++addMoreTest1Count;
           executeSoon(function() { dispatchEvent("indexedDB-addMore"); });
         }
--- a/dom/indexedDB/test/browser_quotaPromptDelete.js
+++ b/dom/indexedDB/test/browser_quotaPromptDelete.js
@@ -7,16 +7,17 @@
 const testPageURL = "http://bug702292.example.com/browser/" +
   "dom/indexedDB/test/browser_quotaPromptDelete.html";
 const notificationID = "indexedDB-quota-prompt";
 
 function test()
 {
   waitForExplicitFinish();
   requestLongerTimeout(10);
+  PopupNotifications.transitionsEnabled = false;
   removePermission(testPageURL, "indexedDB-unlimited");
   Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
   executeSoon(test1);
 }
 
 let addMoreTest1Count = 0;
 let haveReset = false;
 let secondTimeCount = 0;
@@ -49,16 +50,17 @@ function test1()
               } else {
                 setFinishedCallback(function(result) {
                   is(result, "finished", "Got 'finished' result");
                   is(getPermission(testPageURL, "indexedDB-unlimited"),
                      Components.interfaces.nsIPermissionManager.DENY_ACTION,
                      "Correct permission set");
                   gBrowser.removeCurrentTab();
                   unregisterAllPopupEventHandlers();
+                  PopupNotifications.transitionsEnabled = true;
                   executeSoon(finish);
                 });
                 executeSoon(function() { dispatchEvent("indexedDB-done"); });
               }
             }
 
             function secondTimeThroughAddMore() {
               setFinishedCallback(secondTimeThroughCallback);
--- a/dom/indexedDB/test/browser_quotaPromptDeny.js
+++ b/dom/indexedDB/test/browser_quotaPromptDeny.js
@@ -7,16 +7,17 @@
 const testPageURL = "http://bug704464-2.example.com/browser/" +
   "dom/indexedDB/test/browser_quotaPrompt.html";
 const notificationID = "indexedDB-quota-prompt";
 
 function test()
 {
   waitForExplicitFinish();
   requestLongerTimeout(10);
+  PopupNotifications.transitionsEnabled = false;
   removePermission(testPageURL, "indexedDB-unlimited");
   Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
   executeSoon(test1);
 }
 
 let addMoreTest1Count = 0;
 
 function test1()
@@ -43,16 +44,17 @@ function test1()
           setFinishedCallback(function(result) {
             is(result, "finished", "Got 'finished' result");
             is(getPermission(testPageURL, "indexedDB-unlimited"),
                Components.interfaces.nsIPermissionManager.DENY_ACTION,
                "Correct permission set");
             gBrowser.removeCurrentTab();
             unregisterAllPopupEventHandlers();
             addMoreTest1Count = seenPopupCount;
+            PopupNotifications.transitionsEnabled = true;
             executeSoon(test2);
           });
           executeSoon(function() { dispatchEvent("indexedDB-done"); });
         }
         else {
           ++addMoreTest1Count;
           executeSoon(function() { dispatchEvent("indexedDB-addMore"); });
         }
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -151,16 +151,30 @@ PopupNotifications.prototype = {
       iconBox.addEventListener("keypress", this, false);
     }
   },
   get iconBox() {
     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
    *        The Notification ID to search for.
    * @param browser
    *        The browser whose notifications should be searched. If null, the
    *        currently selected browser's notifications will be searched.
    *
    * @returns the corresponding Notification object, or null if no such