Bug 1306786 - Fix intermittent test failure in browser/base/content/test/popupNotifications/browser_popupNotification_4.js. r=enndeakin

This commit is contained in:
Kirk Steuber 2016-10-17 15:59:22 -07:00
parent 31bdfd3ad3
commit 70f71d2a08

View File

@ -118,6 +118,9 @@ var tests = [
// Moving a tab to a new window should preserve swappable notifications.
{ id: "Test#6",
run: function* () {
let originalBrowser = gBrowser.selectedBrowser;
let originalWindow = window;
gBrowser.selectedTab = gBrowser.addTab("about:blank");
let notifyObj = new BasicNotification(this.id);
let originalCallback = notifyObj.options.eventCallback;
@ -146,7 +149,17 @@ var tests = [
checkPopup(win.PopupNotifications.panel, notifyObj);
ok(notifyObj.swappingCallbackTriggered, "the swapping callback was triggered");
win.close();
yield BrowserTestUtils.closeWindow(win);
// These are the same checks that PopupNotifications.jsm makes before it
// allows a notification to open. Do not go to the next test until we are
// sure that its attempt to display a notification will not fail.
yield BrowserTestUtils.waitForCondition(() => originalBrowser.docShellIsActive,
"The browser should be active");
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
yield BrowserTestUtils.waitForCondition(() => fm.activeWindow == originalWindow,
"The window should be active")
goNext();
}
},