Files
firefox/testing/web-platform/tests/fullscreen/api/permission.tentative.https.html
Mike Wasserman e8ff2dc560 Bug 1903166 [wpt PR 46804] - Automatic Fullscreen: Prototype Permissions API query support, a=testonly
Automatic update from web-platform-tests
Automatic Fullscreen: Prototype Permissions API query support

Add navigator.permissions.query support for a new descriptor:
  {name:'fullscreen', allowWithoutGesture:true}
Gate on RunTimeEnabledFeature AutomaticFullscreenPermissionsQuery.

Enhances feature detection and debuggability, per guidance:
https://groups.google.com/a/chromium.org/g/blink-dev/c/WOch5LPq9RY

Yield `TypeError` for allowWithoutGesture:false, like unknown names.
Descriptor supports potential future fullscreen permission iteration.
http://doc/1ojUXRUcciyjxAgXOuTZoYREzI4Xp_dUd9NiFlYJxMew

Associate permission with `fullscreen` permissions policy feature.
(yield 'denied' for frames without `fullscreen` permissions policy)

Add interactive_ui_tests, tentative WPT, and inspector-protocol tests.
Refine supporting test functionality.

https://chromestatus.com/feature/6218822004768768
https://github.com/explainers-by-googlers/html-fullscreen-without-a-gesture
http://go/automatic-fullscreen-content-setting

Bug: 40941384
Test: Automated; Permissions API query WAI with flag enabled.
Change-Id: If9adac187ef712a9064855055953d3882305bf05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5583182
Commit-Queue: Mike Wasserman <[email protected]>
Reviewed-by: Elias Klim <[email protected]>
Reviewed-by: Mike West <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1317128}

--

wpt-commits: 6733607a85580814f8eded6861481f737f26c9b8
wpt-pr: 46804
2024-06-24 07:48:55 +00:00

40 lines
1.8 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<title>Permissions API query support for "fullscreen"</title>
<link rel="help" href="https://github.com/explainers-by-googlers/html-fullscreen-without-a-gesture">
<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>
promise_test(async (test) => {
let allowWithoutGestureCalled = false;
const status = await navigator.permissions.query({
name: "fullscreen",
get allowWithoutGesture() {
allowWithoutGestureCalled = true;
return true;
},
});
assert_true(status instanceof PermissionStatus);
assert_equals(status.name, "fullscreen", `name should be "fullscreen"`);
assert_true(allowWithoutGestureCalled, `allowWithoutGesture should be checked`);
}, `Querying "fullscreen" permission checks "allowWithoutGesture" option`);
promise_test(async (test) => {
const descriptor = { name: "fullscreen", allowWithoutGesture: true };
await test_driver.set_permission(descriptor, "granted");
const status = await navigator.permissions.query(descriptor);
assert_true(status instanceof PermissionStatus);
assert_equals(status.name, "fullscreen", `name should be "fullscreen"`);
assert_equals(status.state, "granted", `state should be "granted", as set`);
}, `Set and query "fullscreen" permission with "allowWithoutGesture" true`);
promise_test((test) => {
const descriptor = { name: "fullscreen", allowWithoutGesture: false };
return promise_rejects_js(test, TypeError, navigator.permissions.query(descriptor));
}, `Querying "fullscreen" permission with "allowWithoutGesture" false is unsupported`);
</script>