blob: 68e8a1958165d9053eedf1bb97fd67e8eece15fb [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>no exception is thrown when invoking cancel() twice</title>
<link rel="help" href="https://w3c.github.io/wake-lock/#dom-wakelockrequest-cancel">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async t => {
const wakeLock = await navigator.getWakeLock("screen");
const request = wakeLock.createRequest();
assert_true(wakeLock.active, "the activate is true when wake lock is acquired");
request.cancel();
assert_false(wakeLock.active, "the activate is false when wake lock is released");
//If the cancel() method has already been invoked on this object,
//abort these steps, no error fired
request.cancel();
}, "no exception is thrown when invoking cancel() twice");
</script>