Bug 1324497 - Wait for popupshow to fix intermittent in browser_popupNotification_checkbox.js. r=past
MozReview-Commit-ID: 3EvJ5Sr7vTM
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
@@ -143,19 +143,21 @@ var tests = [
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
checkCheckbox(checkbox, "This is a checkbox");
yield promiseElementVisible(checkbox);
EventUtils.synthesizeMouseAtCenter(checkbox, {});
dismissNotification(popup);
},
- onHidden(popup) {
+ *onHidden(popup) {
let icon = document.getElementById("default-notification-icon");
+ let shown = waitForNotificationPanel();
EventUtils.synthesizeMouseAtCenter(icon, {});
+ yield shown;
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
checkCheckbox(checkbox, "This is a checkbox", true);
checkMainAction(notification, true);
gNotification.remove();
}
},
];
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -96,18 +96,18 @@ function* runNextTest() {
onPopupEvent("popupshown", function() {
shownState = true;
info("[" + nextTest.id + "] popup shown");
Task.spawn(() => nextTest.onShown(this))
.then(undefined, ex => Assert.ok(false, "onShown failed: " + ex));
});
onPopupEvent("popuphidden", function() {
info("[" + nextTest.id + "] popup hidden");
- nextTest.onHidden(this);
- goNext();
+ Task.spawn(() => nextTest.onHidden(this))
+ .then(() => goNext(), ex => Assert.ok(false, "onHidden failed: " + ex));
}, () => shownState);
info("[" + nextTest.id + "] added listeners; panel is open: " + PopupNotifications.isPanelOpen);
}
info("[" + nextTest.id + "] running test");
yield nextTest.run();
}