pip-move.tentative.https.html (1181B)
1 <!DOCTYPE html> 2 <title>Test that a moveTo and moveBy are disabled for a document picture-in-picture window</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 from top window'); 11 const pipWindow = await documentPictureInPicture.requestWindow(); 12 13 const initialX = pipWindow.screenX, initialY = pipWindow.screenY; 14 15 // Unlikely, but let's make sure move doesn't fail due to a lack of space 16 // I.e. if PiP is in top left, move down right, otherwise up left. 17 const x = initialX > 50 ? 20 : 60; 18 const y = initialY > 50 ? 20 : 60; 19 20 try { 21 pipWindow.moveTo(x, y); 22 pipWindow.moveBy(x, y); 23 } catch (e) { 24 // Test is tentative because it's not specified whether to throw 25 assert_unreached("moveTo and moveBy should not throw"); 26 } 27 28 assert_equals(pipWindow.screenX, initialX, 'PiP screenX did not change'); 29 assert_equals(pipWindow.screenY, initialY, 'PiP screenY did not change'); 30 }); 31 </script> 32 </body>