midi-report-only.https.html (1074B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src='/resources/testharness.js'></script> 5 <script src='/resources/testharnessreport.js'></script> 6 </head> 7 <body> 8 <script> 9 var check_report_format = ([reports, observer]) => { 10 let report = reports[0]; 11 assert_equals(report.type, "permissions-policy-violation"); 12 assert_equals(report.body.featureId, "midi"); 13 assert_equals(report.body.disposition, "report"); 14 }; 15 16 promise_test(async t => { 17 const report = new Promise(resolve => { 18 new ReportingObserver((reports, observer) => resolve([reports, observer]), 19 {types: ['permissions-policy-violation']}).observe(); 20 }); 21 try { 22 await navigator.requestMIDIAccess(); 23 check_report_format(await report); 24 } catch (err) { 25 // In case the requestMIDIAccess call was rejected due to user permissions, 26 // the report should be generated anyway. Wait for it and check the format 27 // before failing this test. 28 check_report_format(await report); 29 throw err; 30 } 31 }, "MIDI report only mode"); 32 </script> 33 </body> 34 </html>