summaryrefslogtreecommitdiffstats
path: root/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_telemetry.js
blob: 3070df0d88d38b284afad4d71dba50514aa9610e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

add_task(async function test_policy_disable_telemetry() {
  const { TelemetryReportingPolicy } = ChromeUtils.importESModule(
    "resource://gre/modules/TelemetryReportingPolicy.sys.mjs"
  );

  ok(TelemetryReportingPolicy, "TelemetryReportingPolicy exists");
  is(TelemetryReportingPolicy.canUpload(), true, "Telemetry is enabled");

  await setupPolicyEngineWithJson({
    policies: {
      DisableTelemetry: true,
    },
  });

  is(TelemetryReportingPolicy.canUpload(), false, "Telemetry is disabled");
  is(
    Services.prefs.getBoolPref("toolkit.telemetry.archive.enabled"),
    false,
    "Telemetry archive should be disabled."
  );

  await testPageBlockedByPolicy("about:telemetry");
});