mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
While we are now correctly evaluating the fullscreen situation in OSX so that our update doorhangers behave as if we're in windowed mode, we aren't correctly listening for state changes. This addresses that, and tries to limit the chattiness by only listening to the fullscreen events that we care about. MozReview-Commit-ID: 9J009l4w21E --HG-- extra : rebase_source : cfb6e65fe65f3b636212dcca95345f3ab7ea862e
57 lines
2.6 KiB
JavaScript
57 lines
2.6 KiB
JavaScript
"use strict";
|
|
|
|
Cu.import("resource://gre/modules/AppMenuNotifications.jsm");
|
|
|
|
add_task(async function testFullscreen() {
|
|
if (Services.appinfo.OS !== "Darwin") {
|
|
await SpecialPowers.pushPrefEnv({
|
|
set: [
|
|
["browser.fullscreen.autohide", false],
|
|
]});
|
|
}
|
|
|
|
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
|
|
let mainActionCalled = false;
|
|
let mainAction = {
|
|
callback: () => { mainActionCalled = true; }
|
|
};
|
|
AppMenuNotifications.showNotification("update-manual", mainAction);
|
|
|
|
isnot(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is showing.");
|
|
let notifications = [...PanelUI.notificationPanel.children].filter(n => !n.hidden);
|
|
is(notifications.length, 1, "PanelUI doorhanger is only displaying one notification.");
|
|
let doorhanger = notifications[0];
|
|
is(doorhanger.id, "appMenu-update-manual-notification", "PanelUI is displaying the update-manual notification.");
|
|
|
|
let fullscreenPromise = BrowserTestUtils.waitForEvent(window, "fullscreen");
|
|
EventUtils.synthesizeKey("VK_F11", {});
|
|
await fullscreenPromise;
|
|
isnot(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is still showing after entering fullscreen.");
|
|
|
|
let popuphiddenPromise = BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popuphidden");
|
|
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async () => {
|
|
content.document.documentElement.requestFullscreen();
|
|
});
|
|
await popuphiddenPromise;
|
|
await new Promise(executeSoon);
|
|
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is hidden after entering DOM fullscreen.");
|
|
|
|
let popupshownPromise = BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popupshown");
|
|
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async () => {
|
|
content.document.exitFullscreen();
|
|
});
|
|
await popupshownPromise;
|
|
await new Promise(executeSoon);
|
|
isnot(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is shown after exiting DOM fullscreen.");
|
|
isnot(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is not displaying on PanelUI button.");
|
|
|
|
let mainActionButton = document.getAnonymousElementByAttribute(doorhanger, "anonid", "button");
|
|
mainActionButton.click();
|
|
ok(mainActionCalled, "Main action callback was called");
|
|
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
|
|
is(PanelUI.menuButton.hasAttribute("badge-status"), false, "Should not have a badge status");
|
|
|
|
fullscreenPromise = BrowserTestUtils.waitForEvent(window, "fullscreen");
|
|
EventUtils.synthesizeKey("VK_F11", {});
|
|
await fullscreenPromise;
|
|
});
|