diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /browser/base/content/test/tabs/browser_tab_preview.js | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/tabs/browser_tab_preview.js')
-rw-r--r-- | browser/base/content/test/tabs/browser_tab_preview.js | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/browser/base/content/test/tabs/browser_tab_preview.js b/browser/base/content/test/tabs/browser_tab_preview.js index 0f83b1e28c..19ba85b9f8 100644 --- a/browser/base/content/test/tabs/browser_tab_preview.js +++ b/browser/base/content/test/tabs/browser_tab_preview.js @@ -34,6 +34,7 @@ add_setup(async function () { set: [ ["browser.tabs.cardPreview.enabled", true], ["browser.tabs.cardPreview.showThumbnails", false], + ["browser.tabs.tooltipsShowPidAndActiveness", false], ["ui.tooltip.delay_ms", 0], ], }); @@ -82,6 +83,99 @@ add_task(async function hoverTests() { }); /** + * Verify that the pid and activeness statuses are not shown + * when the flag is not enabled. + */ +add_task(async function pidAndActivenessHiddenByDefaultTests() { + const tabUrl1 = + "data:text/html,<html><head><title>First New Tab</title></head><body>Hello</body></html>"; + const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1); + const previewContainer = document.getElementById("tab-preview-panel"); + + await openPreview(tab1); + Assert.equal( + previewContainer.querySelector(".tab-preview-pid").innerText, + "", + "Tab PID is not shown" + ); + Assert.equal( + previewContainer.querySelector(".tab-preview-activeness").innerText, + "", + "Tab activeness is not shown" + ); + + await closePreviews(); + + BrowserTestUtils.removeTab(tab1); + + // Move the mouse outside of the tab strip. + EventUtils.synthesizeMouseAtCenter(document.documentElement, { + type: "mouseover", + }); +}); + +add_task(async function pidAndActivenessTests() { + await SpecialPowers.pushPrefEnv({ + set: [["browser.tabs.tooltipsShowPidAndActiveness", true]], + }); + + const tabUrl1 = + "data:text/html,<html><head><title>Single process tab</title></head><body>Hello</body></html>"; + const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1); + const tabUrl2 = `data:text/html,<html> + <head> + <title>Multi-process tab</title> + </head> + <body> + <iframe + id="inlineFrameExample" + title="Inline Frame Example" + width="300" + height="200" + src="https://example.com"> + </iframe> + </body> + </html>`; + const tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl2); + const previewContainer = document.getElementById("tab-preview-panel"); + + await openPreview(tab1); + Assert.stringMatches( + previewContainer.querySelector(".tab-preview-pid").innerText, + /^pid: \d+$/, + "Tab PID is shown on single process tab" + ); + Assert.equal( + previewContainer.querySelector(".tab-preview-activeness").innerText, + "", + "Tab activeness is not shown on inactive tab" + ); + await closePreviews(); + + await openPreview(tab2); + Assert.stringMatches( + previewContainer.querySelector(".tab-preview-pid").innerText, + /^pids: \d+, \d+$/, + "Tab PIDs are shown on multi-process tab" + ); + Assert.equal( + previewContainer.querySelector(".tab-preview-activeness").innerText, + "[A]", + "Tab activeness is shown on active tab" + ); + await closePreviews(); + + BrowserTestUtils.removeTab(tab1); + BrowserTestUtils.removeTab(tab2); + await SpecialPowers.popPrefEnv(); + + // Move the mouse outside of the tab strip. + EventUtils.synthesizeMouseAtCenter(document.documentElement, { + type: "mouseover", + }); +}); + +/** * Verify that non-selected tabs display a thumbnail in their preview * when browser.tabs.cardPreview.showThumbnails is set to true, * while the currently selected tab never displays a thumbnail in its preview. |