fullscreen-interactions.html (1542B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <meta viewport="width=device-width, initial-scale=1" /> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-vendor.js"></script> 8 <body></body> 9 <script type="module"> 10 import { 11 getOppositeOrientation, 12 attachIframe, 13 makeCleanup, 14 } from "./resources/orientation-utils.js"; 15 16 promise_test(async (t) => { 17 t.add_cleanup(makeCleanup()); 18 await test_driver.bless("request full screen"); 19 await document.documentElement.requestFullscreen(); 20 const currentOrientation = screen.orientation.type; 21 await screen.orientation.lock( 22 getOppositeOrientation() 23 ); 24 }, "fullscreen and orientation support"); 25 26 promise_test(async (t) => { 27 const iframe = await attachIframe(); 28 t.add_cleanup(makeCleanup({ iframe })); 29 const iframeWindow = iframe.contentWindow; 30 await test_driver.bless("request full screen"); 31 await document.documentElement.requestFullscreen(); 32 const currentOrientation = window.screen.orientation.type; 33 const lockPromise = iframeWindow.screen.orientation.lock( 34 getOppositeOrientation() 35 ); 36 const fsExitPromise = document.exitFullscreen(); 37 await promise_rejects_dom( 38 t, 39 "SecurityError", 40 iframeWindow.DOMException, 41 lockPromise 42 ); 43 await fsExitPromise; 44 }, "Iframe can't itself know if it's parent is fullscreen when changing orientation"); 45 </script>