Skip to content

Commit

Permalink
Bug 1890457 [wpt PR 45621] - [document picture-in-picture] Propagate …
Browse files Browse the repository at this point in the history
…user activation to the opener, a=testonly

Automatic update from web-platform-tests
[document picture-in-picture] Propagate user activation to the opener

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
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5393891
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Reviewed-by: Mustaq Ahmed <mustaq@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1304599}

--

wpt-commits: 58221c60ed5e96327514caffba41f9ad583b20b0
wpt-pr: 45621
  • Loading branch information
steimelchrome authored and moz-wptsync-bot committed May 30, 2024
1 parent 5fde32b commit 9ee3dc0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!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');

// Consuming activation in the opener should also consume it in the picture-in-picture window.
window.open();
assert_false(navigator.userActivation.isActive, 'the opener should no longer be active once it consumes activation');
assert_false(pipWindow.navigator.userActivation.isActive, 'the PiP window should no longer be active once the opener consumes activation');
});
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!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');

// Consuming activation in the picture-in-picture window should also consume it in the opener.
pipWindow.open();
assert_false(navigator.userActivation.isActive, 'the opener should no longer be active once the PiP window consumes activation');
assert_false(pipWindow.navigator.userActivation.isActive, 'the PiP window should no longer be active once it consumes activation');
});
</script>

0 comments on commit 9ee3dc0

Please sign in to comment.