tor-browser

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

browser_telemetry_toolbox.js (949B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TEST_URI =
      7  "data:text/html;charset=utf-8," + "<p>browser_telemetry_toolbox.js</p>";
      8 
      9 // Because we need to gather stats for the period of time that a tool has been
     10 // opened we make use of setTimeout() to create tool active times.
     11 const TOOL_DELAY = 200;
     12 
     13 add_task(async function () {
     14  await addTab(TEST_URI);
     15  startTelemetry();
     16 
     17  await openAndCloseToolbox(3, TOOL_DELAY, "inspector");
     18  checkResults();
     19 
     20  gBrowser.removeCurrentTab();
     21 });
     22 
     23 function checkResults() {
     24  // For help generating these tests use generateTelemetryTests("DEVTOOLS_TOOLBOX_")
     25  // here.
     26  checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_COUNT", "", { 0: 3, 1: 0 }, "array");
     27  checkTelemetry(
     28    "DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS",
     29    "",
     30    null,
     31    "hasentries"
     32  );
     33  checkTelemetry("DEVTOOLS_TOOLBOX_HOST", "", null, "hasentries");
     34 }