diff --git a/browser/components/extensions/test/browser/browser_ext_contextMenus.js b/browser/components/extensions/test/browser/browser_ext_contextMenus.js index a6b9436512e6..6eb6d32b435f 100644 --- a/browser/components/extensions/test/browser/browser_ext_contextMenus.js +++ b/browser/components/extensions/test/browser/browser_ext_contextMenus.js @@ -563,7 +563,8 @@ function bookmarkContextMenuExtension() { add_task(async function test_bookmark_contextmenu() { let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, PAGE); - await toggleBookmarksToolbar(true); + const bookmarksToolbar = document.getElementById("PersonalToolbar"); + setToolbarVisibility(bookmarksToolbar, true); const extension = bookmarkContextMenuExtension(); @@ -578,7 +579,7 @@ add_task(async function test_bookmark_contextmenu() { await extension.awaitMessage("test-finish"); await extension.unload(); - await toggleBookmarksToolbar(false); + setToolbarVisibility(bookmarksToolbar, false); BrowserTestUtils.removeTab(tab); }); @@ -672,7 +673,8 @@ add_task(async function test_organizer_contextmenu() { }); add_task(async function test_bookmark_context_requires_permission() { - await toggleBookmarksToolbar(true); + const bookmarksToolbar = document.getElementById("PersonalToolbar"); + setToolbarVisibility(bookmarksToolbar, true); const extension = ExtensionTestUtils.loadExtension({ manifest: { @@ -699,5 +701,5 @@ add_task(async function test_bookmark_context_requires_permission() { closeChromeContextMenu("placesContext"); await extension.unload(); - await toggleBookmarksToolbar(false); + setToolbarVisibility(bookmarksToolbar, false); }); diff --git a/browser/components/extensions/test/browser/browser_ext_menus.js b/browser/components/extensions/test/browser/browser_ext_menus.js index 09165f1ffaea..84de4f3239a4 100644 --- a/browser/components/extensions/test/browser/browser_ext_menus.js +++ b/browser/components/extensions/test/browser/browser_ext_menus.js @@ -165,6 +165,15 @@ add_task(async function test_hiddenPageActionContextMenu() { }); add_task(async function test_bookmarkContextMenu() { + async function showBookmarksToolbar(visible = true) { + let bt = document.getElementById("PersonalToolbar"); + let transitionPromise = + BrowserTestUtils.waitForEvent(bt, "transitionend", + e => e.propertyName == "max-height"); + setToolbarVisibility(bt, visible); + await transitionPromise; + } + const ext = ExtensionTestUtils.loadExtension({ manifest: { permissions: ["menus", "bookmarks"], @@ -179,7 +188,7 @@ add_task(async function test_bookmarkContextMenu() { }, }); - await toggleBookmarksToolbar(true); + await showBookmarksToolbar(); await ext.startup(); await ext.awaitMessage("ready"); @@ -192,7 +201,7 @@ add_task(async function test_bookmarkContextMenu() { closeChromeContextMenu("placesContext", item); await ext.unload(); - await toggleBookmarksToolbar(false); + await showBookmarksToolbar(false); }); add_task(async function test_tabContextMenu() { diff --git a/browser/components/extensions/test/browser/head.js b/browser/components/extensions/test/browser/head.js index c8e966fdc613..1f31d263edf8 100644 --- a/browser/components/extensions/test/browser/head.js +++ b/browser/components/extensions/test/browser/head.js @@ -8,7 +8,6 @@ * getBrowserActionPopup getPageActionPopup getPageActionButton * closeBrowserAction closePageAction * promisePopupShown promisePopupHidden - * toggleBookmarksToolbar * openContextMenu closeContextMenu * openContextMenuInSidebar openContextMenuInPopup * openExtensionContextMenu closeExtensionContextMenu @@ -288,16 +287,6 @@ function closeBrowserAction(extension, win = window) { return Promise.resolve(); } -async function toggleBookmarksToolbar(visible = true) { - let bookmarksToolbar = document.getElementById("PersonalToolbar"); - let transitionPromise = - BrowserTestUtils.waitForEvent(bookmarksToolbar, "transitionend", - e => e.propertyName == "max-height"); - - setToolbarVisibility(bookmarksToolbar, visible); - await transitionPromise; -} - async function openContextMenuInPopup(extension, selector = "body") { let contentAreaContextMenu = document.getElementById("contentAreaContextMenu"); let browser = await awaitExtensionPanel(extension);