summaryrefslogtreecommitdiffstats
path: root/browser/tools/mozscreenshots/tests/xpcshell/test_testConfigurations.js
blob: 4df120c2deb8a183aca1b59fdc97960558402b9c (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
55
56
57
58
59
60
61
62
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

"use strict";

const { TestRunner } = ChromeUtils.import("resource://test/TestRunner.jsm");

add_task(async function capture() {
  equal(TestRunner.findComma("Toolbars,Devs"), 8);
  equal(TestRunner.findComma("Toolbars"), -1);
  equal(TestRunner.findComma("Toolbars[onlyNavBar,allToolbars],DevTools"), 32);
  equal(
    TestRunner.findComma(
      "Toolbars[onlyNavBar,allToolbars],DevTools[bottomToolbox,sideToolbox]"
    ),
    32
  );
  equal(
    TestRunner.findComma(
      "Toolbars[[onlyNavBar],[]], Tabs[ [fiveTabbed], [[[fourPinned]]] ]"
    ),
    25
  );
  equal(TestRunner.findComma("[[[[[[[[[[[[[[[[[[[[]]"), -1);
  equal(TestRunner.findComma("Preferences[[[[[,]]]]]"), -1);

  deepEqual(TestRunner.splitEnv("Toolbars"), ["Toolbars"]);
  deepEqual(TestRunner.splitEnv("Buttons,Tabs"), ["Buttons", "Tabs"]);
  deepEqual(TestRunner.splitEnv("Buttons,    Tabs"), ["Buttons", "Tabs"]);
  deepEqual(TestRunner.splitEnv("    Buttons   ,   Tabs    "), [
    "Buttons",
    "Tabs",
  ]);
  deepEqual(TestRunner.splitEnv("Toolbars[onlyNavBar,allToolbars],DevTools"), [
    "Toolbars[onlyNavBar,allToolbars]",
    "DevTools",
  ]);
  deepEqual(
    TestRunner.splitEnv(
      "Toolbars[onlyNavBar,allToolbars],DevTools[bottomToolbox]"
    ),
    ["Toolbars[onlyNavBar,allToolbars]", "DevTools[bottomToolbox]"]
  );
  deepEqual(
    TestRunner.splitEnv(
      "Toolbars[onlyNavBar,allToolbars],DevTools[bottomToolbox],Tabs"
    ),
    ["Toolbars[onlyNavBar,allToolbars]", "DevTools[bottomToolbox]", "Tabs"]
  );

  let filteredData = TestRunner.filterRestrictions("Toolbars[onlyNavBar]");
  equal(filteredData.trimmedSetName, "Toolbars");
  ok(filteredData.restrictions.has("onlyNavBar"));

  filteredData = TestRunner.filterRestrictions(
    "DevTools[bottomToolbox,sideToolbox]"
  );
  equal(filteredData.trimmedSetName, "DevTools");
  ok(filteredData.restrictions.has("bottomToolbox"));
  ok(filteredData.restrictions.has("sideToolbox"));
});