From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../sessionstore/test/browser_bfcache_telemetry.js | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 browser/components/sessionstore/test/browser_bfcache_telemetry.js (limited to 'browser/components/sessionstore/test/browser_bfcache_telemetry.js') 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..daa4bcf44e --- /dev/null +++ b/browser/components/sessionstore/test/browser_bfcache_telemetry.js @@ -0,0 +1,45 @@ +const URL1 = "data:text/html;charset=utf-8,

Hello1

"; +const URL2 = "data:text/html;charset=utf-8,

Hello2

"; + +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.loadURIString(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") + ); +}); -- cgit v1.2.3