Bug 1717475 [wpt PR 29445] - WebXR: align the behavior of trackedAnchors & detectedPlanes, a=testonly

Automatic update from web-platform-tests
WebXR: align the behavior of trackedAnchors & detectedPlanes

OT feedback from plane detection API yielded a good point about
inconsistency between trackedAnchors and detectedPlanes behavior on an
XRFrame.

Changes:
- detectedPlanes should now behave the same way as trackedAnchors - they
will be empty even if the feature was not enabled on a session, feature
detection is not intended via those attributes
- clarified that anchorsData can be null coming from mojo & started
returning null when the feature is not enabled (same as OpenXR impl)
- null data coming from mojo for planes & anchors is treated as if the
data was empty (clearing the plane_ids_to_planes_ / anchor_ids_to_anchors_
basically short-circuits the logic that would've cleared them if
received data was empty)
- add WPT for anchors API to ensure that the frame's `trackedAnchors`
are empty irrespective of the feature status
- add internal WPT for anchors API to ensure that frame's
`trackedAnchors` are empty even if data coming from the device was null

Plane detection spec change still pending.

API feedback thread:
https://github.com/immersive-web/real-world-geometry/issues/30

Change-Id: Iab52176dba08df3cb64c7e581a5f6790cd4b19bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2973587
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Piotr Bialecki <bialpio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#894892}

--

wpt-commits: e6036168a8a3142188cdbe31aa4ca3a9da09ffb0
wpt-pr: 29445
This commit is contained in:
Piotr Bialecki 2021-06-25 22:15:12 +00:00 committed by moz-wptsync-bot
parent 80803e6b2e
commit 089c716746

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/webxr_util.js"></script>
<script src="../resources/webxr_test_asserts.js"></script>
<script src="../resources/webxr_test_constants.js"></script>
<script src="../resources/webxr_test_constants_fake_world.js"></script>
<script>
// 1m above world origin.
const VIEWER_ORIGIN_TRANSFORM = {
position: [0, 1, 0],
orientation: [0, 0, 0, 1],
};
const fakeDeviceInitParams = {
supportedModes: ["immersive-ar"],
views: VALID_VIEWS,
supportedFeatures: ALL_FEATURES,
viewerOrigin: VIEWER_ORIGIN_TRANSFORM,
};
// Attempts to access XRFrame.trackedAnchors and expects to get empty set
// since no anchors are being created.
const testFunction = function(session, fakeDeviceController, t) {
const debug = xr_debug.bind(this, 'testGetAnchors');
let done = false;
session.requestReferenceSpace('local').then((localRefSpace) => {
const onFrame = function(time, frame) {
const trackedAnchors = frame.trackedAnchors;
t.step(() => {
assert_equals(trackedAnchors.size, 0);
});
done = true;
};
session.requestAnimationFrame(onFrame);
}); // session.requestReferenceSpace(...)
return t.step_wait(() => done);
}; // testFunction
xr_session_promise_test("XRFrame's trackedAnchors is empty when the feature was not requested",
testFunction,
fakeDeviceInitParams,
'immersive-ar', { });
xr_session_promise_test("XRFrame's trackedAnchors is empty when the feature was requested",
testFunction,
fakeDeviceInitParams,
'immersive-ar', { 'requiredFeatures': ['anchors'] });
</script>