mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1206133 - Fix browser chrome mochitests broken by the popuppositioned patch. r=enn
--HG-- extra : rebase_source : d2aa631217a36a67a1becc3e65a6d8c81e079860
This commit is contained in:
parent
a40373dd0a
commit
b20fbb66ac
@ -41,7 +41,11 @@ add_task(function* shift_left_click_test() {
|
|||||||
|
|
||||||
// Wait for the initial browser to load.
|
// Wait for the initial browser to load.
|
||||||
let browser = win.gBrowser.selectedBrowser;
|
let browser = win.gBrowser.selectedBrowser;
|
||||||
yield BrowserTestUtils.browserLoaded(browser);
|
let destinationURL = "http://" + TEST_VALUE + "/";
|
||||||
|
yield Promise.all([
|
||||||
|
BrowserTestUtils.browserLoaded(browser),
|
||||||
|
BrowserTestUtils.waitForLocationChange(win.gBrowser, destinationURL)
|
||||||
|
]);
|
||||||
|
|
||||||
info("URL should be loaded in a new window");
|
info("URL should be loaded in a new window");
|
||||||
is(gURLBar.value, "", "Urlbar reverted to original value");
|
is(gURLBar.value, "", "Urlbar reverted to original value");
|
||||||
|
@ -45,12 +45,15 @@ add_task(function* testAddOnBeforeCreatedWidget() {
|
|||||||
try {
|
try {
|
||||||
widgetNode.click();
|
widgetNode.click();
|
||||||
|
|
||||||
|
let tempPanel = document.getElementById("customizationui-widget-panel");
|
||||||
|
let panelShownPromise = promisePanelElementShown(window, tempPanel);
|
||||||
|
|
||||||
let shownTimeout = setTimeout(() => viewShownDeferred.reject("Panel not shown within 20s"), 20000);
|
let shownTimeout = setTimeout(() => viewShownDeferred.reject("Panel not shown within 20s"), 20000);
|
||||||
yield viewShownDeferred.promise;
|
yield viewShownDeferred.promise;
|
||||||
|
yield panelShownPromise;
|
||||||
clearTimeout(shownTimeout);
|
clearTimeout(shownTimeout);
|
||||||
ok(true, "Found view shown");
|
ok(true, "Found view shown");
|
||||||
|
|
||||||
let tempPanel = document.getElementById("customizationui-widget-panel");
|
|
||||||
let panelHiddenPromise = promisePanelElementHidden(window, tempPanel);
|
let panelHiddenPromise = promisePanelElementHidden(window, tempPanel);
|
||||||
tempPanel.hidePopup();
|
tempPanel.hidePopup();
|
||||||
yield panelHiddenPromise;
|
yield panelHiddenPromise;
|
||||||
|
@ -82,9 +82,11 @@ var showSidebarPopup = Task.async(function*() {
|
|||||||
let button = document.getElementById("sidebar-button");
|
let button = document.getElementById("sidebar-button");
|
||||||
let subview = document.getElementById("PanelUI-sidebar");
|
let subview = document.getElementById("PanelUI-sidebar");
|
||||||
|
|
||||||
|
let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
|
||||||
|
|
||||||
let subviewShownPromise = subviewShown(subview);
|
let subviewShownPromise = subviewShown(subview);
|
||||||
EventUtils.synthesizeMouseAtCenter(button, {});
|
EventUtils.synthesizeMouseAtCenter(button, {});
|
||||||
return subviewShownPromise;
|
return Promise.all([subviewShownPromise, popupShownPromise]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check the sidebar widget shows the default items
|
// Check the sidebar widget shows the default items
|
||||||
|
@ -297,6 +297,34 @@ this.BrowserTestUtils = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits for onLocationChange.
|
||||||
|
*
|
||||||
|
* @param {tabbrowser} tabbrowser
|
||||||
|
* The tabbrowser to wait for the location change on.
|
||||||
|
* @param {string} url
|
||||||
|
* The string URL to look for. The URL must match the URL in the
|
||||||
|
* location bar exactly.
|
||||||
|
* @return {Promise}
|
||||||
|
* @resolves When onLocationChange fires.
|
||||||
|
*/
|
||||||
|
waitForLocationChange(tabbrowser, url) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let progressListener = {
|
||||||
|
onLocationChange(aBrowser) {
|
||||||
|
if ((url && aBrowser.currentURI.spec != url) ||
|
||||||
|
(!url && aBrowser.currentURI.spec == "about:blank")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tabbrowser.removeTabsProgressListener(progressListener);
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
tabbrowser.addTabsProgressListener(progressListener);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for the next browser window to open and be fully loaded.
|
* Waits for the next browser window to open and be fully loaded.
|
||||||
*
|
*
|
||||||
|
@ -38,7 +38,8 @@ add_task(function* test_fill() {
|
|||||||
yield promiseAnchorShown;
|
yield promiseAnchorShown;
|
||||||
|
|
||||||
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
|
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
|
||||||
"Shown");
|
"popupshown");
|
||||||
|
|
||||||
anchor.click();
|
anchor.click();
|
||||||
yield promiseShown;
|
yield promiseShown;
|
||||||
|
|
||||||
@ -47,9 +48,14 @@ add_task(function* test_fill() {
|
|||||||
"list.childNodes.length === 1");
|
"list.childNodes.length === 1");
|
||||||
|
|
||||||
// The button will be focused after the "transitionend" event.
|
// The button will be focused after the "transitionend" event.
|
||||||
list.focus();
|
|
||||||
yield new Promise(resolve => executeSoon(resolve));
|
|
||||||
let details = document.getElementById("login-fill-details");
|
let details = document.getElementById("login-fill-details");
|
||||||
|
let promiseListFocus = BrowserTestUtils.waitForEvent(list, "focus");
|
||||||
|
let promiseSubviewHidden = BrowserTestUtils.waitForEvent(details,
|
||||||
|
"transitionend",
|
||||||
|
true,
|
||||||
|
e => e.target == details);
|
||||||
|
list.focus();
|
||||||
|
yield Promise.all([promiseListFocus, promiseSubviewHidden]);
|
||||||
let promiseSubview = BrowserTestUtils.waitForEvent(details,
|
let promiseSubview = BrowserTestUtils.waitForEvent(details,
|
||||||
"transitionend", true,
|
"transitionend", true,
|
||||||
e => e.target == details);
|
e => e.target == details);
|
||||||
|
@ -162,7 +162,7 @@ add_task(function* test_edit_username() {
|
|||||||
// Modify the username in the dialog if requested.
|
// Modify the username in the dialog if requested.
|
||||||
if (testCase.usernameChangedTo) {
|
if (testCase.usernameChangedTo) {
|
||||||
notificationElement.querySelector("#password-notification-username")
|
notificationElement.querySelector("#password-notification-username")
|
||||||
.setAttribute("value", testCase.usernameChangedTo);
|
.value = testCase.usernameChangedTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We expect a modifyLogin notification if the final username used by the
|
// We expect a modifyLogin notification if the final username used by the
|
||||||
@ -288,13 +288,13 @@ add_task(function* test_edit_password() {
|
|||||||
// Modify the username in the dialog if requested.
|
// Modify the username in the dialog if requested.
|
||||||
if (testCase.usernameChangedTo) {
|
if (testCase.usernameChangedTo) {
|
||||||
notificationElement.querySelector("#password-notification-username")
|
notificationElement.querySelector("#password-notification-username")
|
||||||
.setAttribute("value", testCase.usernameChangedTo);
|
.value = testCase.usernameChangedTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify the password in the dialog if requested.
|
// Modify the password in the dialog if requested.
|
||||||
if (testCase.passwordChangedTo) {
|
if (testCase.passwordChangedTo) {
|
||||||
notificationElement.querySelector("#password-notification-password")
|
notificationElement.querySelector("#password-notification-password")
|
||||||
.setAttribute("value", testCase.passwordChangedTo);
|
.value = testCase.passwordChangedTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We expect a modifyLogin notification if the final username used by the
|
// We expect a modifyLogin notification if the final username used by the
|
||||||
|
Loading…
Reference in New Issue
Block a user