summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/permissions/all-permissions.html
blob: 9ad014bc6e2c9785ce05bbeb364f286e07d168e3 (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
<!doctype html>
<meta charset=utf-8>
<title>Test all known permissions support</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="log"></div>

<script>
  // These are marked "at risk" in the spec...
  const atRisk = [
    "accelerometer",
    "ambient-light-sensor",
    "background-fetch",
    "background-sync",
    "bluetooth",
    "gyroscope",
    "magnetometer",
    "midi",
    "nfc",
    "screen-wake-lock",
    "camera",
    "display-capture",
    "microphone",
    "speaker-selection",
    "xr-spatial-tracking",
  ];

  // These are known to be supported by multiple engines...
  const permissions = [
    "geolocation",
    "notifications",
    "persistent-storage",
    "push",
  ]

  for (const name of [...permissions, ...atRisk]) {
    promise_test(async (test) => {
      const status = await navigator.permissions.query({ name });
      assert_true(status instanceof PermissionStatus);
      //assert_equals(status.name, name, `permission's name should be "${name}"`);
    }, `Query "${name}" permission`);
  }
</script>