summaryrefslogtreecommitdiffstats
path: root/remote/marionette/test/xpcshell/test_browser.js
blob: fdd83ba7e3b85895a2bca35d6f54dd79774ee3b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { Context } = ChromeUtils.importESModule(
  "chrome://remote/content/marionette/browser.sys.mjs"
);

add_task(function test_Context() {
  ok(Context.hasOwnProperty("Chrome"));
  ok(Context.hasOwnProperty("Content"));
  equal(typeof Context.Chrome, "string");
  equal(typeof Context.Content, "string");
  equal(Context.Chrome, "chrome");
  equal(Context.Content, "content");
});

add_task(function test_Context_fromString() {
  equal(Context.fromString("chrome"), Context.Chrome);
  equal(Context.fromString("content"), Context.Content);

  for (let typ of ["", "foo", true, 42, [], {}, null, undefined]) {
    Assert.throws(() => Context.fromString(typ), /TypeError/);
  }
});