Revision 6a53accb3f4093ae4cd2dc8f7a086cd33c0b947f authored by Chris Nardi on 19 March 2018, 18:03:21 UTC, committed by Chris Nardi on 19 March 2018, 18:03:21 UTC
https://github.com/w3c/fxtf-drafts/issues/231 was resolved by allowing this grammar in the spec.
1 parent 730eca9
wakelock-onactivechange.https.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Wake Lock 'onactivechange' Test</title>
<link rel="help" href="https://w3c.github.io/wake-lock/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async t => {
const wakeLock = await navigator.getWakeLock("screen");
const eventWatcher = new EventWatcher(t, wakeLock, "activechange");
assert_false(wakeLock.active, "the active is false before wake lock is acquired");
let request = wakeLock.createRequest();
let evt1 = await eventWatcher.wait_for("activechange");
assert_true(evt1.isTrusted && !evt1.bubbles && !evt1.cancelable && evt1 instanceof Event, "a simple event is fired");
assert_equals(evt1.type, "activechange", "the event name is 'activechange'");
assert_equals(evt1.target, wakeLock, "event.target is WakeLock.");
assert_true(wakeLock.active, "the active is true when wake lock is acquired");
request.cancel();
let evt2 = await eventWatcher.wait_for("activechange");
assert_true(evt2.isTrusted && !evt2.bubbles && !evt2.cancelable && evt2 instanceof Event, "a simple event is fired");
assert_false(wakeLock.active, "the active is false when wake lock is released");
}, "Test that 'activechange' event is fire and wakeLock.active is valid");
</script>
Computing file changes ...