payment-default-feature-policy.https.sub.html (1199B)
1 <!DOCTYPE html> 2 <body> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src=/feature-policy/resources/featurepolicy.js></script> 6 <script> 7 'use strict'; 8 var same_origin_src = '/feature-policy/resources/feature-policy-payment.html'; 9 var cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' + 10 same_origin_src; 11 var header = 'Default "payment" feature policy ["self"]'; 12 13 test(() => { 14 var supportedInstruments = [ { supportedMethods: 'visa' } ]; 15 var details = { 16 total: { label: 'Test', amount: { currency: 'USD', value: '5.00' } } 17 }; 18 try { 19 new PaymentRequest(supportedInstruments, details); 20 } catch (e) { 21 assert_unreached(); 22 } 23 }, header + ' allows the top-level document.'); 24 25 async_test(t => { 26 test_feature_availability('PaymentRequest()', t, same_origin_src, 27 expect_feature_available_default); 28 }, header + ' allows same-origin iframes.'); 29 30 async_test(t => { 31 test_feature_availability('PaymentRequest()', t, cross_origin_src, 32 expect_feature_unavailable_default); 33 }, header + ' disallows cross-origin iframes.'); 34 35 </script> 36 </body>