Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 2 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /webxr/events_referenceSpace_reset_immersive.https.html - WPT Dashboard Interop Dashboard
<!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_constants.js"></script>
<script>
let immersiveTestName = "XRSession resetpose from a device properly fires off " +
"the right events for immersive sessions";
let watcherDone = new Event("watcherdone");
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let testFunction = function(session, fakeDeviceController, t) {
let resetPromise = session.requestReferenceSpace('local')
.then((refSpace) => {
let eventWatcher = new EventWatcher(
t, refSpace, ["reset", "watcherdone"]);
refSpace.addEventListener("reset", (event) => {
t.step(() => {
assert_equals(event.referenceSpace, refSpace);
// Also make sure the same objects are returned each time these
// attributes are accessed.
let eventRefSpace = event.referenceSpace;
let transform = event.transform;
assert_equals(eventRefSpace, event.referenceSpace,
"XRReferenceSpaceEvent.referenceSpace returns the same object.");
assert_equals(transform, event.transform,
"XRReferenceSpaceEvent.transform returns the same object.");
});
refSpace.dispatchEvent(watcherDone);
}, false);
return eventWatcher.wait_for(["reset", "watcherdone"]);
});
fakeDeviceController.simulateResetPose();
// The triggered resetPose event should arrive after the next Animation Frame
requestSkipAnimationFrame(session, () => {});
return resetPromise;
};
xr_session_promise_test(
immersiveTestName, testFunction, fakeDeviceInitParams, 'immersive-vr');
</script>