payment-report-only.https.html (1353B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src='/resources/testharness.js'></script> 5 <script src='/resources/testharnessreport.js'></script> 6 <script src='/resources/testdriver.js'></script> 7 <script src='/resources/testdriver-vendor.js'></script> 8 </head> 9 <body> 10 <script> 11 var check_report_format = ([reports, observer]) => { 12 let report = reports[0]; 13 assert_equals(report.type, "permissions-policy-violation"); 14 assert_equals(report.body.featureId, "payment"); 15 assert_equals(report.body.disposition, "report"); 16 }; 17 18 promise_test(async t => { 19 const report = new Promise(resolve => { 20 new ReportingObserver((reports, observer) => resolve([reports, observer]), 21 {types: ['permissions-policy-violation']}).observe(); 22 }); 23 try { 24 await test_driver.bless(); 25 const request = new PaymentRequest( 26 [{ supportedMethods: 'https://example.com/pay' }], 27 { total: { label: 'Total', amount: { currency: 'USD', value: 0 }}}, 28 {}); 29 await request.show() 30 check_report_format(await report); 31 } catch (err) { 32 // In case the show call was rejected, the report should be generated 33 // anyway. Wait for it and check the format before failing this test. 34 check_report_format(await report); 35 throw err; 36 } 37 }, "PaymentRequest report only mode"); 38 </script> 39 </body> 40 </html>