Bug 1385882 - Intermittent browser/base/content/test/urlbar/browser_page_action_menu.js | Test timed out. r=Gijs

MozReview-Commit-ID: H6BtvGNtMmQ

--HG--
extra : rebase_source : ac0bc23ebe47d9b5669036a56e0b6e39e7994ff7
This commit is contained in:
Drew Willcoxon 2017-10-05 12:45:15 -07:00
parent 9b32fa2895
commit 91dcf7e9cf
2 changed files with 30 additions and 17 deletions

View File

@ -199,8 +199,7 @@ var BrowserPageActions = {
panelNode.setAttribute("tabspecific", "true");
panelNode.setAttribute("photon", "true");
// For tests.
if (this._disableActivatedActionPanelAnimation) {
if (this._disablePanelAnimations) {
panelNode.setAttribute("animate", "false");
}
@ -252,6 +251,19 @@ var BrowserPageActions = {
return panelNode;
},
// For tests.
get _disablePanelAnimations() {
return this.__disablePanelAnimations || false;
},
set _disablePanelAnimations(val) {
this.__disablePanelAnimations = val;
if (val) {
this.panelNode.setAttribute("animate", "false");
} else {
this.panelNode.removeAttribute("animate");
}
},
/**
* Returns the node in the urlbar to which popups for the given action should
* be anchored. If the action is null, a sensible anchor is returned.
@ -740,16 +752,16 @@ var BrowserPageActionFeedback = {
this.panelNode.addEventListener("popupshown", () => {
this.feedbackAnimationBox.setAttribute("animate", "true");
// The timeout value used here allows the panel to stay open for
// 1 second after the text transition (duration=120ms) has finished.
setTimeout(() => {
this.panelNode.hidePopup(true);
}, Services.prefs.getIntPref("browser.pageActions.feedbackTimeoutMS", 1120));
}, {once: true});
this.panelNode.addEventListener("popuphidden", () => {
this.feedbackAnimationBox.removeAttribute("animate");
}, {once: true});
// The timeout value used here allows the panel to stay open for
// 1 second after the text transition (duration=120ms) has finished.
setTimeout(() => {
this.panelNode.hidePopup(true);
}, Services.prefs.getIntPref("browser.pageActions.feedbackTimeoutMS", 1120));
},
};

View File

@ -1,20 +1,27 @@
"use strict";
/* global sinon */
/* global sinon, UIState */
Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
registerCleanupFunction(function() {
delete window.sinon;
});
Cu.import("resource://services-sync/UIState.jsm");
const mockRemoteClients = [
{ id: "0", name: "foo", type: "mobile" },
{ id: "1", name: "bar", type: "desktop" },
{ id: "2", name: "baz", type: "mobile" },
];
add_task(async function init() {
// Disable panel animations. They cause intermittent timeouts on Linux when
// the test tries to synthesize clicks on items in newly opened panels.
BrowserPageActions._disablePanelAnimations = true;
registerCleanupFunction(() => {
BrowserPageActions._disablePanelAnimations = false;
});
});
add_task(async function bookmark() {
// Open a unique page.
let url = "http://example.com/browser_page_action_menu";
@ -486,11 +493,6 @@ add_task(async function sendToDevice_inUrlbar() {
};
registerCleanupFunction(cleanUp);
// Disable the activated-action panel animation when it opens. Otherwise
// it's necessary to wait a moment before trying to click the device menu
// item below.
BrowserPageActions._disableActivatedActionPanelAnimation = true;
// Add Send to Device to the urlbar.
let action = PageActions.actionForID("sendToDevice");
action.shownInUrlbar = true;
@ -572,7 +574,6 @@ add_task(async function sendToDevice_inUrlbar() {
// Remove Send to Device from the urlbar.
action.shownInUrlbar = false;
BrowserPageActions._disableActivatedActionPanelAnimation = false;
cleanUp();
});