Source code

Revision control

Copy as Markdown

Other Tools

<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
"use strict";
Promise.resolve().then(async () => {
test_driver.set_test_context(window.parent);
await test_driver.set_permission({ name: 'screen-wake-lock' }, 'granted');
try {
const wakeLock = await navigator.wakeLock.request("screen");
window.parent.postMessage({ type: 'availability-result', enabled: true }, "*");
await wakeLock.release();
} catch (e) {
if (e instanceof DOMException && e.name === "NotAllowedError") {
window.parent.postMessage({ type: 'availability-result', enabled: false }, "*");
} else {
throw e;
}
}
});
</script>