fullscreen-reporting.html (1622B)
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 <div id='fs'></div> 9 <script> 10 var observer1; 11 var observer2; 12 13 var check_report_format = (reports, observer) => { 14 // Test that observer2 is notified, even if it is disconnected. 15 observer1.disconnect(); 16 observer2.disconnect(); 17 let report = reports[0]; 18 assert_equals(report.type, "permissions-policy-violation"); 19 assert_equals(report.url, document.location.href); 20 assert_equals(report.body.featureId, "fullscreen"); 21 assert_equals(report.body.sourceFile, document.location.href); 22 assert_equals(typeof report.body.lineNumber, "number"); 23 assert_equals(typeof report.body.columnNumber, "number"); 24 assert_equals(report.body.disposition, "enforce"); 25 }; 26 27 var check_second_observer = (reports, observer) => { 28 let report = reports[0]; 29 assert_equals(report.type, "permissions-policy-violation"); 30 assert_equals(report.body.featureId, "fullscreen"); 31 }; 32 33 async_test(t => { 34 observer1 = new ReportingObserver(t.step_func(check_report_format), 35 {types: ['permissions-policy-violation']}); 36 observer1.observe(); 37 observer2 = new ReportingObserver(t.step_func_done(check_second_observer), 38 {types: ['permissions-policy-violation']}); 39 observer2.observe(); 40 document.getElementById('fs').requestFullscreen().then(t.unreached_func( 41 "Fullscreen should not be allowed in this document.")).catch(()=>{}); 42 }, "Fullscreen Report Format"); 43 </script> 44 </body> 45 </html>