Skip to content

Commit

Permalink
Prerender: Upstream Wake Lock API test to WPT
Browse files Browse the repository at this point in the history
https://wicg.github.io/nav-speculation/prerendering.html#implicitly-restricted

Bug: 1253158
Change-Id: Idd24b536f5f93a8516d144471292524e3b41614a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3856624
Commit-Queue: Antia Puentes <apuentes@igalia.com>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1039679}
  • Loading branch information
antiapuentes authored and Chromium LUCI CQ committed Aug 26, 2022
1 parent cdde39c commit 9d9d1e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
<meta name="timeout" content="long">
<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 src="/common/utils.js"></script>
<script src="/speculation-rules/prerender/resources/utils.js"></script>
<body>
<script>

// Before upstreaming to WPT, this test needs to use a WebDriver API to set
// the permission instead of internals.setPermission.
setup(() => assertSpeculationRulesIsSupported());

promise_test(async t => {
const uid = token();
const bc = new PrerenderChannel('test-channel', uid);
Expand All @@ -18,8 +20,7 @@
// navigator.wakeLock.request() waits until the permission is granted, which
// is deferred during prerendering so the test would trivially pass without
// the permission.
await internals.setPermission({name: 'screen-wake-lock'}, 'granted',
location.origin, location.origin);
await test_driver.set_permission({ name: 'screen-wake-lock' }, 'granted');

const gotMessage = new Promise(resolve => {
bc.addEventListener('message', e => {
Expand Down

0 comments on commit 9d9d1e6

Please sign in to comment.