summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html')
-rw-r--r--testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html82
1 files changed, 82 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html b/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html
new file mode 100644
index 0000000000..a20223fca3
--- /dev/null
+++ b/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<body>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src="resources/webxr_util.js"></script>
+ <script src="resources/webxr_test_constants.js"></script>
+ <script>
+
+ let makeSpaceTest = (space_type) => {
+ return (session, fakeDeviceController, t) => {
+ return session.requestReferenceSpace(space_type).then( (referenceSpace) => {
+ t.step(() => {
+ assert_true(referenceSpace instanceof XRReferenceSpace,
+ "reference space is not correct type.");
+ });
+ });
+ };
+ };
+
+ let makeInvalidSpaceTest = (space_type) => {
+ return (session, fakeDeviceController, t) => {
+ return promise_rejects_dom(t, "NotSupportedError",
+ session.requestReferenceSpace(space_type),
+ "requestReferenceSpace('" + space_type + "')");
+ };
+ };
+
+ let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
+
+ // Test that reference spaces matching default features work.
+ xr_session_promise_test(
+ "Non-immersive session supports viewer space by default",
+ makeSpaceTest('viewer'), fakeDeviceInitParams, 'inline', {});
+ xr_session_promise_test(
+ "Immersive session supports viewer space by default",
+ makeSpaceTest('viewer'), fakeDeviceInitParams, 'immersive-vr', {});
+ xr_session_promise_test(
+ "Immersive session supports local space by default",
+ makeSpaceTest('local'), fakeDeviceInitParams, 'immersive-vr', {});
+
+ // Test that session-appropriate non-default reference spaces work when requested
+ xr_session_promise_test(
+ "Non-immersive session supports local space when required",
+ makeSpaceTest('local'), fakeDeviceInitParams, 'inline',
+ {requiredFeatures: ['local']});
+ xr_session_promise_test(
+ "Non-immersive session supports local space when optional",
+ makeSpaceTest('local'), fakeDeviceInitParams, 'inline',
+ {optionalFeatures: ['local']});
+ xr_session_promise_test(
+ "Non-immersive session supports local-floor space when required",
+ makeSpaceTest('local-floor'), fakeDeviceInitParams, 'inline',
+ {requiredFeatures: ['local-floor']});
+ xr_session_promise_test(
+ "Immersive session supports local-floor space when required",
+ makeSpaceTest('local-floor'), fakeDeviceInitParams, 'immersive-vr',
+ {requiredFeatures: ['local-floor']});
+ xr_session_promise_test(
+ "Immersive session supports local-floor space when optional",
+ makeSpaceTest('local-floor'), fakeDeviceInitParams, 'immersive-vr',
+ {optionalFeatures: ['local-floor']});
+
+ // Test that inline space can't request 'bounded-floor' or 'unbounded'
+ xr_session_promise_test(
+ "Non-immersive session rejects bounded-floor space even when requested",
+ makeInvalidSpaceTest('bounded-floor'), fakeDeviceInitParams, 'inline',
+ {optionalFeatures: ['bounded-floor']});
+ xr_session_promise_test(
+ "Non-immersive session rejects unbounded space even when requested",
+ makeInvalidSpaceTest('unbounded'), fakeDeviceInitParams, 'inline',
+ {optionalFeatures: ['unbounded']});
+
+ // Test that reference spaces that aren't default features are rejected
+ // when not requested as a feature.
+ xr_session_promise_test(
+ "Non-immersive session rejects local space if not requested",
+ makeInvalidSpaceTest('local'), fakeDeviceInitParams, 'inline', {});
+ xr_session_promise_test(
+ "Immersive session rejects local-floor space if not requested",
+ makeInvalidSpaceTest('local-floor'), fakeDeviceInitParams, 'immersive-vr', {});
+ </script>
+</body>