idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html (2174B)
1 <!DOCTYPE html> 2 <body> 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=/permissions-policy/resources/permissions-policy.js></script> 8 <script> 9 'use strict'; 10 11 const base_src = '/permissions-policy/resources/redirect-on-load.html#'; 12 const sub = 'https://{{domains[www]}}:{{ports[https][0]}}'; 13 const relative_path = 14 '/permissions-policy/resources/permissions-policy-idle-detection.html'; 15 const relative_worker_frame_path = 16 '/permissions-policy/resources/permissions-policy-idle-detection-worker.html'; 17 const same_origin_src = base_src + relative_path; 18 const same_origin_worker_frame_src = base_src + relative_worker_frame_path; 19 const cross_origin_src = base_src + sub + relative_path; 20 const cross_origin_worker_frame_src = base_src + sub + 21 relative_worker_frame_path; 22 23 promise_setup(async () => { 24 await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); 25 }); 26 27 promise_test(async t => { 28 test_feature_availability('new IdleDetector().start()', t, same_origin_src, 29 expect_feature_available_default, 'idle-detection'); 30 }, 'Attribute allow="idle-detection" in top-level frame ' + 31 'allows same-origin relocation.'); 32 33 promise_test(async t => { 34 test_feature_availability('new IdleDetector().start()', t, same_origin_worker_frame_src, 35 expect_feature_available_default, 'idle-detection'); 36 }, 'Attribute allow="idle-detection" in top-level frame ' + 37 'allows workers in same-origin relocation.'); 38 39 promise_test(async t => { 40 test_feature_availability('new IdleDetector().start()', t, cross_origin_src, 41 expect_feature_unavailable_default, 'idle-detection'); 42 }, 'Attribute allow="idle-detection" in top-level frame ' + 43 'disallows cross-origin relocation.'); 44 45 promise_test(async t => { 46 test_feature_availability('new IdleDetector().start()', t, cross_origin_worker_frame_src, 47 expect_feature_unavailable_default, 'idle-detection'); 48 }, 'Attribute allow="idle-detection" in top-level frame ' + 49 'disallows workers in cross-origin relocation.'); 50 51 </script> 52 </body>