summaryrefslogtreecommitdiffstats
path: root/dom/security/test/https-first/browser_httpsfirst.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /dom/security/test/https-first/browser_httpsfirst.js
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/security/test/https-first/browser_httpsfirst.js')
-rw-r--r--dom/security/test/https-first/browser_httpsfirst.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/dom/security/test/https-first/browser_httpsfirst.js b/dom/security/test/https-first/browser_httpsfirst.js
index 733474dcc1..c4437f6051 100644
--- a/dom/security/test/https-first/browser_httpsfirst.js
+++ b/dom/security/test/https-first/browser_httpsfirst.js
@@ -31,6 +31,7 @@ add_task(async function () {
await SpecialPowers.pushPrefEnv({
set: [["dom.security.https_first", false]],
});
+ Services.fog.testResetFOG();
await runPrefTest(
"http://example.com",
@@ -42,6 +43,23 @@ add_task(async function () {
set: [["dom.security.https_first", true]],
});
+ for (const key of [
+ "upgraded",
+ "upgradedSchemeless",
+ "downgraded",
+ "downgradedSchemeless",
+ "downgradedOnTimer",
+ "downgradedOnTimerSchemeless",
+ "downgradeTime",
+ "downgradeTimeSchemeless",
+ ]) {
+ is(
+ Glean.httpsfirst[key].testGetValue(),
+ null,
+ `No telemetry should have been recorded yet for ${key}`
+ );
+ }
+
await runPrefTest(
"http://example.com",
"Should upgrade upgradeable website",
@@ -71,4 +89,21 @@ add_task(async function () {
"Should downgrade after timeout.",
"http://"
);
+
+ info("Checking expected telemetry");
+ is(Glean.httpsfirst.upgraded.testGetValue(), 5);
+ is(Glean.httpsfirst.upgradedSchemeless.testGetValue(), null);
+ is(Glean.httpsfirst.downgraded.testGetValue(), 3);
+ is(Glean.httpsfirst.downgradedSchemeless.testGetValue(), null);
+ is(Glean.httpsfirst.downgradedOnTimer.testGetValue().numerator, 1);
+ is(Glean.httpsfirst.downgradedOnTimerSchemeless.testGetValue(), null);
+ const downgradeSeconds =
+ Glean.httpsfirst.downgradeTime.testGetValue().sum / 1_000_000_000;
+ ok(
+ downgradeSeconds > 2 && downgradeSeconds < 30,
+ `Summed downgrade time should be above 2 and below 30 seconds (is ${downgradeSeconds.toFixed(
+ 2
+ )}s)`
+ );
+ is(null, Glean.httpsfirst.downgradeTimeSchemeless.testGetValue());
});