| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>Wake Lock API 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 => { |
| assert_true("getWakeLock" in navigator, "Wake Lock API is present"); |
| const wakeLock = await navigator.getWakeLock("screen"); |
| const request = wakeLock.createRequest(); |
| assert_true(wakeLock instanceof WakeLock, "wakeLock is a WakeLock"); |
| assert_equals(typeof wakeLock.type, "string", "the type of wakeLock.type is string"); |
| assert_equals(typeof wakeLock.active, "boolean", "the type of wakeLock.active is boolean"); |
| assert_true(request instanceof WakeLockRequest, "request is a WakeLockRequest"); |
| }, "Test that the Wake Lock API is correct"); |
| |
| </script> |