payment-default-permissions-policy.https.sub.html (1594B)
1 <!DOCTYPE html> 2 <body> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/permissions-policy/resources/permissions-policy.js"></script> 6 <script> 7 "use strict"; 8 const same_origin_src = 9 "/permissions-policy/resources/permissions-policy-payment.html"; 10 const cross_origin_src = 11 "https://{{hosts[alt][]}}:{{ports[https][0]}}" + same_origin_src; 12 13 test(() => { 14 const supportedInstruments = [{ supportedMethods: "visa" }]; 15 const details = { 16 total: { 17 label: "Test", 18 amount: { currency: "USD", value: "5.00" }, 19 }, 20 }; 21 try { 22 new PaymentRequest(supportedInstruments, details); 23 } catch (e) { 24 assert_unreached(); 25 } 26 }, `Payment Request API is enabled by default the top-level document.`); 27 28 promise_test((test) => { 29 return test_feature_availability({ 30 feature_description: "PaymentRequest()", 31 test, 32 src: same_origin_src, 33 expect_feature_available: expect_feature_available_default, 34 is_promise_test: true, 35 }); 36 }, `Payment Request API is enabled by default in same-origin iframes.`); 37 38 promise_test((test) => { 39 return test_feature_availability({ 40 feature_description: "PaymentRequest()", 41 test, 42 src: cross_origin_src, 43 expect_feature_available: expect_feature_unavailable_default, 44 is_promise_test: true, 45 }); 46 }, `Payment Request API is disabled by default in cross-origin iframes.`); 47 </script> 48 </body>