Commit 7463ed71 authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

WebXR: add WPT for AR module.

This is adding tests for:
 - isSessionSupported (immersive-ar on AR & VR devices).
 - requestSession (immersive-ar on AR & VR devices).
 - environmentBlendMode allowed values in AR & VR.

Bug: 949296
Change-Id: Idee7a1d03a0f9bc961e65a225e8fcc851c2eaa14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2001196Reviewed-by: default avatarPiotr Bialecki <bialpio@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731752}
parent e222e5ec
<!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>
<!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>
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(
t, "NotSupportedError",
navigator.xr.requestSession('immersive-ar', {})));
});
}));
});
</script>
</body>
<!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>
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>
......@@ -136,6 +136,14 @@ const TRACKED_IMMERSIVE_DEVICE = {
supportedFeatures: ALL_FEATURES
};
const IMMERSIVE_AR_DEVICE = {
supportsImmersive: true,
supportedModes: [ "inline", "immersive-ar"],
views: VALID_VIEWS,
viewerOrigin: IDENTITY_TRANSFORM,
supportedFeatures: ALL_FEATURES
};
const VALID_NON_IMMERSIVE_DEVICE = {
supportsImmersive: false,
supportedModes: ["inline"],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment