diff --git a/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html b/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html
index d999c977dbe361..872db22849545c 100644
--- a/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html
+++ b/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html
@@ -10,7 +10,7 @@
const report = reports[0];
assert_equals(report.type, "feature-policy-violation");
assert_equals(report.url, document.location.href);
- assert_equals(report.body.featureId, "xr");
+ assert_equals(report.body.featureId, "xr-spatial-tracking");
assert_equals(report.body.sourceFile, document.location.href);
assert_equals(typeof report.body.lineNumber, "number");
assert_equals(typeof report.body.columnNumber, "number");
@@ -23,11 +23,12 @@
{types: ['feature-policy-violation']}).observe();
});
try {
- await navigator.xr.supportsSession('inline');
+ let supported = await navigator.xr.isSessionSupported('immersive-vr');
} catch (err) {
- // If no XR devices are available, supportsSession() will reject with a
- // NotSupportedError, but the report should be generated anyway.
- assert_equals(err.name, 'NotSupportedError');
+ // IsSessionSupported should only throw with a feature policy violation;
+ // however, inline does not trigger the feature policy,
+ // so immersive-vr must be used.
+ assert_unreached("isSessionSupported should not throw in ReportOnly mode");
}
check_report_format(await report);
}, "XR report only mode");
diff --git a/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html.headers
index 47b7c824b355f1..45df4936e27521 100644
--- a/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html.headers
+++ b/testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html.headers
@@ -1 +1 @@
-Feature-Policy-Report-Only: xr 'none'
+Feature-Policy-Report-Only: xr-spatial-tracking 'none'
diff --git a/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html
index 68a3e4e737b859..edc75e824003c5 100644
--- a/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html
+++ b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html
@@ -10,7 +10,7 @@
let report = reports[0];
assert_equals(report.type, "feature-policy-violation");
assert_equals(report.url, document.location.href);
- assert_equals(report.body.featureId, "xr");
+ assert_equals(report.body.featureId, "xr-spatial-tracking");
assert_equals(report.body.sourceFile, document.location.href);
assert_equals(typeof report.body.lineNumber, "number");
assert_equals(typeof report.body.columnNumber, "number");
@@ -22,8 +22,9 @@
new ReportingObserver((reports, observer) => resolve([reports, observer]),
{types: ['feature-policy-violation']}).observe();
});
- await promise_rejects(t, 'SecurityError', navigator.xr.supportsSession('inline'),
- "XR device access should not be allowed in this document.");
+ await promise_rejects(t, 'SecurityError',
+ navigator.xr.isSessionSupported('immersive-vr'),
+ "XR spatial tracking should not be allowed in this document.");
const [reports, observer] = await report;
check_report_format(reports, observer);
}, "XR Report Format");
diff --git a/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers
index ea8722131ce0d9..2c758962332e72 100644
--- a/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers
+++ b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers
@@ -1 +1 @@
-Feature-Policy: xr 'none'
+Feature-Policy: xr-spatial-tracking 'none'
diff --git a/testing/web-platform/tests/webxr/resources/webxr_util.js b/testing/web-platform/tests/webxr/resources/webxr_util.js
index 935f49a1fc911f..85821d4d3d5d7f 100644
--- a/testing/web-platform/tests/webxr/resources/webxr_util.js
+++ b/testing/web-platform/tests/webxr/resources/webxr_util.js
@@ -16,6 +16,15 @@ function xr_promise_test(name, func, properties) {
await loadChromiumResources;
}
+ // Ensure that any devices are disconnected when done. If this were done in
+ // a .then() for the success case, a test that expected failure would
+ // already be marked done at the time that runs and the shutdown would
+ // interfere with the next test.
+ t.add_cleanup(async () => {
+ // Ensure system state is cleaned up.
+ await navigator.xr.test.disconnectAllDevices();
+ });
+
return func(t);
}, name, properties);
}
@@ -44,19 +53,16 @@ function xr_session_promise_test(
xr_promise_test(
name,
(t) => {
- // Ensure that any pending sessions are ended and devices are
- // disconnected when done. This needs to use a cleanup function to
- // ensure proper sequencing. If this were done in a .then() for the
- // success case, a test that expected failure would already be marked
- // done at the time that runs, and the shutdown would interfere with
- // the next test which may have started already.
+ // Ensure that any pending sessions are ended when done. This needs to
+ // use a cleanup function to ensure proper sequencing. If this were
+ // done in a .then() for the success case, a test that expected
+ // failure would already be marked done at the time that runs, and the
+ // shutdown would interfere with the next test which may have started.
t.add_cleanup(async () => {
- // If a session was created, end it.
- if (testSession) {
- await testSession.end().catch(() => {});
- }
- // Cleanup system state.
- await navigator.xr.test.disconnectAllDevices();
+ // If a session was created, end it.
+ if (testSession) {
+ await testSession.end().catch(() => {});
+ }
});
return navigator.xr.test.simulateDeviceConnection(fakeDeviceInit)
diff --git a/testing/web-platform/tests/webxr/webxr-supported-by-feature-policy.html b/testing/web-platform/tests/webxr/webxr-supported-by-feature-policy.html
index d1f8252977f7aa..2843849a34a818 100644
--- a/testing/web-platform/tests/webxr/webxr-supported-by-feature-policy.html
+++ b/testing/web-platform/tests/webxr/webxr-supported-by-feature-policy.html
@@ -5,6 +5,6 @@
diff --git a/testing/web-platform/tests/webxr/webxr_feature_policy.https.html b/testing/web-platform/tests/webxr/webxr_feature_policy.https.html
new file mode 100644
index 00000000000000..ea1bf82adb35d5
--- /dev/null
+++ b/testing/web-platform/tests/webxr/webxr_feature_policy.https.html
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
diff --git a/testing/web-platform/tests/webxr/webxr_feature_policy.https.html.headers b/testing/web-platform/tests/webxr/webxr_feature_policy.https.html.headers
new file mode 100644
index 00000000000000..2c758962332e72
--- /dev/null
+++ b/testing/web-platform/tests/webxr/webxr_feature_policy.https.html.headers
@@ -0,0 +1 @@
+Feature-Policy: xr-spatial-tracking 'none'