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 /toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_telemetry_purge_duration.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 'toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_telemetry_purge_duration.js')
-rw-r--r-- | toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_telemetry_purge_duration.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_telemetry_purge_duration.js b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_telemetry_purge_duration.js new file mode 100644 index 0000000000..74b1fdb30d --- /dev/null +++ b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_telemetry_purge_duration.js @@ -0,0 +1,66 @@ +/* Any copyright is dedicated to the Public Domain. + https://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +let bounceTrackingProtection; + +async function test_purge_duration(isDryRunMode) { + await SpecialPowers.pushPrefEnv({ + set: [["privacy.bounceTrackingProtection.enableDryRunMode", isDryRunMode]], + }); + + is( + Glean.bounceTrackingProtection.purgeDuration.testGetValue(), + null, + "Histogram should not exist initially." + ); + + info("Run server bounce with cookie."); + await runTestBounce({ + bounceType: "server", + setState: "cookie-server", + postBounceCallback: () => { + is( + Glean.bounceTrackingProtection.purgeDuration.testGetValue(), + null, + "Histogram should still be empty after bounce, because we haven't purged yet." + ); + }, + }); + + let events = Glean.bounceTrackingProtection.purgeDuration.testGetValue(); + if (isDryRunMode) { + is(events, null, "Should not collect purge timining in dry mode"); + } else { + is(events.count, 1, "Histogram should contain one value."); + } + + // Cleanup + Services.fog.testResetFOG(); + await SpecialPowers.popPrefEnv(); + bounceTrackingProtection.clearAll(); +} + +add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.bounceTrackingProtection.requireStatefulBounces", true], + ["privacy.bounceTrackingProtection.bounceTrackingGracePeriodSec", 0], + ], + }); + bounceTrackingProtection = Cc[ + "@mozilla.org/bounce-tracking-protection;1" + ].getService(Ci.nsIBounceTrackingProtection); + + // Clear telemetry before test. + Services.fog.testResetFOG(); +}); + +add_task(async function test_purge_duration_dry_mode() { + await test_purge_duration(true); +}); + +add_task(async function test_purge_duration_enabled() { + await test_purge_duration(false); +}); |