delegate-fullscreen-request-popup-cross-origin.https.sub.tentative.html (2291B)
1 <!DOCTYPE html> 2 <!-- 3 Tentative due to: 4 https://github.com/WICG/capability-delegation/issues/10 5 --> 6 <title>Capability Delegation of Fullscreen Requests: Popup Cross-Origin</title> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <script src="resources/utils.js"></script> 13 14 <div> 15 Verifies that element.requestFullscreen() calls from a cross-origin popup without user activation 16 work if and only if the opener has user activation and it delegates the capability. 17 18 https://wicg.github.io/capability-delegation/spec.html 19 </div> 20 21 <script> 22 let popup = null; 23 24 function testCrossOriginPopupFullscreenDelegation(capability, activate, expectation) { 25 const message = {"type": "make-fullscreen-request"}; 26 const origin = "https://{{hosts[alt][www]}}:{{ports[https][0]}}"; 27 const expectationType = expectation ? "succeeds" : "fails"; 28 const delegationType = capability ? "with delegation" : "without delegation"; 29 const activationType = activate ? "with user activation" : "with no user activation"; 30 31 promise_test(async () => { 32 const data = await postCapabilityDelegationMessage(popup, message, origin, capability, activate); 33 assert_equals(data.result, expectation ? "success" : "failure"); 34 }, `Fullscreen requests from a cross-origin popup ${expectationType} ${delegationType} from an opener ${activationType}`); 35 } 36 37 promise_setup(async () => { 38 // Make sure the recipient popup has loaded. 39 popup = window.open("https://{{hosts[alt][www]}}:{{ports[https][0]}}/html/capability-delegation/resources/delegate-fullscreen-request-recipient.html", 40 "", "width=300,height=200"); 41 return getMessageData("recipient-loaded", popup); 42 }); 43 44 testCrossOriginPopupFullscreenDelegation(/*capability=*/"", /*activate=*/false, /*expectation=*/false); 45 testCrossOriginPopupFullscreenDelegation(/*capability=*/"", /*activate=*/true, /*expectation=*/false); 46 testCrossOriginPopupFullscreenDelegation(/*capability=*/"fullscreen", /*activate=*/true, /*expectation=*/true); 47 </script>