diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/webxr/ar-module | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webxr/ar-module')
6 files changed, 186 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webxr/ar-module/META.yml b/testing/web-platform/tests/webxr/ar-module/META.yml new file mode 100644 index 0000000000..47e5ea9cd4 --- /dev/null +++ b/testing/web-platform/tests/webxr/ar-module/META.yml @@ -0,0 +1 @@ +spec: https://immersive-web.github.io/webxr-ar-module/ diff --git a/testing/web-platform/tests/webxr/ar-module/idlharness.https.window.js b/testing/web-platform/tests/webxr/ar-module/idlharness.https.window.js new file mode 100644 index 0000000000..51cc3c4280 --- /dev/null +++ b/testing/web-platform/tests/webxr/ar-module/idlharness.https.window.js @@ -0,0 +1,17 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://immersive-web.github.io/webxr-ar-module/ + +idl_test( + ['webxr-ar-module'], + ['webxr', 'dom'], + async idl_array => { + idl_array.add_objects({ + XRSession: ['xrSession'], + }); + self.xrSession = await navigator.xr.requestSession('inline'); + } +); diff --git a/testing/web-platform/tests/webxr/ar-module/xrDevice_isSessionSupported_immersive-ar.https.html b/testing/web-platform/tests/webxr/ar-module/xrDevice_isSessionSupported_immersive-ar.https.html new file mode 100644 index 0000000000..2cd36a17f6 --- /dev/null +++ b/testing/web-platform/tests/webxr/ar-module/xrDevice_isSessionSupported_immersive-ar.https.html @@ -0,0 +1,34 @@ +<!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> + xr_promise_test( + "isSessionSupported resolves to true for immersive-ar on a supported device", + (t) => { + return navigator.xr.test.simulateDeviceConnection(IMMERSIVE_AR_DEVICE) + .then( (controller) => { + return navigator.xr.isSessionSupported('immersive-ar').then((supported) => { + t.step(() => { + assert_true(supported); + }); + }); + }); + }); + + xr_promise_test( + "isSessionSupported resolves to false for immersive-ar on an unsupported device", + (t) => { + return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE) + .then( (controller) => { + return navigator.xr.isSessionSupported('immersive-ar').then((supported) => { + t.step(() => { + assert_false(supported); + }); + }); + }); + }); +</script> +</body> diff --git a/testing/web-platform/tests/webxr/ar-module/xrDevice_requestSession_immersive-ar.https.html b/testing/web-platform/tests/webxr/ar-module/xrDevice_requestSession_immersive-ar.https.html new file mode 100644 index 0000000000..9984ee589d --- /dev/null +++ b/testing/web-platform/tests/webxr/ar-module/xrDevice_requestSession_immersive-ar.https.html @@ -0,0 +1,27 @@ +<!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> + xr_session_promise_test( + "Tests requestSession accepts immersive-ar mode", + (session) => { + assert_not_equals(session, null); + }, IMMERSIVE_AR_DEVICE, 'immersive-ar', {}); + + xr_promise_test( + "Tests requestSession rejects immersive-ar mode when unsupported", + (t) => { + return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE) + .then((controller) => new Promise((resolve) => { + navigator.xr.test.simulateUserActivation(() => { + resolve(promise_rejects_dom( + t, "NotSupportedError", + navigator.xr.requestSession('immersive-ar', {}))); + }); + })); + }); +</script> +</body> diff --git a/testing/web-platform/tests/webxr/ar-module/xrSession_environmentBlendMode.https.html b/testing/web-platform/tests/webxr/ar-module/xrSession_environmentBlendMode.https.html new file mode 100644 index 0000000000..beff66586c --- /dev/null +++ b/testing/web-platform/tests/webxr/ar-module/xrSession_environmentBlendMode.https.html @@ -0,0 +1,23 @@ +<!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> + xr_session_promise_test( + "Tests environmentBlendMode for an AR device", + (session) => { + assert_not_equals(session.environmentBlendMode, "opaque"); + assert_in_array(session.environmentBlendMode, ["alpha-blend", "additive"]); + }, IMMERSIVE_AR_DEVICE, 'immersive-ar', {}); + + + xr_session_promise_test( + "Tests environmentBlendMode for a VR device", + (session) => { + assert_not_equals(session.environmentBlendMode, "alpha-blend"); + assert_in_array(session.environmentBlendMode, ["opaque", "additive"]); + }, TRACKED_IMMERSIVE_DEVICE, 'immersive-vr', {}); +</script> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/webxr/ar-module/xrSession_interactionMode.https.html b/testing/web-platform/tests/webxr/ar-module/xrSession_interactionMode.https.html new file mode 100644 index 0000000000..89cdc80132 --- /dev/null +++ b/testing/web-platform/tests/webxr/ar-module/xrSession_interactionMode.https.html @@ -0,0 +1,84 @@ +<!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> + <canvas></canvas> + <script> + const VR_HMD_DEVICE = { + supportsImmersive: true, + supportedModes: [ "immersive-vr"], + views: VALID_VIEWS, + viewerOrigin: IDENTITY_TRANSFORM, + supportedFeatures: ALL_FEATURES, + environmentBlendMode: "opaque", + interactionMode: "world-space" + }; + xr_session_promise_test( + "Tests interactionMode for an VR_HMD_DEVICE", + (session) => { + assert_equals(session.interactionMode, "world-space"); + }, VR_HMD_DEVICE, 'immersive-vr', {}); + + const VR_SCREEN_DEVICE = { + supportsImmersive: true, + supportedModes: [ "immersive-vr"], + views: VALID_VIEWS, + viewerOrigin: IDENTITY_TRANSFORM, + supportedFeatures: ALL_FEATURES, + environmentBlendMode: "opaque", + interactionMode: "screen-space" + }; + xr_session_promise_test( + "Tests interactionMode for an VR_SCREEN_DEVICE", + (session) => { + assert_equals(session.interactionMode, "screen-space"); + }, VR_SCREEN_DEVICE, 'immersive-vr', {}); + + const AR_HMD_DEVICE = { + supportsImmersive: true, + supportedModes: [ "immersive-ar"], + views: VALID_VIEWS, + viewerOrigin: IDENTITY_TRANSFORM, + supportedFeatures: ALL_FEATURES, + environmentBlendMode: "additive", + interactionMode: "world-space" + }; + xr_session_promise_test( + "Tests interactionMode for an AR_HMD_DEVICE", + (session) => { + assert_equals(session.interactionMode, "world-space"); + }, AR_HMD_DEVICE, 'immersive-ar', {}); + + const AR_SCREEN_DEVICE = { + supportsImmersive: true, + supportedModes: [ "immersive-ar"], + views: VALID_VIEWS, + viewerOrigin: IDENTITY_TRANSFORM, + supportedFeatures: ALL_FEATURES, + environmentBlendMode: "opaque", + interactionMode: "screen-space" + }; + xr_session_promise_test( + "Tests interactionMode for an AR_SCREEN_DEVICE", + (session) => { + assert_equals(session.interactionMode, "screen-space"); + }, AR_SCREEN_DEVICE, 'immersive-ar', {}); + + const INLINE_SCREEN_DEVICE = { + supportsImmersive: true, + supportedModes: [ "inline"], + views: VALID_VIEWS, + viewerOrigin: IDENTITY_TRANSFORM, + supportedFeatures: ALL_FEATURES, + environmentBlendMode: "opaque", + interactionMode: "screen-space" + }; + xr_session_promise_test( + "Tests interactionMode for a INLINE_SCREEN_DEVICE", + (session) => { + assert_equals(session.interactionMode, "screen-space"); + }, INLINE_SCREEN_DEVICE, 'inline', {}); +</script> +</body> |