autoplay-default-feature-policy.https.sub.html (1347B)
1 <!DOCTYPE html> 2 <body> 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 <script src=/common/media.js></script> 8 <script src=/feature-policy/resources/featurepolicy.js></script> 9 <script src=/feature-policy/resources/autoplay.js></script> 10 <script> 11 'use strict'; 12 const same_origin_src = '/feature-policy/resources/feature-policy-autoplay.html'; 13 const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' + 14 same_origin_src; 15 const header = 'Default "autoplay" feature policy ["self"]'; 16 17 async_test(t => { 18 simulateGesture(t, () => { 19 isAutoplayAllowed().then(t.step_func_done((result) => { 20 assert_true(result); 21 })); 22 }); 23 }, header + ' allows the top-level document.'); 24 25 async_test(t => { 26 simulateGesture(t, () => { 27 test_feature_availability('autoplay', t, same_origin_src, 28 expect_feature_available_default); 29 }); 30 }, header + ' allows same-origin iframes.'); 31 32 async_test(t => { 33 simulateGesture(t, () => { 34 test_feature_availability('autoplay', t, cross_origin_src, 35 expect_feature_unavailable_default,); 36 }); 37 }, header + ' disallows cross-origin iframes.'); 38 </script> 39 </body>