summaryrefslogtreecommitdiffstats
path: root/browser/modules/test/browser/browser_UsageTelemetry_content_aboutRestartRequired.js
blob: 359bfa9c69a57ca61e1f97cc8a9379edc309af0f (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.import(
    "resource:///modules/ContentCrashHandlers.jsm"
  );

  // 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."
  );
});