delegate-fullscreen-request-popup-same-origin.https.tentative.html (2148B)
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 Same-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 same-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 testSameOriginPopupFullscreenDelegation(capability, activate, expectation) { 25 const message = {"type": "make-fullscreen-request"}; 26 const expectationType = expectation ? "succeeds" : "fails"; 27 const delegationType = capability ? "with delegation" : "without delegation"; 28 const activationType = activate ? "with user activation" : "with no user activation"; 29 30 promise_test(async () => { 31 const data = await postCapabilityDelegationMessage(popup, message, location.origin, capability, activate); 32 assert_equals(data.result, expectation ? "success" : "failure"); 33 }, `Fullscreen requests from a same-origin popup ${expectationType} ${delegationType} from an opener ${activationType}`); 34 } 35 36 promise_setup(async () => { 37 // Make sure the recipient popup has loaded. 38 popup = window.open("./resources/delegate-fullscreen-request-recipient.html", 39 "", "width=300,height=200"); 40 return getMessageData("recipient-loaded", popup); 41 }); 42 43 testSameOriginPopupFullscreenDelegation(/*capability=*/"", /*activate=*/false, /*expectation=*/false); 44 testSameOriginPopupFullscreenDelegation(/*capability=*/"", /*activate=*/true, /*expectation=*/false); 45 testSameOriginPopupFullscreenDelegation(/*capability=*/"fullscreen", /*activate=*/true, /*expectation=*/true); 46 </script>