Bug 1694817 - Fix tests that fail with browser.proton.toolbar.enabled r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D107294
This commit is contained in:
Mark Striemer 2021-03-11 15:09:21 +00:00
Родитель ba18d9627d
Коммит 570cccef25
24 изменённых файлов: 265 добавлений и 29 удалений

Просмотреть файл

@ -10,6 +10,18 @@ function focus_in_navbar() {
}
function test() {
if (CustomizableUI.protonToolbarEnabled) {
// Put the home button in the pre-proton placement to test focus states.
CustomizableUI.addWidgetToArea(
"home-button",
"nav-bar",
CustomizableUI.getPlacementOfWidget("stop-reload-button").position + 1
);
registerCleanupFunction(async function resetToolbar() {
await CustomizableUI.reset();
});
}
waitForExplicitFinish();
tab1 = BrowserTestUtils.addTab(gBrowser, "about:blank", {

Просмотреть файл

@ -1,6 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function setupHomeButton() {
if (CustomizableUI.protonToolbarEnabled) {
// Put the home button in the pre-proton placement to test focus states.
CustomizableUI.addWidgetToArea(
"home-button",
"nav-bar",
CustomizableUI.getPlacementOfWidget("stop-reload-button").position + 1
);
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
}
registerCleanupFunction(async function resetToolbar() {
await CustomizableUI.reset();
});
});
add_task(async function() {
let HOMEPAGE_PREF = "browser.startup.homepage";

Просмотреть файл

@ -193,8 +193,8 @@ async function drop(dragData, expectedURLs) {
// Since synthesizeDrop triggers the srcElement, need to use another button
// that should be visible.
let dragSrcElement = document.getElementById("sidebar-button");
ok(dragSrcElement, "Sidebar button exists");
let dragSrcElement = document.getElementById("back-button");
ok(dragSrcElement, "Back button exists");
let newTabButton = document.getElementById(
gBrowser.tabContainer.hasAttribute("overflow")
? "new-tab-button"

Просмотреть файл

@ -39,6 +39,13 @@ add_task(async function test_setup() {
CustomizableUI.removeWidgetFromArea("new-window-button");
});
}
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("sidebar-button")
);
}
});
// New Window Button opens any link.

Просмотреть файл

@ -60,6 +60,9 @@ add_task(async function testAppMenuButtonWrongKey() {
// Test activation of the Library button from the keyboard.
// The Library menu should appear and focus should move inside it.
add_task(async function testLibraryButtonPress() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("library-button", "nav-bar");
}
let button = document.getElementById("library-button");
forceFocus(button);
EventUtils.synthesizeKey(" ");
@ -70,6 +73,9 @@ add_task(async function testLibraryButtonPress() {
let hidden = BrowserTestUtils.waitForEvent(document, "popuphidden", true);
view.closest("panel").hidePopup();
await hidden;
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.removeWidgetFromArea("library-button");
}
});
// Test activation of the Developer button from the keyboard.
@ -196,6 +202,9 @@ add_task(async function testReloadButtonPress() {
// Test activation of the Sidebars button from the keyboard.
// This is a toolbarbutton with a command handler.
add_task(async function testSidebarsButtonPress() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
}
let button = document.getElementById("sidebar-button");
ok(!button.checked, "Sidebars button not checked at start of test");
let sidebarBox = document.getElementById("sidebar-box");
@ -216,6 +225,9 @@ add_task(async function testSidebarsButtonPress() {
await TestUtils.waitForCondition(() => !button.checked);
ok(true, "Sidebars button not checked after press");
ok(sidebarBox.hidden, "Sidebar hidden after press");
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.removeWidgetFromArea("sidebar-button");
}
});
// Test activation of the Bookmark this page button from the keyboard.

Просмотреть файл

@ -11,6 +11,9 @@
const PERMISSIONS_PAGE =
"https://example.com/browser/browser/base/content/test/permissions/permissions.html";
const afterUrlBarButton = CustomizableUI.protonToolbarEnabled
? "PanelUI-menu-button"
: "library-button";
// The DevEdition has the DevTools button in the toolbar by default. Remove it
// to prevent branch-specific rules what button should be focused.
@ -19,6 +22,57 @@ function resetToolbarWithoutDevEditionButtons() {
CustomizableUI.removeWidgetFromArea("developer-button");
}
function maybeAddHomeBesideReload() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea(
"home-button",
"nav-bar",
CustomizableUI.getPlacementOfWidget("stop-reload-button").position + 1
);
}
}
function maybeRemoveHomeButton() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.removeWidgetFromArea("home-button");
}
}
function maybeAddOldMenuSideButtons() {
if (CustomizableUI.protonToolbarEnabled) {
// Make the FxA button visible even though we're signed out.
// We'll use oldfxastatus to restore the old state.
document.documentElement.setAttribute(
"oldfxastatus",
document.documentElement.getAttribute("fxastatus")
);
document.documentElement.setAttribute("fxastatus", "signed_in");
// The FxA button is supposed to be last, add these buttons before it.
CustomizableUI.addWidgetToArea(
"library-button",
"nav-bar",
CustomizableUI.getWidgetIdsInArea("nav-bar").length - 1
);
CustomizableUI.addWidgetToArea(
"sidebar-button",
"nav-bar",
CustomizableUI.getWidgetIdsInArea("nav-bar").length - 1
);
}
}
function maybeRemoveOldMenuSideButtons() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.removeWidgetFromArea("library-button");
CustomizableUI.removeWidgetFromArea("sidebar-button");
document.documentElement.setAttribute(
"fxastatus",
document.documentElement.getAttribute("oldfxastatus")
);
document.documentElement.removeAttribute("oldfxastatus");
}
}
function startFromUrlBar(aWindow = window) {
aWindow.gURLBar.focus();
is(
@ -72,16 +126,18 @@ add_task(async function setup() {
});
// Test tab stops with no page loaded.
add_task(async function testTabStopsNoPage() {
add_task(async function testTabStopsNoPageWithHomeButton() {
maybeAddHomeBesideReload();
await withNewBlankTab(async function() {
startFromUrlBar();
await expectFocusAfterKey("Shift+Tab", "home-button");
await expectFocusAfterKey("Shift+Tab", "tabbrowser-tabs", true);
await expectFocusAfterKey("Tab", "home-button");
await expectFocusAfterKey("Tab", gURLBar.inputField);
await expectFocusAfterKey("Tab", "library-button");
await expectFocusAfterKey("Tab", afterUrlBarButton);
await expectFocusAfterKey("Tab", gBrowser.selectedBrowser);
});
maybeRemoveHomeButton();
});
// Test tab stops with a page loaded.
@ -99,7 +155,7 @@ add_task(async function testTabStopsPageLoaded() {
await expectFocusAfterKey("Tab", "tracking-protection-icon-container");
await expectFocusAfterKey("Tab", gURLBar.inputField);
await expectFocusAfterKey("Tab", "pageActionButton");
await expectFocusAfterKey("Tab", "library-button");
await expectFocusAfterKey("Tab", afterUrlBarButton);
await expectFocusAfterKey("Tab", gBrowser.selectedBrowser);
});
});
@ -130,14 +186,14 @@ add_task(async function testTabStopsWithBookmarksToolbar() {
await BrowserTestUtils.withNewTab("about:blank", async function() {
CustomizableUI.setToolbarVisibility("PersonalToolbar", true);
startFromUrlBar();
await expectFocusAfterKey("Tab", "library-button");
await expectFocusAfterKey("Tab", afterUrlBarButton);
await expectFocusAfterKey("Tab", "PersonalToolbar", true);
await expectFocusAfterKey("Tab", gBrowser.selectedBrowser);
// Make sure the Bookmarks toolbar is no longer tabbable once hidden.
CustomizableUI.setToolbarVisibility("PersonalToolbar", false);
startFromUrlBar();
await expectFocusAfterKey("Tab", "library-button");
await expectFocusAfterKey("Tab", afterUrlBarButton);
await expectFocusAfterKey("Tab", gBrowser.selectedBrowser);
});
});
@ -152,8 +208,10 @@ add_task(async function testTabStopNoButtons() {
await expectFocusAfterKey("Shift+Tab", "tabbrowser-tabs", true);
await expectFocusAfterKey("Tab", gURLBar.inputField);
resetToolbarWithoutDevEditionButtons();
maybeAddHomeBesideReload();
// Make sure the button is reachable now that it has been re-added.
await expectFocusAfterKey("Shift+Tab", "home-button", true);
maybeRemoveHomeButton();
});
});
@ -163,6 +221,7 @@ add_task(async function testTabStopNoButtons() {
// 2. The overflow menu button can't be reached by right arrow when it isn't
// visible.
add_task(async function testArrowsToolbarbuttons() {
maybeAddOldMenuSideButtons();
await BrowserTestUtils.withNewTab("about:blank", async function() {
startFromUrlBar();
await expectFocusAfterKey("Tab", "library-button");
@ -187,6 +246,7 @@ add_task(async function testArrowsToolbarbuttons() {
await expectFocusAfterKey("ArrowLeft", "sidebar-button");
await expectFocusAfterKey("ArrowLeft", "library-button");
});
maybeRemoveOldMenuSideButtons();
});
// Test that right/left arrows move through buttons wihch aren't toolbarbuttons
@ -238,6 +298,7 @@ add_task(async function testArrowsDisabledButtons() {
// Test that right arrow reaches the overflow menu button when it is visible.
add_task(async function testArrowsOverflowButton() {
maybeAddOldMenuSideButtons();
await BrowserTestUtils.withNewTab("about:blank", async function() {
// Move something to the overflow menu to make the button appear.
CustomizableUI.addWidgetToArea(
@ -256,6 +317,7 @@ add_task(async function testArrowsOverflowButton() {
document.getElementById("nav-bar-overflow-button").clientWidth;
await expectFocusAfterKey("ArrowLeft", "fxa-toolbar-menu-button");
});
maybeRemoveOldMenuSideButtons();
});
// Test that toolbar keyboard navigation doesn't interfere with PanelMultiView
@ -263,6 +325,7 @@ add_task(async function testArrowsOverflowButton() {
// We do this by opening the Library menu and ensuring that pressing left arrow
// does nothing.
add_task(async function testArrowsInPanelMultiView() {
maybeAddOldMenuSideButtons();
let button = document.getElementById("library-button");
forceFocus(button);
EventUtils.synthesizeKey(" ");
@ -279,10 +342,12 @@ add_task(async function testArrowsInPanelMultiView() {
let hidden = BrowserTestUtils.waitForEvent(document, "popuphidden", true);
view.closest("panel").hidePopup();
await hidden;
maybeRemoveOldMenuSideButtons();
});
// Test that right/left arrows move in the expected direction for RTL locales.
add_task(async function testArrowsRtl() {
maybeAddOldMenuSideButtons();
await SpecialPowers.pushPrefEnv({ set: [["intl.l10n.pseudo", "bidi"]] });
// window.RTL_UI doesn't update in existing windows when this pref is changed,
// so we need to test in a new window.
@ -298,6 +363,7 @@ add_task(async function testArrowsRtl() {
await expectFocusAfterKey("ArrowLeft", "sidebar-button", false, win);
await BrowserTestUtils.closeWindow(win);
await SpecialPowers.popPrefEnv();
maybeRemoveOldMenuSideButtons();
});
// Test that right arrow reaches the overflow menu button on the Bookmarks
@ -330,6 +396,7 @@ registerCleanupFunction(async function() {
// Test that when a toolbar button opens a panel, closing the panel restores
// focus to the button which opened it.
add_task(async function testPanelCloseRestoresFocus() {
maybeAddOldMenuSideButtons();
await withNewBlankTab(async function() {
// We can't use forceFocus because that removes focusability immediately.
// Instead, we must let ToolbarKeyboardNavigator handle this properly.
@ -348,6 +415,7 @@ add_task(async function testPanelCloseRestoresFocus() {
"Focus restored to Library button after panel closed"
);
});
maybeRemoveOldMenuSideButtons();
});
// Test that the arrow key works in the group of the
@ -377,6 +445,8 @@ add_task(async function testArrowKeyForTPIconContainerandIdentityBox() {
// Test navigation by typed characters.
add_task(async function testCharacterNavigation() {
maybeAddHomeBesideReload();
maybeAddOldMenuSideButtons();
await BrowserTestUtils.withNewTab("https://example.com", async function() {
await waitUntilReloadEnabled();
startFromUrlBar();
@ -401,6 +471,8 @@ add_task(async function testCharacterNavigation() {
// Pressing s again should find the next button starting with s: Sidebars.
await expectFocusAfterKey("s", "sidebar-button");
});
maybeRemoveHomeButton();
maybeRemoveOldMenuSideButtons();
});
// Test that toolbar character navigation doesn't trigger in PanelMultiView for
@ -410,6 +482,7 @@ add_task(async function testCharacterNavigation() {
// This test should be removed if PanelMultiView implements character
// navigation.
add_task(async function testCharacterInPanelMultiView() {
maybeAddOldMenuSideButtons();
let button = document.getElementById("library-button");
forceFocus(button);
let view = document.getElementById("appMenu-libraryView");
@ -422,10 +495,12 @@ add_task(async function testCharacterInPanelMultiView() {
let hidden = BrowserTestUtils.waitForEvent(document, "popuphidden", true);
view.closest("panel").hidePopup();
await hidden;
maybeRemoveOldMenuSideButtons();
});
// Test tab stops after the search bar is added.
add_task(async function testTabStopsAfterSearchBarAdded() {
maybeAddOldMenuSideButtons();
await SpecialPowers.pushPrefEnv({
set: [["browser.search.widget.inNavBar", 1]],
});
@ -435,4 +510,5 @@ add_task(async function testTabStopsAfterSearchBarAdded() {
await expectFocusAfterKey("Tab", "library-button");
});
await SpecialPowers.popPrefEnv();
maybeRemoveOldMenuSideButtons();
});

Просмотреть файл

@ -12,6 +12,15 @@ function failIfSidebarFocusedFires() {
ok(false, "This event shouldn't have fired");
}
add_task(function setup() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("sidebar-button")
);
}
});
add_task(async function testAdoptedTwoWindows() {
// First open a new window, show the sidebar in that window, and close it.
// Then, open another new window and confirm that the sidebar is closed since it is

Просмотреть файл

@ -16,6 +16,17 @@ registerCleanupFunction(async function resetToolbar() {
await CustomizableUI.reset();
});
add_task(async function setupHomeButton() {
if (CustomizableUI.protonToolbarEnabled) {
// Put the home button in the pre-proton placement to test focus states.
CustomizableUI.addWidgetToArea(
"home-button",
"nav-bar",
CustomizableUI.getPlacementOfWidget("stop-reload-button").position + 1
);
}
});
function synthesizeKeyAndWaitForFocus(element, keyCode, options) {
let focused = BrowserTestUtils.waitForEvent(element, "focus");
EventUtils.synthesizeKey(keyCode, options);

Просмотреть файл

@ -39,11 +39,7 @@ add_task(async function test_ui_state_notification_calls_updateAllUI() {
add_task(async function test_navBar_button_visibility() {
const button = document.getElementById("fxa-toolbar-menu-button");
const protonEnabled = Services.prefs.getBoolPref(
"browser.proton.toolbar.enabled",
false
);
info("pref browser.proton.toolbar.enabled: " + protonEnabled);
info("proton enabled: " + CustomizableUI.protonToolbarEnabled);
ok(button.closest("#nav-bar"), "button is in the #nav-bar");
@ -54,7 +50,7 @@ add_task(async function test_navBar_button_visibility() {
gSync.updateAllUI(state);
is(
BrowserTestUtils.is_visible(button),
!protonEnabled,
!CustomizableUI.protonToolbarEnabled,
"Check button visibility with STATUS_NOT_CONFIGURED"
);

Просмотреть файл

@ -8,6 +8,13 @@ add_task(async function() {
await BrowserTestUtils.withNewTab(TEST_HTTP, async function(browser) {
info("Tab ready");
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("home-button")
);
}
document.getElementById("home-button").click();
await BrowserTestUtils.browserLoaded(browser, false, HomePage.get());
is(gURLBar.value, "", "URL bar should be empty");

Просмотреть файл

@ -469,7 +469,7 @@ add_task(async function checkContextMenu() {
);
info("Check context menu in another button");
await openContextMenu(document.getElementById("home-button"));
await openContextMenu(document.getElementById("reload-button"));
is(checkbox.hidden, true, "Auto-hide checkbox is hidden");
contextMenu.hidePopup();

Просмотреть файл

@ -75,6 +75,12 @@ function assertTelemetryMatches(events) {
add_task(async function test_setup() {
// Clear any previosuly collected telemetry event.
Services.telemetry.clearEvents();
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("home-button")
);
}
});
add_task(async function browseraction_popup_contextmenu() {

Просмотреть файл

@ -10,6 +10,9 @@
// Cleanup.
registerCleanupFunction(async () => {
CustomizableUI.setToolbarVisibility("PersonalToolbar", false);
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.removeWidgetFromArea("library-button");
}
SidebarUI.hide();
});
@ -18,7 +21,7 @@ async function selectAppMenuView(buttonId, viewId) {
await BrowserTestUtils.waitForCondition(() => {
btn = document.getElementById(buttonId);
return btn;
}, "Should have the " + buttonId + "button");
}, "Should have the " + buttonId + " button");
btn.click();
let view = document.getElementById(viewId);
let viewPromise = BrowserTestUtils.waitForEvent(view, "ViewShown");
@ -34,6 +37,10 @@ async function openBookmarkingPanelInLibraryToolbarButton() {
}
add_task(async function test_enable_toolbar() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("library-button", "nav-bar");
}
await openBookmarkingPanelInLibraryToolbarButton();
let toolbar = document.getElementById("PersonalToolbar");
Assert.ok(toolbar.collapsed, "Bookmarks Toolbar is hidden");

Просмотреть файл

@ -593,6 +593,9 @@ add_task(async function dont_consume_clicks() {
// Dropping text to the searchbar should open the popup
add_task(async function drop_opens_popup() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
}
// The previous task leaves focus in the URL bar. However, in that case drags
// can be interpreted as being selection drags by the drag manager, which
// breaks the drag synthesis from EventUtils.js below. To avoid this, focus
@ -632,6 +635,9 @@ add_task(async function drop_opens_popup() {
await promise;
textbox.value = "";
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.removeWidgetFromArea("home-button");
}
});
// Moving the caret using the cursor keys should not close the popup.

Просмотреть файл

@ -196,7 +196,7 @@ var tests = [
let highlight = document.getElementById("UITourHighlight");
is_element_hidden(highlight, "Highlight should initially be hidden");
gContentAPI.showHighlight("home");
gContentAPI.showHighlight("backForward");
waitForElementToBeVisible(
highlight,
check_highlight_size,

Просмотреть файл

@ -17,7 +17,7 @@ function getExpectedTargets() {
"backForward",
"devtools",
"help",
"home",
...(CustomizableUI.protonToolbarEnabled ? [] : ["home"]),
"library",
"logins",
"pageAction-bookmark",

Просмотреть файл

@ -14,6 +14,15 @@ const { TabStateFlusher } = ChromeUtils.import(
"resource:///modules/sessionstore/TabStateFlusher.jsm"
);
add_task(function addHomeButton() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("home-button")
);
}
});
/**
* Test what happens if loading a URL that should clear the
* location bar after a parent process URL.

Просмотреть файл

@ -22,6 +22,13 @@ add_task(async function test_setup() {
}
await Services.search.setDefault(originalEngine);
});
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("home-button")
);
}
});
/**

Просмотреть файл

@ -14,6 +14,15 @@ add_task(async function init() {
}
registerCleanupFunction(PlacesUtils.history.clear);
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar", 0);
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
registerCleanupFunction(() => {
CustomizableUI.removeWidgetFromArea("home-button");
CustomizableUI.removeWidgetFromArea("sidebar-button");
});
}
});
add_task(async function tabWithSearchString() {
@ -335,7 +344,9 @@ async function waitForFocusOnNextFocusableElement(reverse = false) {
while (
nextFocusableElement &&
(!nextFocusableElement.classList.contains("toolbarbutton-1") ||
nextFocusableElement.hasAttribute("hidden"))
nextFocusableElement.hasAttribute("hidden") ||
nextFocusableElement.hasAttribute("disabled") ||
BrowserTestUtils.is_hidden(nextFocusableElement))
) {
nextFocusableElement = reverse
? nextFocusableElement.previousElementSibling

Просмотреть файл

@ -578,7 +578,7 @@ const tests = [
info("Drop something.");
let promise = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
EventUtils.synthesizeDrop(
win.document.getElementById("home-button"),
win.document.getElementById("back-button"),
win.gURLBar.inputField,
[[{ type: "text/plain", data: "www.example.com" }]],
"copy",

Просмотреть файл

@ -20,11 +20,19 @@ add_task(async function test_usage_button_prefs_set() {
await SpecialPowers.pushPrefEnv({
set: [["browser.download.autohideButton", false]],
});
if (CustomizableUI.protonToolbarEnabled) {
// Move the FxA button to the toolbar so it doesn't get auto-hidden.
CustomizableUI.addWidgetToArea("fxa-toolbar-menu-button", "TabsToolbar");
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
CustomizableUI.addWidgetToArea("library-button", "nav-bar");
}
registerCleanupFunction(() => {
registerCleanupFunction(async () => {
// Clicking on the sidebar button will show the sidebar, so we'll
// make sure it's hidden when the test ends.
SidebarUI.hide();
await CustomizableUI.reset();
});
const PREFS_TO_FALSE = Object.values(BUTTONS_TO_TEST).map(prefName => {
@ -36,7 +44,7 @@ add_task(async function test_usage_button_prefs_set() {
});
// We open a new tab to ensure the test passes verify on Windows
await BrowserTestUtils.withNewTab("about:blank", () => {
await BrowserTestUtils.withNewTab("about:blank", async () => {
for (let buttonID in BUTTONS_TO_TEST) {
let pref = BUTTONS_TO_TEST[buttonID];
Assert.ok(
@ -46,7 +54,16 @@ add_task(async function test_usage_button_prefs_set() {
info(`Clicking on ${buttonID}`);
let element = document.getElementById(buttonID);
EventUtils.synthesizeMouseAtCenter(element, {}, window);
if (buttonID != "home-button" && buttonID != "sidebar-button") {
let popupShown = BrowserTestUtils.waitForPopupEvent(window, "shown");
let popupHidden = BrowserTestUtils.waitForPopupEvent(window, "hidden");
EventUtils.synthesizeMouse(element, 5, 5, {}, window);
let shownEvent = await popupShown;
shownEvent.target.hidePopup();
await popupHidden;
} else {
EventUtils.synthesizeMouse(element, 5, 5, {}, window);
}
Assert.ok(
Services.prefs.getBoolPref(pref),

Просмотреть файл

@ -50,13 +50,23 @@ add_task(async function test_support_separator_properties() {
);
let panelUIButton = document.querySelector("#PanelUI-button");
Assert.ok(
window
.getComputedStyle(panelUIButton)
.getPropertyValue("border-image-source")
.includes(`rgb(${hexToRGB(SEPARATOR_VERTICAL_COLOR).join(", ")})`),
"Vertical separator color properly set"
);
if (CustomizableUI.protonToolbarEnabled) {
Assert.equal(
window
.getComputedStyle(panelUIButton)
.getPropertyValue("border-image-source"),
"none",
"No vertical separator on app menu"
);
} else {
Assert.ok(
window
.getComputedStyle(panelUIButton)
.getPropertyValue("border-image-source")
.includes(`rgb(${hexToRGB(SEPARATOR_VERTICAL_COLOR).join(", ")})`),
"Vertical separator color properly set"
);
}
let toolbox = document.querySelector("#navigator-toolbox");
Assert.equal(

Просмотреть файл

@ -5,6 +5,15 @@
// This test checks whether applied WebExtension themes that attempt to change
// the button background color properties are applied correctly.
add_task(async function setup_home_button() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("home-button")
);
}
});
add_task(async function test_button_background_properties() {
const BUTTON_BACKGROUND_ACTIVE = "#FFFFFF";
const BUTTON_BACKGROUND_HOVER = "#59CBE8";

Просмотреть файл

@ -3,6 +3,15 @@
// This test checks applied WebExtension themes that attempt to change
// icon color properties
add_task(async function setup_home_button() {
if (CustomizableUI.protonToolbarEnabled) {
CustomizableUI.addWidgetToArea("home-button", "nav-bar");
registerCleanupFunction(() =>
CustomizableUI.removeWidgetFromArea("home-button")
);
}
});
add_task(async function test_icons_properties() {
const ICONS_COLOR = "#001b47";
const ICONS_ATTENTION_COLOR = "#44ba77";