diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/base/content/test/performance/browser_panel_vsync.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | browser/base/content/test/performance/browser_panel_vsync.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/browser/base/content/test/performance/browser_panel_vsync.js b/browser/base/content/test/performance/browser_panel_vsync.js new file mode 100644 index 0000000000..73c56b9095 --- /dev/null +++ b/browser/base/content/test/performance/browser_panel_vsync.js @@ -0,0 +1,69 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +Services.scriptloader.loadSubScript( + "chrome://mochitests/content/browser/browser/components/downloads/test/browser/head.js", + this +); + +add_task( + async function test_opening_panel_and_closing_should_not_leave_vsync() { + await SpecialPowers.pushPrefEnv({ + set: [["browser.download.autohideButton", false]], + }); + await promiseButtonShown("downloads-button"); + + const downloadsButton = document.getElementById("downloads-button"); + const shownPromise = promisePanelOpened(); + EventUtils.synthesizeNativeMouseEvent({ + type: "click", + target: downloadsButton, + atCenter: true, + }); + await shownPromise; + + is(DownloadsPanel.panel.state, "open", "Check that panel state is 'open'"); + + await TestUtils.waitForCondition( + () => !ChromeUtils.vsyncEnabled(), + "Make sure vsync disabled" + ); + // Should not already be using vsync + ok(!ChromeUtils.vsyncEnabled(), "vsync should be off initially"); + + if ( + AppConstants.platform == "linux" && + DownloadsPanel.panel.state != "open" + ) { + // Panels sometime receive spurious popuphiding events on Linux. + // Given the main target of this test is Windows, avoid causing + // intermittent failures and just make the test return early. + todo( + false, + "panel should still be 'open', current state: " + + DownloadsPanel.panel.state + ); + return; + } + + const hiddenPromise = BrowserTestUtils.waitForEvent( + DownloadsPanel.panel, + "popuphidden" + ); + EventUtils.synthesizeKey("VK_ESCAPE", {}, window); + await hiddenPromise; + await TestUtils.waitForCondition( + () => !ChromeUtils.vsyncEnabled(), + "wait for vsync to be disabled again" + ); + + ok(!ChromeUtils.vsyncEnabled(), "vsync should still be off"); + is( + DownloadsPanel.panel.state, + "closed", + "Check that panel state is 'closed'" + ); + } +); |