1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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>
|