Skip to content

Commit

Permalink
[document picture-in-picture] Propagate user activation to the opener
Browse files Browse the repository at this point in the history
This CL changes browser-process-side user activation logic to allow
activations in document picture-in-picture windows to be used in their
opener windows, and activations in the opener windows to be used in
their document picture-in-picture windows.

This feature is behind an enabled-by-default feature flag.

Specification change:
WICG/document-picture-in-picture#117

Chromestatus: https://chromestatus.com/feature/5185710702460928

Intent to Prototype:
https://groups.google.com/a/chromium.org/g/blink-dev/c/MwH0ODG4bec

Intent to Ship:
https://groups.google.com/a/chromium.org/g/blink-dev/c/AfzrMoCgccQ

Bug: 331246719
Change-Id: Iedad1e0cb60e04fc1ccf350405f04a399a2b72a1
  • Loading branch information
steimelchrome authored and chromium-wpt-export-bot committed May 15, 2024
1 parent 1789aef commit e3b25ae
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<title>Test that a user activation in window that owns a document picture-in-picture window is usable in the
document picture-in-picture window</title>
<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>
<body>
<script>
promise_test(async (t) => {
await test_driver.bless('request PiP window');
const pipWindow = await documentPictureInPicture.requestWindow();

assert_false(navigator.userActivation.isActive, 'the opener should initially not have user activation');
assert_false(pipWindow.navigator.userActivation.isActive, 'the PiP window should initially not have user activation');

// Activating this window should also activate the picture-in-picture window.
await test_driver.bless('activate opener window');
assert_true(navigator.userActivation.isActive, 'the opener should be activated when the PiP window is activated');
assert_true(pipWindow.navigator.userActivation.isActive, 'the PiP window should be activated');
});
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<title>Test that a user activation in a document picture-in-picture window is usable in its opener window</title>
<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>
<body>
<script>
promise_test(async (t) => {
await test_driver.bless('request PiP window');
const pipWindow = await documentPictureInPicture.requestWindow();

assert_false(navigator.userActivation.isActive, 'the opener should initially not have user activation');
assert_false(pipWindow.navigator.userActivation.isActive, 'the PiP window should initially not have user activation');

// Activating the picture-in-picture window should also activate the opener.
await test_driver.bless('activate pip window', null, pipWindow);
assert_true(navigator.userActivation.isActive, 'the opener should be activated when the PiP window is activated');
assert_true(pipWindow.navigator.userActivation.isActive, 'the PiP window should be activated');
});
</script>

0 comments on commit e3b25ae

Please sign in to comment.