summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance/test/browser_perf-recording-notices-05.js
blob: 7a6b6b6b9270dcdaec059330fe5137e1d4e499b2 (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
44
45
46
47
48
49
50
51
52
53
54
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";

/**
 * Tests that the circular buffer notices work when e10s is on/off.
 */

const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");

add_task(function* () {
  let { panel } = yield initPerformanceInNewTab({
    url: SIMPLE_URL,
    win: window
  });

  let { gFront, $, PerformanceController } = panel.panelWin;

  // Set a fast profiler-status update interval
  yield gFront.setProfilerStatusInterval(10);

  let supported = false;
  let enabled = false;

  PerformanceController.getMultiprocessStatus = () => {
    return { supported, enabled };
  };

  PerformanceController._setMultiprocessAttributes();
  ok($("#performance-view").getAttribute("e10s"), "unsupported",
    "When e10s is disabled and no option to turn on, container has [e10s=unsupported].");

  supported = true;
  enabled = false;
  PerformanceController._setMultiprocessAttributes();
  ok($("#performance-view").getAttribute("e10s"), "disabled",
    "When e10s is disabled and but is supported, container has [e10s=disabled].");

  supported = false;
  enabled = true;
  PerformanceController._setMultiprocessAttributes();
  ok($("#performance-view").getAttribute("e10s"), "",
    "When e10s is enabled, but not supported, this probably means we " +
    "have no e10s attribute.");

  supported = true;
  enabled = true;
  PerformanceController._setMultiprocessAttributes();
  ok($("#performance-view").getAttribute("e10s"), "",
    "When e10s is enabled and supported, there should be no e10s attribute.");

  yield teardownToolboxAndRemoveTab(panel);
});