summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/permissions-policy/resources/permissions-policy-screen-wakelock.html
blob: b1866322518c5fba1de01a8e7509a2e0b9d49dd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
"use strict";

Promise.resolve().then(async () => {
  try {
    await test_driver.set_permission(
        { name: 'screen-wake-lock' }, 'granted');

    const wakeLock = await navigator.wakeLock.request("screen");
    await wakeLock.release();
    window.parent.postMessage({ type: 'availability-result', enabled: true }, "*");
  } catch (e) {
    window.parent.postMessage({ type: 'availability-result', enabled: false }, "*");
  }
});
</script>