display-mode.https.html (1002B)
1 <!DOCTYPE html> 2 <title>Test picture-in-picture display mode</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <body> 8 <script> 9 promise_test(async (t) => { 10 await test_driver.bless('request PiP window'); 11 const pipWindow = await documentPictureInPicture.requestWindow(); 12 13 await new Promise(requestAnimationFrame); 14 assert_true( 15 !!pipWindow.matchMedia('(display-mode: picture-in-picture)'.matches), 16 'PIP matches display mode' 17 ); 18 19 const iframe = pipWindow.document.createElement("iframe"); 20 iframe.src = '/common/blank.html'; 21 pipWindow.document.body.append(iframe); 22 await new Promise(res => iframe.addEventListener("load", res, { once: true })); 23 24 assert_true( 25 !!iframe.contentWindow.matchMedia('(display-mode: picture-in-picture)'.matches), 26 'iframe in PIP matches display mode' 27 ); 28 }); 29 </script> 30 </body>