diff --git a/browser/base/content/test/performance/browser_appmenu.js b/browser/base/content/test/performance/browser_appmenu.js index de375e6722d2..b72731d8a5a6 100644 --- a/browser/base/content/test/performance/browser_appmenu.js +++ b/browser/base/content/test/performance/browser_appmenu.js @@ -44,6 +44,7 @@ const EXPECTED_APPMENU_OPEN_REFLOWS = [ add_task(async function() { await ensureNoPreloadedBrowser(); + await disableFxaBadge(); let textBoxRect = gURLBar .querySelector("moz-input-box") @@ -51,9 +52,6 @@ add_task(async function() { let menuButtonRect = document .getElementById("PanelUI-menu-button") .getBoundingClientRect(); - let fxaToolbarButtonRect = document - .getElementById("fxa-toolbar-menu-button") - .getBoundingClientRect(); let firstTabRect = gBrowser.selectedTab.getBoundingClientRect(); let frameExpectations = { filter: rects => @@ -88,14 +86,6 @@ add_task(async function() { r.y1 >= firstTabRect.top && r.y2 <= firstTabRect.bottom, }, - { - name: "the fxa toolbar changes icon when first clicked", - condition: r => - r.x1 >= fxaToolbarButtonRect.left && - r.x2 <= fxaToolbarButtonRect.right && - r.y1 >= fxaToolbarButtonRect.top && - r.y2 <= fxaToolbarButtonRect.bottom, - }, ], }; diff --git a/browser/base/content/test/performance/browser_tabclose.js b/browser/base/content/test/performance/browser_tabclose.js index fb54b9ae70cf..31ea910d74bd 100644 --- a/browser/base/content/test/performance/browser_tabclose.js +++ b/browser/base/content/test/performance/browser_tabclose.js @@ -21,6 +21,7 @@ const EXPECTED_REFLOWS = [ */ add_task(async function() { await ensureNoPreloadedBrowser(); + await disableFxaBadge(); let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser); await TestUtils.waitForCondition(() => tab._fullyOpen); diff --git a/browser/base/content/test/performance/browser_tabclose_grow.js b/browser/base/content/test/performance/browser_tabclose_grow.js index 4d2231634823..dbefef652452 100644 --- a/browser/base/content/test/performance/browser_tabclose_grow.js +++ b/browser/base/content/test/performance/browser_tabclose_grow.js @@ -22,6 +22,7 @@ const EXPECTED_REFLOWS = [ */ add_task(async function() { await ensureNoPreloadedBrowser(); + await disableFxaBadge(); // At the time of writing, there are no reflows on tab closing with // tab growth. Mochitest will fail if we have no assertions, so we diff --git a/browser/base/content/test/performance/browser_tabopen.js b/browser/base/content/test/performance/browser_tabopen.js index 969bc1776ea3..7a99272644fd 100644 --- a/browser/base/content/test/performance/browser_tabopen.js +++ b/browser/base/content/test/performance/browser_tabopen.js @@ -24,6 +24,7 @@ const EXPECTED_REFLOWS = [ */ add_task(async function() { await ensureNoPreloadedBrowser(); + await disableFxaBadge(); // Prepare the window to avoid flicker and reflow that's unrelated to our // tab opening operation. @@ -35,9 +36,6 @@ add_task(async function() { let textBoxRect = gURLBar .querySelector("moz-input-box") .getBoundingClientRect(); - let fxaAccountsButton = document - .getElementById("fxa-toolbar-menu-button") - .getBoundingClientRect(); let inRange = (val, min, max) => min <= val && val <= max; @@ -124,15 +122,6 @@ add_task(async function() { r.y1 >= firstTabLabelRect.y && r.y2 <= firstTabLabelRect.bottom, }, - { - name: - "FxA accounts button is intentionally badged 10s after startup", - condition: r => - r.x1 >= fxaAccountsButton.left && - r.x2 <= fxaAccountsButton.right && - r.y1 >= fxaAccountsButton.top && - r.y2 <= fxaAccountsButton.bottom, - }, ], }, } diff --git a/browser/base/content/test/performance/browser_tabopen_squeeze.js b/browser/base/content/test/performance/browser_tabopen_squeeze.js index 1b82ea5f7f9c..26d94b06f284 100644 --- a/browser/base/content/test/performance/browser_tabopen_squeeze.js +++ b/browser/base/content/test/performance/browser_tabopen_squeeze.js @@ -22,6 +22,7 @@ const EXPECTED_REFLOWS = [ */ add_task(async function() { await ensureNoPreloadedBrowser(); + await disableFxaBadge(); // Compute the number of tabs we can put into the strip without // overflowing, and remove one, so that we can create diff --git a/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js b/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js index 73a3ffb4730e..d5e49066076b 100644 --- a/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js +++ b/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js @@ -36,6 +36,7 @@ add_task(async function() { await createTabs(TAB_COUNT_FOR_OVERFLOW); gURLBar.focus(); + await disableFxaBadge(); let tabStripRect = gBrowser.tabContainer.arrowScrollbox.getBoundingClientRect(); let textBoxRect = gURLBar diff --git a/browser/base/content/test/performance/browser_tabswitch.js b/browser/base/content/test/performance/browser_tabswitch.js index db2e7388b398..3707bba08631 100644 --- a/browser/base/content/test/performance/browser_tabswitch.js +++ b/browser/base/content/test/performance/browser_tabswitch.js @@ -25,6 +25,7 @@ const EXPECTED_REFLOWS = [ */ add_task(async function() { await ensureNoPreloadedBrowser(); + await disableFxaBadge(); // At the time of writing, there are no reflows on simple tab switching. // Mochitest will fail if we have no assertions, so we add one here diff --git a/browser/base/content/test/performance/browser_windowopen.js b/browser/base/content/test/performance/browser_windowopen.js index 3f72fef9fe37..7499d5b2020f 100644 --- a/browser/base/content/test/performance/browser_windowopen.js +++ b/browser/base/content/test/performance/browser_windowopen.js @@ -53,11 +53,10 @@ add_task(async function() { "about:home" ); + await disableFxaBadge(); + let alreadyFocused = false; let inRange = (val, min, max) => min <= val && val <= max; - let fxaAccountsButton = document - .getElementById("fxa-toolbar-menu-button") - .getBoundingClientRect(); let expectations = { expectedReflows: EXPECTED_REFLOWS, frames: { @@ -100,14 +99,6 @@ add_task(async function() { ); }, }, - { - name: "FxA accounts button is intentionally badged 10s after startup", - condition: r => - r.x1 >= fxaAccountsButton.left && - r.x2 <= fxaAccountsButton.right && - r.y1 >= fxaAccountsButton.top && - r.y2 <= fxaAccountsButton.bottom, - }, ], }, }; diff --git a/browser/base/content/test/performance/head.js b/browser/base/content/test/performance/head.js index f58474dbb840..2343959da7d6 100644 --- a/browser/base/content/test/performance/head.js +++ b/browser/base/content/test/performance/head.js @@ -254,6 +254,21 @@ async function ensureNoPreloadedBrowser(win = window) { }); } +// Onboarding puts a badge on the fxa toolbar button a while after startup +// which confuses tests that look at repaints in the toolbar. Use this +// function to cancel the badge update. +function disableFxaBadge() { + let { ToolbarBadgeHub } = ChromeUtils.import( + "resource://activity-stream/lib/ToolbarBadgeHub.jsm" + ); + ToolbarBadgeHub._clearBadgeTimeout(); + + // Also prevent a new timer from being set + return SpecialPowers.pushPrefEnv({ + set: [["identity.fxaccounts.toolbar.accessed", true]], + }); +} + async function prepareSettledWindow() { let win = await BrowserTestUtils.openNewBrowserWindow(); await ensureNoPreloadedBrowser(win);