Commit d6714bcd authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

[wakelock] Fix all Web Platform Tests

This change fixes all of the wake lock tests in WPT by making two major
changes.

1) Grant wake lock permission at the beginning of the test using the new
   set_permission method on test_runner.
2) Hook up the Mojo interface binder for the wake lock service in
   dedicated worker contexts.

Bug: 257511
Change-Id: I136a2f90bc0c595a35ba707b5ab5200b4c42281a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089966
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751473}
parent 6baf22dd
...@@ -739,6 +739,8 @@ void PopulateDedicatedWorkerBinders(DedicatedWorkerHost* host, ...@@ -739,6 +739,8 @@ void PopulateDedicatedWorkerBinders(DedicatedWorkerHost* host,
map->Add<blink::mojom::QuicTransportConnector>( map->Add<blink::mojom::QuicTransportConnector>(
base::BindRepeating(&DedicatedWorkerHost::CreateQuicTransportConnector, base::BindRepeating(&DedicatedWorkerHost::CreateQuicTransportConnector,
base::Unretained(host))); base::Unretained(host)));
map->Add<blink::mojom::WakeLockService>(base::BindRepeating(
&DedicatedWorkerHost::CreateWakeLockService, base::Unretained(host)));
map->Add<blink::mojom::CacheStorage>(base::BindRepeating( map->Add<blink::mojom::CacheStorage>(base::BindRepeating(
&DedicatedWorkerHost::BindCacheStorage, base::Unretained(host))); &DedicatedWorkerHost::BindCacheStorage, base::Unretained(host)));
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
......
...@@ -390,6 +390,16 @@ void DedicatedWorkerHost::CreateQuicTransportConnector( ...@@ -390,6 +390,16 @@ void DedicatedWorkerHost::CreateQuicTransportConnector(
std::move(receiver)); std::move(receiver));
} }
void DedicatedWorkerHost::CreateWakeLockService(
mojo::PendingReceiver<blink::mojom::WakeLockService> receiver) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Unconditionally disallow wake locks from workers until
// WakeLockPermissionContext has been updated to no longer force the
// permission to "denied" and WakeLockServiceImpl checks permissions on
// every request.
return;
}
void DedicatedWorkerHost::BindCacheStorage( void DedicatedWorkerHost::BindCacheStorage(
mojo::PendingReceiver<blink::mojom::CacheStorage> receiver) { mojo::PendingReceiver<blink::mojom::CacheStorage> receiver) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "third_party/blink/public/mojom/payments/payment_app.mojom-forward.h" #include "third_party/blink/public/mojom/payments/payment_app.mojom-forward.h"
#include "third_party/blink/public/mojom/sms/sms_receiver.mojom-forward.h" #include "third_party/blink/public/mojom/sms/sms_receiver.mojom-forward.h"
#include "third_party/blink/public/mojom/usb/web_usb_service.mojom-forward.h" #include "third_party/blink/public/mojom/usb/web_usb_service.mojom-forward.h"
#include "third_party/blink/public/mojom/wake_lock/wake_lock.mojom-forward.h"
#include "third_party/blink/public/mojom/websockets/websocket_connector.mojom-forward.h" #include "third_party/blink/public/mojom/websockets/websocket_connector.mojom-forward.h"
#include "third_party/blink/public/mojom/webtransport/quic_transport_connector.mojom-forward.h" #include "third_party/blink/public/mojom/webtransport/quic_transport_connector.mojom-forward.h"
#include "third_party/blink/public/mojom/worker/dedicated_worker_host.mojom.h" #include "third_party/blink/public/mojom/worker/dedicated_worker_host.mojom.h"
...@@ -97,6 +98,8 @@ class DedicatedWorkerHost final : public blink::mojom::DedicatedWorkerHost, ...@@ -97,6 +98,8 @@ class DedicatedWorkerHost final : public blink::mojom::DedicatedWorkerHost,
mojo::PendingReceiver<blink::mojom::WebSocketConnector> receiver); mojo::PendingReceiver<blink::mojom::WebSocketConnector> receiver);
void CreateQuicTransportConnector( void CreateQuicTransportConnector(
mojo::PendingReceiver<blink::mojom::QuicTransportConnector> receiver); mojo::PendingReceiver<blink::mojom::QuicTransportConnector> receiver);
void CreateWakeLockService(
mojo::PendingReceiver<blink::mojom::WakeLockService> receiver);
void BindCacheStorage( void BindCacheStorage(
mojo::PendingReceiver<blink::mojom::CacheStorage> receiver); mojo::PendingReceiver<blink::mojom::CacheStorage> receiver);
......
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/page/frame_tree.h"
#include "third_party/blink/renderer/core/testing/internals.h" #include "third_party/blink/renderer/core/testing/internals.h"
#include "third_party/blink/renderer/modules/permissions/permission_utils.h" #include "third_party/blink/renderer/modules/permissions/permission_utils.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
...@@ -42,19 +44,51 @@ ScriptPromise InternalsPermission::setPermission( ...@@ -42,19 +44,51 @@ ScriptPromise InternalsPermission::setPermission(
if (exception_state.HadException()) if (exception_state.HadException())
return ScriptPromise(); return ScriptPromise();
KURL url = url_test_helpers::ToKURL(origin.Utf8()); ExecutionContext* context = ExecutionContext::From(script_state);
if (!url.IsValid()) { KURL url;
exception_state.ThrowDOMException(DOMExceptionCode::kSyntaxError, if (origin.IsNull()) {
"'" + origin + "' is not a valid URL."); const SecurityOrigin* security_origin =
return ScriptPromise(); context->GetSecurityContext().GetSecurityOrigin();
if (security_origin->IsOpaque()) {
exception_state.ThrowDOMException(
DOMExceptionCode::kNotAllowedError,
"Unable to set permission for an opaque origin.");
return ScriptPromise();
}
url = KURL(security_origin->ToString());
DCHECK(url.IsValid());
} else {
url = KURL(origin);
if (!url.IsValid()) {
exception_state.ThrowDOMException(DOMExceptionCode::kSyntaxError,
"'" + origin + "' is not a valid URL.");
return ScriptPromise();
}
} }
KURL embedding_url = url_test_helpers::ToKURL(embedding_origin.Utf8()); KURL embedding_url;
if (!embedding_url.IsValid()) { if (embedding_origin.IsNull()) {
exception_state.ThrowDOMException( const SecurityOrigin* security_origin = Document::From(context)
DOMExceptionCode::kSyntaxError, ->GetFrame()
"'" + embedding_origin + "' is not a valid URL."); ->Tree()
return ScriptPromise(); .Top()
.GetSecurityContext()
->GetSecurityOrigin();
if (security_origin->IsOpaque()) {
exception_state.ThrowDOMException(
DOMExceptionCode::kNotAllowedError,
"Unable to set permission for an opaque embedding origin.");
return ScriptPromise();
}
embedding_url = KURL(security_origin->ToString());
} else {
embedding_url = KURL(embedding_origin);
if (!embedding_url.IsValid()) {
exception_state.ThrowDOMException(
DOMExceptionCode::kSyntaxError,
"'" + embedding_origin + "' is not a valid URL.");
return ScriptPromise();
}
} }
mojo::Remote<test::mojom::blink::PermissionAutomation> permission_automation; mojo::Remote<test::mojom::blink::PermissionAutomation> permission_automation;
......
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
[ [
ImplementedAs=InternalsPermission ImplementedAs=InternalsPermission
] partial interface Internals { ] partial interface Internals {
[CallWith=ScriptState, RaisesException] Promise<void> setPermission(object descriptor, PermissionState state, USVString url, USVString embedding_url); [CallWith=ScriptState, RaisesException] Promise<void> setPermission(object descriptor, PermissionState state, optional USVString? origin = null, optional USVString? embedding_origin = null);
}; };
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script> <script>
"use strict"; "use strict";
Promise.resolve().then(async () => { Promise.resolve().then(async () => {
try { try {
await test_driver.set_permission(
{ name: 'wake-lock', type: 'screen' }, 'granted', false);
const wakeLock = await navigator.wakeLock.request("screen"); const wakeLock = await navigator.wakeLock.request("screen");
await wakeLock.release(); await wakeLock.release();
window.parent.postMessage({ enabled: true }, "*"); window.parent.postMessage({ enabled: true }, "*");
......
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// https://w3c.github.io/wake-lock/
'use strict';
promise_test(async t => {
await test_driver.set_permission(
{ name: 'wake-lock', type: 'system' }, 'granted', false);
await fetch_tests_from_worker(new Worker('resources/idlharness-worker.js'));
}, 'Run idlharness tests in a worker.');
This is a testharness.js-based test.
FAIL idl_test setup promise_test: Unhandled rejection with value: object "NotAllowedError: Wake Lock permission request denied"
PASS idl_test validation
PASS Partial interface Navigator: original interface defined
PASS Partial interface Navigator: member names are unique
PASS Partial interface WorkerNavigator: original interface defined
PASS Partial interface WorkerNavigator: member names are unique
PASS Partial interface mixin NavigatorID: member names are unique
PASS Navigator includes NavigatorID: member names are unique
PASS Navigator includes NavigatorLanguage: member names are unique
PASS Navigator includes NavigatorOnLine: member names are unique
PASS Navigator includes NavigatorContentUtils: member names are unique
PASS Navigator includes NavigatorCookies: member names are unique
PASS Navigator includes NavigatorPlugins: member names are unique
PASS Navigator includes NavigatorConcurrentHardware: member names are unique
PASS WorkerNavigator includes NavigatorID: member names are unique
PASS WorkerNavigator includes NavigatorLanguage: member names are unique
PASS WorkerNavigator includes NavigatorOnLine: member names are unique
PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique
PASS WakeLock interface: existence and properties of interface object
PASS WakeLock interface object length
PASS WakeLock interface object name
PASS WakeLock interface: existence and properties of interface prototype object
PASS WakeLock interface: existence and properties of interface prototype object's "constructor" property
PASS WakeLock interface: existence and properties of interface prototype object's @@unscopables property
PASS WakeLock interface: operation request(WakeLockType)
PASS WakeLock must be primary interface of navigator.wakeLock
PASS Stringification of navigator.wakeLock
PASS WakeLock interface: navigator.wakeLock must inherit property "request(WakeLockType)" with the proper type
PASS WakeLock interface: calling request(WakeLockType) on navigator.wakeLock with too few arguments must throw TypeError
PASS WakeLockSentinel interface: existence and properties of interface object
PASS WakeLockSentinel interface object length
PASS WakeLockSentinel interface object name
PASS WakeLockSentinel interface: existence and properties of interface prototype object
PASS WakeLockSentinel interface: existence and properties of interface prototype object's "constructor" property
PASS WakeLockSentinel interface: existence and properties of interface prototype object's @@unscopables property
PASS WakeLockSentinel interface: attribute type
PASS WakeLockSentinel interface: operation release()
PASS WakeLockSentinel interface: attribute onrelease
FAIL WakeLockSentinel must be primary interface of sentinel assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL Stringification of sentinel assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL WakeLockSentinel interface: sentinel must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL WakeLockSentinel interface: sentinel must inherit property "release()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL WakeLockSentinel interface: sentinel must inherit property "onrelease" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
PASS Navigator interface: attribute wakeLock
PASS Navigator interface: navigator must inherit property "wakeLock" with the proper type
PASS WorkerNavigator interface: existence and properties of interface object
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL idl_test setup promise_test: Unhandled rejection with value: object "NotAllowedError: Failed to execute 'request' on 'WakeLock': Screen locks cannot be requested from workers"
PASS idl_test validation
PASS Partial interface Navigator: original interface defined
PASS Partial interface Navigator: member names are unique
PASS Partial interface WorkerNavigator: original interface defined
PASS Partial interface WorkerNavigator: member names are unique
PASS Partial interface mixin NavigatorID: member names are unique
PASS Navigator includes NavigatorID: member names are unique
PASS Navigator includes NavigatorLanguage: member names are unique
PASS Navigator includes NavigatorOnLine: member names are unique
PASS Navigator includes NavigatorContentUtils: member names are unique
PASS Navigator includes NavigatorCookies: member names are unique
PASS Navigator includes NavigatorPlugins: member names are unique
PASS Navigator includes NavigatorConcurrentHardware: member names are unique
PASS WorkerNavigator includes NavigatorID: member names are unique
PASS WorkerNavigator includes NavigatorLanguage: member names are unique
PASS WorkerNavigator includes NavigatorOnLine: member names are unique
PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique
PASS WakeLock interface: existence and properties of interface object
PASS WakeLock interface object length
PASS WakeLock interface object name
PASS WakeLock interface: existence and properties of interface prototype object
PASS WakeLock interface: existence and properties of interface prototype object's "constructor" property
PASS WakeLock interface: existence and properties of interface prototype object's @@unscopables property
PASS WakeLock interface: operation request(WakeLockType)
PASS WakeLock must be primary interface of navigator.wakeLock
PASS Stringification of navigator.wakeLock
PASS WakeLock interface: navigator.wakeLock must inherit property "request(WakeLockType)" with the proper type
PASS WakeLock interface: calling request(WakeLockType) on navigator.wakeLock with too few arguments must throw TypeError
PASS WakeLockSentinel interface: existence and properties of interface object
PASS WakeLockSentinel interface object length
PASS WakeLockSentinel interface object name
PASS WakeLockSentinel interface: existence and properties of interface prototype object
PASS WakeLockSentinel interface: existence and properties of interface prototype object's "constructor" property
PASS WakeLockSentinel interface: existence and properties of interface prototype object's @@unscopables property
PASS WakeLockSentinel interface: attribute type
PASS WakeLockSentinel interface: operation release()
PASS WakeLockSentinel interface: attribute onrelease
FAIL WakeLockSentinel must be primary interface of sentinel assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL Stringification of sentinel assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL WakeLockSentinel interface: sentinel must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL WakeLockSentinel interface: sentinel must inherit property "release()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
FAIL WakeLockSentinel interface: sentinel must inherit property "onrelease" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: sentinel is not defined"
PASS Navigator interface: existence and properties of interface object
PASS WorkerNavigator interface: attribute wakeLock
PASS WorkerNavigator interface: navigator must inherit property "wakeLock" with the proper type
Harness: the test ran to completion.
// META: script=/resources/WebIDLParser.js // META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js // META: script=/resources/idlharness.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// https://w3c.github.io/wake-lock/ // https://w3c.github.io/wake-lock/
...@@ -9,18 +11,15 @@ idl_test( ...@@ -9,18 +11,15 @@ idl_test(
['wake-lock'], ['wake-lock'],
['dom', 'html', 'permissions'], ['dom', 'html', 'permissions'],
async idl_array => { async idl_array => {
if (self.GLOBAL.isWorker()) { idl_array.add_objects({ Navigator: ['navigator'] });
idl_array.add_objects({ WorkerNavigator: ['navigator'] });
} else {
idl_array.add_objects({ Navigator: ['navigator'] });
}
idl_array.add_objects({ idl_array.add_objects({
WakeLock: ['navigator.wakeLock'], WakeLock: ['navigator.wakeLock'],
WakeLockSentinel: ['sentinel'], WakeLockSentinel: ['sentinel'],
}); });
// For now, this assumes the request will be granted and the promise will await test_driver.set_permission(
// be fulfilled with a WakeLockSentinel object. { name: 'wake-lock', type: 'screen' }, 'granted', false);
self.sentinel = await navigator.wakeLock.request('screen'); self.sentinel = await navigator.wakeLock.request('screen');
self.sentinel.release(); self.sentinel.release();
} }
......
'use strict';
// https://w3c.github.io/wake-lock/
importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
idl_test(
['wake-lock'],
['dom', 'html', 'permissions'],
async idl_array => {
idl_array.add_objects({ WorkerNavigator: ['navigator'] });
idl_array.add_objects({
WakeLock: ['navigator.wakeLock'],
WakeLockSentinel: ['sentinel'],
});
self.sentinel = await navigator.wakeLock.request('system');
self.sentinel.release();
}
);
done();
This is a testharness.js-based test.
FAIL Feature-Policy allow="wake-lock" allows same-origin relocation assert_true: navigator.wakeLock.request("screen") expected true got false
PASS Feature-Policy allow="wake-lock" disallows cross-origin relocation
Harness: the test ran to completion.
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
const cross_origin_src = const cross_origin_src =
base_src + "https://{{domains[www]}}:{{ports[https][0]}}" + relative_path; base_src + "https://{{domains[www]}}:{{ports[https][0]}}" + relative_path;
// request() checks for both Feature Policy and permission, so the tests below
// can have inconsistent results due to the default permission a wake lock
// request might return.
async_test(t => { async_test(t => {
test_feature_availability( test_feature_availability(
'navigator.wakeLock.request("screen")', 'navigator.wakeLock.request("screen")',
......
This is a testharness.js-based test.
FAIL Feature policy "wake-lock" can be enabled in same-origin iframe using allow="wake-lock" attribute assert_true: navigator.wakeLock.request("screen") expected true got false
FAIL Feature policy "wake-lock" can be enabled in cross-origin iframe using allow="wake-lock" attribute assert_true: navigator.wakeLock.request("screen") expected true got false
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL Feature-Policy header {"wake-lock" : ["*"]} allows the top-level document. promise_test: Unhandled rejection with value: object "NotAllowedError: Wake Lock permission request denied"
FAIL Feature-Policy header {"wake-lock" : ["*"]} allows same-origin iframes. assert_true: navigator.wakeLock.request("screen") expected true got false
FAIL Feature-Policy header {"wake-lock" : ["*"]} allows cross-origin iframes. assert_true: navigator.wakeLock.request("screen") expected true got false
Harness: the test ran to completion.
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<body> <body>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/feature-policy/resources/featurepolicy.js"></script> <script src="/feature-policy/resources/featurepolicy.js"></script>
<script> <script>
"use strict"; "use strict";
...@@ -11,12 +13,10 @@ ...@@ -11,12 +13,10 @@
const cross_origin_src = const cross_origin_src =
"https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src; "https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src;
// request() checks for both Feature Policy and permission, so the tests below promise_test(async t => {
// can have inconsistent results due to the default permission a wake lock await test_driver.set_permission(
// request might return. { name: 'wake-lock', type: 'screen' }, 'granted', false);
await navigator.wakeLock.request('screen').then(lock => lock.release());
promise_test(t => {
return navigator.wakeLock.request('screen').then(lock => lock.release());
}, 'Feature-Policy header {"wake-lock" : ["*"]} allows the top-level document.'); }, 'Feature-Policy header {"wake-lock" : ["*"]} allows the top-level document.');
async_test(t => { async_test(t => {
......
This is a testharness.js-based test.
FAIL Feature-Policy header wake-lock "self" allows the top-level document. promise_test: Unhandled rejection with value: object "NotAllowedError: Wake Lock permission request denied"
FAIL Feature-Policy header wake-lock "self" allows same-origin iframes. assert_true: navigator.wakeLock.request("screen") expected true got false
PASS Feature-Policy header wake-lock "self" disallows cross-origin iframes.
Harness: the test ran to completion.
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<body> <body>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/feature-policy/resources/featurepolicy.js"></script> <script src="/feature-policy/resources/featurepolicy.js"></script>
<script> <script>
...@@ -12,12 +14,10 @@ ...@@ -12,12 +14,10 @@
const cross_origin_src = const cross_origin_src =
"https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src; "https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src;
// request() checks for both Feature Policy and permission, so the tests below promise_test(async t => {
// can have inconsistent results due to the default permission a wake lock await test_driver.set_permission(
// request might return. { name: 'wake-lock', type: 'screen' }, 'granted', false);
await navigator.wakeLock.request('screen').then(lock => lock.release());
promise_test(t => {
return navigator.wakeLock.request('screen').then(lock => lock.release());
}, 'Feature-Policy header wake-lock "self" allows the top-level document.'); }, 'Feature-Policy header wake-lock "self" allows the top-level document.');
async_test(t => { async_test(t => {
......
...@@ -395,8 +395,7 @@ ...@@ -395,8 +395,7 @@
// TODO(https://crbug.com/977612): Chromium currently lacks support for // TODO(https://crbug.com/977612): Chromium currently lacks support for
// |permission_params.one_realm| and will always consider it is set to false. // |permission_params.one_realm| and will always consider it is set to false.
return internals.setPermission(permission_params.descriptor, return internals.setPermission(permission_params.descriptor,
permission_params.state, permission_params.state);
location.origin, location.origin);
} }
// Enable automation so we don't wait for user input on unimplemented APIs // Enable automation so we don't wait for user input on unimplemented APIs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment