summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/test/xpcshell/test_ext_downloads.js
blob: f65df707e1795d645dbacad7b58b8b282139e0ef (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
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

add_task(async function test_downloads_api_namespace_and_permissions() {
  function backgroundScript() {
    browser.test.assertTrue(!!browser.downloads, "`downloads` API is present.");
    browser.test.assertTrue(
      !!browser.downloads.FilenameConflictAction,
      "`downloads.FilenameConflictAction` enum is present."
    );
    browser.test.assertTrue(
      !!browser.downloads.InterruptReason,
      "`downloads.InterruptReason` enum is present."
    );
    browser.test.assertTrue(
      !!browser.downloads.DangerType,
      "`downloads.DangerType` enum is present."
    );
    browser.test.assertTrue(
      !!browser.downloads.State,
      "`downloads.State` enum is present."
    );
    browser.test.notifyPass("downloads tests");
  }

  let extensionData = {
    background: backgroundScript,
    manifest: {
      permissions: ["downloads", "downloads.open"],
    },
  };

  let extension = ExtensionTestUtils.loadExtension(extensionData);
  await extension.startup();
  await extension.awaitFinish("downloads tests");
  await extension.unload();
});