blob: 8d351e3e6825226f564c5647eca040155c493276 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<!DOCTYPE html>
<link rel="help" href="https://w3c.github.io/screen-wake-lock/#dom-wakelocksentinel-released">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
promise_test(async t => {
await test_driver.set_permission({ name: 'screen-wake-lock' }, 'granted');
const lock = await navigator.wakeLock.request("screen");
assert_false(lock.released, "lock.released must be false on creation");
lock.onrelease = t.step_func(() => {
assert_true(lock.released, "WakeLockSentinel.released is true in an onrelease event handler");
});
await lock.release();
assert_true(lock.released, "WakeLockSentinel.released remains true outside the event handler");
}, "The released attribute inside an event handler");
</script>
|