summaryrefslogtreecommitdiffstats
path: root/browser/modules/test/browser/browser_UsageTelemetry_content_aboutRestartRequired.js
blob: 3baa336d798c277426ff04b3e236b963e935144c (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
29
30
31
32
33
"use strict";

const SCALAR_BUILDID_MISMATCH = "dom.contentprocess.buildID_mismatch";

add_task(async function test_aboutRestartRequired() {
  const { TabCrashHandler } = ChromeUtils.importESModule(
    "resource:///modules/ContentCrashHandlers.sys.mjs"
  );

  // Let's reset the counts.
  Services.telemetry.clearScalars();

  let scalars = TelemetryTestUtils.getProcessScalars("parent");

  // Check preconditions
  is(
    scalars[SCALAR_BUILDID_MISMATCH],
    undefined,
    "Build ID mismatch count should be undefined"
  );

  // Simulate buildID mismatch
  TabCrashHandler._crashedTabCount = 1;
  TabCrashHandler.sendToRestartRequiredPage(gBrowser.selectedTab.linkedBrowser);

  scalars = TelemetryTestUtils.getProcessScalars("parent");

  is(
    scalars[SCALAR_BUILDID_MISMATCH],
    1,
    "Build ID mismatch count should be 1."
  );
});