diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /browser/base/content/test/popupNotifications/browser_reshow_in_background.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/base/content/test/popupNotifications/browser_reshow_in_background.js')
-rw-r--r-- | browser/base/content/test/popupNotifications/browser_reshow_in_background.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/browser/base/content/test/popupNotifications/browser_reshow_in_background.js b/browser/base/content/test/popupNotifications/browser_reshow_in_background.js new file mode 100644 index 000000000..6f415f62e --- /dev/null +++ b/browser/base/content/test/popupNotifications/browser_reshow_in_background.js @@ -0,0 +1,52 @@ +"use strict"; + +/** + * Tests that when PopupNotifications for background tabs are reshown, they + * don't show up in the foreground tab, but only in the background tab that + * they belong to. + */ +add_task(function* test_background_notifications_dont_reshow_in_foreground() { + // Our initial tab will be A. Let's open two more tabs B and C, but keep + // A selected. Then, we'll trigger a PopupNotification in C, and then make + // it reshow. + let tabB = gBrowser.addTab("about:blank"); + let tabC = gBrowser.addTab("about:blank"); + + let seenEvents = []; + + let options = { + dismissed: false, + eventCallback(popupEvent) { + seenEvents.push(popupEvent); + }, + }; + + let notification = + PopupNotifications.show(tabC.linkedBrowser, "test-notification", + "", "plugins-notification-icon", + null, null, options); + Assert.deepEqual(seenEvents, [], "Should have seen no events yet."); + + yield BrowserTestUtils.switchTab(gBrowser, tabB); + Assert.deepEqual(seenEvents, [], "Should have seen no events yet."); + + notification.reshow(); + Assert.deepEqual(seenEvents, [], "Should have seen no events yet."); + + let panelShown = + BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown"); + yield BrowserTestUtils.switchTab(gBrowser, tabC); + yield panelShown; + + Assert.equal(seenEvents.length, 2, "Should have seen two events."); + Assert.equal(seenEvents[0], "showing", "Should have said popup was showing."); + Assert.equal(seenEvents[1], "shown", "Should have said popup was shown."); + + let panelHidden = + BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popuphidden"); + PopupNotifications.remove(notification); + yield panelHidden; + + yield BrowserTestUtils.removeTab(tabB); + yield BrowserTestUtils.removeTab(tabC); +}); |