writer-iframe.tentative.https.html (2401B)
1 <!DOCTYPE html> 2 <meta name="timeout" content="long"> 3 <script src="/resources/testdriver.js"></script> 4 <script src="/resources/testdriver-vendor.js"></script> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/get-host-info.sub.js"></script> 8 <script src="../resources/util.js"></script> 9 <body></body> 10 <script> 11 'use strict'; 12 13 const { HTTPS_ORIGIN, HTTPS_NOTSAMESITE_ORIGIN } = get_host_info(); 14 const PATH = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1); 15 const IFRAME_PATH = PATH + 'resources/iframe-helper.html'; 16 17 promise_test(async t => { 18 const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH; 19 const iframe = await load_iframe(src, /*permission_policy=*/''); 20 await promise_rejects_dom(t, 'NotAllowedError', run_iframe_test(iframe, 'WriterCreate')); 21 }, 'Throw a \'NotAllowedError\' when creating Writer within cross-origin iframe'); 22 23 promise_test(async t => { 24 const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH; 25 const iframe = await load_iframe(src, 'writer'); 26 assert_equals(await run_iframe_test(iframe, 'WriterCreate'), 'Success'); 27 }, 'Writer can be created within cross-origin iframe with permission policy'); 28 29 promise_test(async t => { 30 const src = HTTPS_ORIGIN + IFRAME_PATH; 31 const iframe = await load_iframe(src, /*permission_policy=*/''); 32 assert_equals(await run_iframe_test(iframe, 'WriterCreate'), 'Success'); 33 }, 'Writer can be used within same-origin iframe'); 34 35 promise_test(async t => { 36 const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH; 37 const iframe = await load_iframe(src, /*permission_policy=*/''); 38 assert_equals( 39 await run_iframe_test(iframe, 'WriterAvailability'), 'unavailable'); 40 }, 'Writer is unavailable within cross-origin iframe'); 41 42 promise_test(async t => { 43 const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH; 44 const iframe = await load_iframe(src, 'writer'); 45 assert_in_array( 46 await run_iframe_test(iframe, 'WriterAvailability'), 47 kAvailableAvailabilities); 48 }, 'Writer is available within cross-origin iframe with permission policy'); 49 50 promise_test(async t => { 51 const src = HTTPS_ORIGIN + IFRAME_PATH; 52 const iframe = await load_iframe(src, /*permission_policy=*/''); 53 assert_in_array( 54 await run_iframe_test(iframe, 'WriterAvailability'), 55 kAvailableAvailabilities); 56 }, 'Writer is available within same-origin iframe'); 57 58 </script>