<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>
