fune/browser/base/content/test/tabs/browser_tab_manager_visibility.js
Emilio Cobos Álvarez 0fc9c3ee58 Bug 1729795 - Clean up openNewWindowWithFlushedXULCacheForMozSupports. r=jaws,extension-reviewers,zombie
The only test that still needs it is browser_tab_manager_visibility.js.
The rest look like proton leftovers.

After bug 1729477 those sheets are stored in the shared style sheet
cache, not in the XUL prototype cache, so remove that.

Differential Revision: https://phabricator.services.mozilla.com/D124983
2021-09-14 10:43:49 +00:00

53 lines
1.7 KiB
JavaScript

/**
* Test the Tab Manager visibility respects browser.tabs.tabmanager.enabled preference
* */
"use strict";
// The hostname for the test URIs.
const TEST_HOSTNAME = "https://example.com";
const DUMMY_PAGE_PATH = "/browser/base/content/test/tabs/dummy_page.html";
add_task(async function tab_manager_visibility_preference_on() {
Services.prefs.setBoolPref("browser.tabs.tabmanager.enabled", true);
let newWindow = await BrowserTestUtils.openNewWindowWithFlushedCacheForMozSupports();
await BrowserTestUtils.withNewTab(
{
gBrowser: newWindow.gBrowser,
url: TEST_HOSTNAME + DUMMY_PAGE_PATH,
},
async function(browser) {
await Assert.ok(
BrowserTestUtils.is_visible(
newWindow.document.getElementById("alltabs-button")
),
"tab manage menu is visible when browser.tabs.tabmanager.enabled preference is set to true"
);
}
);
Services.prefs.clearUserPref("browser.tabs.tabmanager.enabled");
BrowserTestUtils.closeWindow(newWindow);
});
add_task(async function tab_manager_visibility_preference_off() {
Services.prefs.setBoolPref("browser.tabs.tabmanager.enabled", false);
let newWindow = await BrowserTestUtils.openNewWindowWithFlushedCacheForMozSupports();
await BrowserTestUtils.withNewTab(
{
gBrowser: newWindow.gBrowser,
url: TEST_HOSTNAME + DUMMY_PAGE_PATH,
},
async function(browser) {
await Assert.ok(
BrowserTestUtils.is_hidden(
newWindow.document.getElementById("alltabs-button")
),
"tab manage menu is hidden when browser.tabs.tabmanager.enabled preference is set to true"
);
}
);
Services.prefs.clearUserPref("browser.tabs.tabmanager.enabled");
BrowserTestUtils.closeWindow(newWindow);
});