| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="resources/helper.js"></script> |
| <iframe allow="payment"></iframe> |
| <iframe allow="payment" allowpaymentrequest></iframe> |
| <script> |
| var srcs = [ |
| "resources/feature-policy-payment.html", |
| "http://localhost:8000/feature-policy/resources/feature-policy-payment.html" |
| ]; |
| |
| function loadFrame(iframe, src) { |
| var allowpaymentrequest = iframe.hasAttribute('allowpaymentrequest'); |
| promise_test(function() { |
| iframe.src = src; |
| return new Promise(function(resolve, reject) { |
| window.addEventListener('message', function(e) { |
| resolve(e.data); |
| }, { once: true }); |
| }).then(function(data) { |
| assert_true(data.enabled, 'Paymentrequest():'); |
| }); |
| }, 'Paymentrequest enabled by container policy on URL: ' + src + |
| ' with allowpaymentrequest = ' + allowpaymentrequest); |
| } |
| |
| window.onload = function() { |
| loadIframes(srcs); |
| } |
| </script> |