tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_telemetry_toolboxtabs_jsprofiler.js (1101B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const { ProfilerTestUtils } = ChromeUtils.importESModule(
      7  "resource://testing-common/ProfilerTestUtils.sys.mjs"
      8 );
      9 
     10 const TEST_URI =
     11  "data:text/html;charset=utf-8," +
     12  "<p>browser_telemetry_toolboxtabs_jsprofiler.js</p>";
     13 
     14 // Because we need to gather stats for the period of time that a tool has been
     15 // opened we make use of setTimeout() to create tool active times.
     16 const TOOL_DELAY = 200;
     17 
     18 add_setup(ProfilerTestUtils.assertProfilerInactive);
     19 
     20 add_task(async function () {
     21  await addTab(TEST_URI);
     22  startTelemetry();
     23 
     24  await openAndCloseToolbox(2, TOOL_DELAY, "performance");
     25  checkResults();
     26 
     27  gBrowser.removeCurrentTab();
     28 });
     29 
     30 function checkResults() {
     31  // For help generating these tests use generateTelemetryTests("DEVTOOLS_JSPROFILER")
     32  // here.
     33  checkTelemetry(
     34    "DEVTOOLS_JSPROFILER_OPENED_COUNT",
     35    "",
     36    { 0: 2, 1: 0 },
     37    "array"
     38  );
     39  checkTelemetry(
     40    "DEVTOOLS_JSPROFILER_TIME_ACTIVE_SECONDS",
     41    "",
     42    null,
     43    "hasentries"
     44  );
     45 }