summaryrefslogtreecommitdiffstats
path: root/devtools/client/framework/test/metrics/browser_metrics_inspector.js
blob: 284ef82372ec59d66e7063825c464e0de427c2bd (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
34
35
36
37
38
39
40
41
42
43
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * This test records the number of modules loaded by DevTools, as well as the total count
 * of characters in those modules, when opening the inspector. These metrics are retrieved
 * by perfherder via logs.
 */

const TEST_URL =
  "data:text/html;charset=UTF-8,<div>Inspector modules load test</div>";

add_task(async function () {
  const toolbox = await openNewTabAndToolbox(TEST_URL, "inspector");
  const toolboxBrowserLoader = toolbox.win.getBrowserLoaderForWindow();

  // Most panels involve three loaders:
  // - the global devtools loader
  // - the browser loader used by the toolbox
  // - a specific browser loader created for the panel
  // But the inspector is a specific case, because it reuses the BrowserLoader
  // of the toolbox to load its react components. This is why we only list
  // two loaders here.
  const loaders = [loader.loader, toolboxBrowserLoader.loader];

  runDuplicatedModulesTest(loaders, [
    "@loader/unload.js",
    "@loader/options.js",
    "resource://devtools/client/shared/vendor/react.js",
    "resource://devtools/client/shared/vendor/react-dom-factories.js",
    "resource://devtools/client/shared/vendor/react-prop-types.js",
    "resource://devtools/client/shared/vendor/redux.js",
    "resource://devtools/client/shared/vendor/fluent-react.js",
  ]);

  runMetricsTest({
    filterString: "devtools/client/inspector",
    loaders,
    panelName: "inspector",
  });
});