bluetooth-disabled-by-permissions-policy.https.sub.html (1545B)
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().then(() => { 16 assert_unreached('expected promise to reject with SecurityError.'); 17 }, error => { 18 assert_equals(error.name, 'SecurityError'); 19 }); 20 }, header + ' disallows the top-level document.') 21 22 async_test(t => { 23 test_feature_availability('bluetooth.getDevices()', t, same_origin_src, expect_feature_unavailable_default); 24 }, header + ' disallows same-origin iframes.'); 25 26 async_test(t => { 27 test_feature_availability('bluetooth.getDevices()', t, cross_origin_src, expect_feature_unavailable_default); 28 }, header + ' disallows cross-origin iframes.'); 29 30 async_test(t => { 31 test_feature_availability('bluetooth.getDevices()', t, cross_origin_src, expect_feature_unavailable_default, 'bluetooth'); 32 }, header + ' allow="bluetooth" has no effect on cross-origin iframes.'); 33 }); 34 </script> 35 </body>