idle-detection-allowed-by-permissions-policy.https.sub.html (2221B)
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 sub = 'https://{{domains[www]}}:{{ports[https][0]}}'; 12 const same_origin_src = 13 '/permissions-policy/resources/permissions-policy-idle-detection.html' 14 const same_origin_worker_frame_src = 15 '/permissions-policy/resources/permissions-policy-idle-detection-worker.html'; 16 const cross_origin_src = sub + same_origin_src; 17 const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src; 18 19 promise_setup(async () => { 20 await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); 21 }); 22 23 promise_test(async t => { 24 await new IdleDetector().start(); 25 }, 26 'Permissions-Policy idle-detection=* explicity set by top-level ' + 27 'frame allows the top-level document.'); 28 29 promise_test(async t => { 30 test_feature_availability('new IdleDetector().start()', t, same_origin_src, 31 expect_feature_available_default); 32 }, 'Permissions-Policy idle-detection=* explicity set by top-level ' + 33 'frame allows same-origin iframes.'); 34 35 promise_test(async t => { 36 test_feature_availability('new IdleDetector().start()', t, same_origin_worker_frame_src, 37 expect_feature_available_default); 38 }, 'Permissions-Policy idle-detection=* explicity set by top-level ' + 39 'frame allows workers in same-origin iframes.'); 40 41 promise_test(async t => { 42 test_feature_availability('new IdleDetector().start()', t, cross_origin_src, 43 expect_feature_available_default); 44 }, 'Permissions-Policy idle-detection=* explicity set by top-level ' + 45 'frame allows cross-origin iframes.'); 46 47 promise_test(async t => { 48 test_feature_availability('new IdleDetector().start()', t, cross_origin_worker_frame_src, 49 expect_feature_available_default); 50 }, 'Permissions-Policy idle-detection=* explicity set by top-level ' + 51 'frame allows workers in cross-origin iframes.'); 52 53 fetch_tests_from_worker(new Worker( 54 'resources/idle-detection-allowed-by-permissions-policy-worker.js')) 55 56 </script> 57 </body>