summaryrefslogtreecommitdiffstats
path: root/toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js')
-rw-r--r--toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js34
1 files changed, 31 insertions, 3 deletions
diff --git a/toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js b/toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js
index e2e001e9d1..b226c0a37a 100644
--- a/toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js
+++ b/toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js
@@ -11,15 +11,18 @@
"use strict";
-const { EnterprisePolicyTesting } = ChromeUtils.importESModule(
- "resource://testing-common/EnterprisePolicyTesting.sys.mjs"
-);
+const { EnterprisePolicyTesting, PoliciesPrefTracker } =
+ ChromeUtils.importESModule(
+ "resource://testing-common/EnterprisePolicyTesting.sys.mjs"
+ );
const kEnabledPref = "enabled";
const kPipeNamePref = "pipe_path_name";
const kTimeoutPref = "agent_timeout";
const kAllowUrlPref = "allow_url_regex_list";
const kDenyUrlPref = "deny_url_regex_list";
+const kAgentNamePref = "agent_name";
+const kClientSignaturePref = "client_signature";
const kPerUserPref = "is_per_user";
const kShowBlockedPref = "show_blocked_result";
const kDefaultAllowPref = "default_allow";
@@ -29,6 +32,7 @@ const ca = Cc["@mozilla.org/contentanalysis;1"].getService(
);
add_task(async function test_ca_active() {
+ PoliciesPrefTracker.start();
ok(!ca.isActive, "CA is inactive when pref and cmd line arg are missing");
// Set the pref without enterprise policy. CA should not be active.
@@ -62,11 +66,15 @@ add_task(async function test_ca_active() {
},
});
ok(ca.isActive, "CA is active when enabled by enterprise policy pref");
+ PoliciesPrefTracker.stop();
});
add_task(async function test_ca_enterprise_config() {
+ PoliciesPrefTracker.start();
const string1 = "this is a string";
const string2 = "this is another string";
+ const string3 = "an agent name";
+ const string4 = "a client signature";
await EnterprisePolicyTesting.setupPolicyEngineWithJson({
policies: {
@@ -75,6 +83,8 @@ add_task(async function test_ca_enterprise_config() {
AgentTimeout: 99,
AllowUrlRegexList: string1,
DenyUrlRegexList: string2,
+ AgentName: string3,
+ ClientSignature: string4,
IsPerUser: true,
ShowBlockedResult: false,
DefaultAllow: true,
@@ -103,6 +113,18 @@ add_task(async function test_ca_enterprise_config() {
"deny urls match"
);
is(
+ Services.prefs.getStringPref("browser.contentanalysis." + kAgentNamePref),
+ string3,
+ "agent names match"
+ );
+ is(
+ Services.prefs.getStringPref(
+ "browser.contentanalysis." + kClientSignaturePref
+ ),
+ string4,
+ "client signatures match"
+ );
+ is(
Services.prefs.getBoolPref("browser.contentanalysis." + kPerUserPref),
true,
"per user match"
@@ -117,6 +139,7 @@ add_task(async function test_ca_enterprise_config() {
true,
"default allow match"
);
+ PoliciesPrefTracker.stop();
});
add_task(async function test_cleanup() {
@@ -124,4 +147,9 @@ add_task(async function test_cleanup() {
await EnterprisePolicyTesting.setupPolicyEngineWithJson({
policies: {},
});
+ // These may have gotten set when ContentAnalysis was enabled through
+ // the policy and do not get cleared if there is no ContentAnalysis
+ // element - reset them manually here.
+ ca.isSetByEnterprisePolicy = false;
+ Services.prefs.setBoolPref("browser.contentanalysis." + kEnabledPref, false);
});