Skip to content

Commit

Permalink
Bug 1717475 [wpt PR 29445] - WebXR: align the behavior of trackedAnch…
Browse files Browse the repository at this point in the history
…ors & 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:
immersive-web/real-world-geometry#30

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

--

wpt-commits: e6036168a8a3142188cdbe31aa4ca3a9da09ffb0
wpt-pr: 29445
  • Loading branch information
bialpio authored and moz-wptsync-bot committed Jun 26, 2021
1 parent 68bc7a9 commit b2a920e
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit b2a920e

Please sign in to comment.