File: propagate-user-activation-from-opener.https.html

package info (click to toggle)
firefox 144.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,637,504 kB
  • sloc: cpp: 7,576,692; javascript: 6,430,831; ansic: 3,748,119; python: 1,398,978; xml: 628,810; asm: 438,679; java: 186,194; sh: 63,212; makefile: 19,159; objc: 13,086; perl: 12,986; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (27 lines) | stat: -rw-r--r-- 1,511 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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>