bluetooth-allowed-by-permissions-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=/bluetooth/resources/bluetooth-test.js></script> 6 <script src=/permissions-policy/resources/permissions-policy.js></script> 7 <script> 8 'use strict'; 9 const same_origin_src = '/permissions-policy/resources/permissions-policy-bluetooth.html'; 10 const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' + same_origin_src; 11 const header = 'permissions policy header "bluetooth=*"'; 12 13 bluetooth_test(() => { 14 promise_test(() => { 15 return navigator.bluetooth.getDevices(); 16 }, header + ' allows the top-level document.'); 17 18 async_test(t => { 19 test_feature_availability('bluetooth.getDevices()', t, same_origin_src, expect_feature_available_default); 20 }, header + ' allows same-origin iframes.'); 21 22 async_test(t => { 23 test_feature_availability('bluetooth.getDevices()', t, cross_origin_src, expect_feature_unavailable_default); 24 }, header + ' disallows cross-origin iframes.'); 25 26 async_test(t => { 27 test_feature_availability('bluetooth.getDevices()', t, cross_origin_src, expect_feature_available_default, 'bluetooth'); 28 }, header + ' allow="bluetooth" allows cross-origin iframes.'); 29 }); 30 </script> 31 </body>