-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 a disabled-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 Bug: 331246719 Change-Id: Iedad1e0cb60e04fc1ccf350405f04a399a2b72a1
- Loading branch information
1 parent
d32b68c
commit 4d0db97
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
document-picture-in-picture/propagate-user-activation-from-opener.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
21 changes: 21 additions & 0 deletions
21
document-picture-in-picture/propagate-user-activation-to-opener.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |