summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/tests/browser_performance_content_process_limit.js
blob: 7ac5c354bdf212cef105d329832729d72ab5205d (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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

add_task(async function () {
  await SpecialPowers.pushPrefEnv({
    set: [["browser.preferences.defaultPerformanceSettings.enabled", false]],
  });

  let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {
    leaveOpen: true,
  });
  is(prefs.selectedPane, "paneGeneral", "General pane was selected");

  let doc = gBrowser.contentDocument;

  let limitContentProcess = doc.querySelector("#limitContentProcess");
  is(
    limitContentProcess.hidden,
    Services.appinfo.fissionAutostart,
    "Limit Content Process should be hidden if fission is enabled and shown if it is not."
  );

  let contentProcessCount = doc.querySelector("#contentProcessCount");
  is(
    contentProcessCount.hidden,
    Services.appinfo.fissionAutostart,
    "Limit Content Count should be hidden if fission is enabled and shown if it is not."
  );

  let contentProcessCountEnabledDescription = doc.querySelector(
    "#contentProcessCountEnabledDescription"
  );
  is(
    contentProcessCountEnabledDescription.hidden,
    Services.appinfo.fissionAutostart,
    "Limit Content Process Enabled Description should be hidden if fission is enabled and shown if it is not."
  );

  let contentProcessCountDisabledDescription = doc.querySelector(
    "#contentProcessCountDisabledDescription"
  );
  is(
    contentProcessCountDisabledDescription.hidden,
    Services.appinfo.fissionAutostart ||
      Services.appinfo.browserTabsRemoteAutostart,
    "Limit Content Process Disabled Description should be shown if e10s is disabled, and hidden otherwise."
  );

  BrowserTestUtils.removeTab(gBrowser.selectedTab);
});