diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/sessionstore/test/browser_bfcache_telemetry.js | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/sessionstore/test/browser_bfcache_telemetry.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_bfcache_telemetry.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_bfcache_telemetry.js b/browser/components/sessionstore/test/browser_bfcache_telemetry.js new file mode 100644 index 0000000000..a4441f91bc --- /dev/null +++ b/browser/components/sessionstore/test/browser_bfcache_telemetry.js @@ -0,0 +1,45 @@ +const URL1 = "data:text/html;charset=utf-8,<body><p>Hello1</p></body>"; +const URL2 = "data:text/html;charset=utf-8,<body><p>Hello2</p></body>"; + +async function getBFCacheComboTelemetry(probeInParent) { + let bfcacheCombo; + await TestUtils.waitForCondition(() => { + let histograms; + if (probeInParent) { + histograms = Services.telemetry.getSnapshotForHistograms( + "main", + false /* clear */ + ).parent; + } else { + histograms = Services.telemetry.getSnapshotForHistograms( + "main", + false /* clear */ + ).content; + } + bfcacheCombo = histograms.BFCACHE_COMBO; + return bfcacheCombo; + }); + return bfcacheCombo; +} + +async function test_bfcache_telemetry(probeInParent) { + Services.telemetry.getHistogramById("BFCACHE_COMBO").clear(); + + let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL1); + + BrowserTestUtils.loadURI(tab.linkedBrowser, URL2); + await BrowserTestUtils.browserLoaded(tab.linkedBrowser); + + let bfcacheCombo = await getBFCacheComboTelemetry(probeInParent); + + is(bfcacheCombo.values[0], 1, "1 bfcache success"); + + gBrowser.removeTab(tab); +} + +add_task(async () => { + await test_bfcache_telemetry( + Services.appinfo.sessionHistoryInParent && + Services.prefs.getBoolPref("fission.bfcacheInParent") + ); +}); |