xr-report-only.https.html (1375B)
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 const check_report_format = ([reports, observer]) => { 10 const report = reports[0]; 11 assert_equals(report.type, "permissions-policy-violation"); 12 assert_equals(report.url, document.location.href); 13 assert_equals(report.body.featureId, "xr-spatial-tracking"); 14 assert_equals(report.body.sourceFile, document.location.href); 15 assert_equals(typeof report.body.lineNumber, "number"); 16 assert_equals(typeof report.body.columnNumber, "number"); 17 assert_equals(report.body.disposition, "report"); 18 }; 19 20 promise_test(async t => { 21 const report = new Promise(resolve => { 22 new ReportingObserver((reports, observer) => resolve([reports, observer]), 23 {types: ['permissions-policy-violation']}).observe(); 24 }); 25 try { 26 let supported = await navigator.xr.isSessionSupported('immersive-vr'); 27 } catch (err) { 28 // IsSessionSupported should only throw with a permissions policy violation; 29 // however, inline does not trigger the permissions policy, 30 // so immersive-vr must be used. 31 assert_unreached("isSessionSupported should not throw in ReportOnly mode"); 32 } 33 check_report_format(await report); 34 }, "XR report only mode"); 35 </script> 36 </body> 37 </html>