зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1564733 [wpt PR 17630] - Update WebXR TestAPI and tests to match new spec, a=testonly
Automatic update from web-platform-tests Update WebXR TestAPI and tests to match new spec (#17630) Now that WebXR is more mature, the test API is being revisited with input from other UAs. This change updates existing methods and tests to match the new API, which largely involves: * FakeXRDeviceInit now requires views * FakeXRDeviceInit *CAN* support an initial viewerOrigin * setXRPresentationFrameData is now setViews and set/clearViewerOrigin * XRTest is now navigator.xr.test [1] As part of this, webxr_test_constants were cleaned up and expanded to help minimize boilerplate code in the tests. Where possible tests that were previously calling setXRPresentationFrameData to ensure that the fake device was "tracking" were updated to instead use a constant that sets these values. Future work (after the API update is complete) will identify if there are any cases where an initial requestAnimationFrame could be removed. Most changes (especially to vr/ tests) should be fairly mechanical, but now that the eye offsets expected/set by the test are actually being plumbed through, both xr/xrReferenceSpace_originOffset tests had to have their expected matrices updated. Two tests had to be updated due to the discovery of 981003. Other changes to update to the Test API after this change should be mostly additive and should actually already exist in the internal tests. [1] XRTest currently still exists as a workaround until 944987 is merged Also due to the fact that accessing xr blocks VR, the WebVR tests had to be updated to set a special flag to tell the test API to not set the object on XR. It's unlikely that this behavior will be able to be removed after 944987, but to allow XRTest to be removed these tests have had it migrated to navigator.vr.test Bug:979312 Change-Id: I19ccffd921728ec3799252693d945b7b3f99d757 -- wpt-commits: 3f8ee365a7cacc091dc1dd1d0b5f21a89241c894 wpt-pr: 17630
This commit is contained in:
Родитель
31a18bfb33
Коммит
d8823a497f
|
@ -12,8 +12,9 @@ class ChromeXRTest {
|
||||||
return Promise.resolve(this.mockVRService_.addRuntime(init_params));
|
return Promise.resolve(this.mockVRService_.addRuntime(init_params));
|
||||||
}
|
}
|
||||||
|
|
||||||
simulateDeviceDisconnection(device) {
|
disconnectAllDevices() {
|
||||||
this.mockVRService_.removeRuntime(device);
|
this.mockVRService_.removeAllRuntimes(device);
|
||||||
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
simulateUserActivation(callback) {
|
simulateUserActivation(callback) {
|
||||||
|
@ -60,11 +61,11 @@ class MockVRService {
|
||||||
return runtime;
|
return runtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeRuntime(runtime) {
|
removeAllRuntimes() {
|
||||||
// We have no way of distinguishing between devices, so just clear the
|
if (this.client_) {
|
||||||
// entire list for now.
|
this.client_.onDeviceChanged();
|
||||||
// TODO(http://crbug.com/873409) We also have no way right now to disconnect
|
}
|
||||||
// devices.
|
|
||||||
this.runtimes_ = [];
|
this.runtimes_ = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +152,8 @@ class MockRuntime {
|
||||||
|
|
||||||
this.framesOfReference = {};
|
this.framesOfReference = {};
|
||||||
|
|
||||||
|
// Initialize DisplayInfo first to set the defaults, then override with
|
||||||
|
// anything from the deviceInit
|
||||||
if (fakeDeviceInit.supportsImmersive) {
|
if (fakeDeviceInit.supportsImmersive) {
|
||||||
this.displayInfo_ = this.getImmersiveDisplayInfo();
|
this.displayInfo_ = this.getImmersiveDisplayInfo();
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,16 +163,16 @@ class MockRuntime {
|
||||||
if (fakeDeviceInit.supportsEnvironmentIntegration) {
|
if (fakeDeviceInit.supportsEnvironmentIntegration) {
|
||||||
this.displayInfo_.capabilities.canProvideEnvironmentIntegration = true;
|
this.displayInfo_.capabilities.canProvideEnvironmentIntegration = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Test methods.
|
if (fakeDeviceInit.viewerOrigin != null) {
|
||||||
setXRPresentationFrameData(poseMatrix, views) {
|
this.setViewerOrigin(fakeDeviceInit.viewerOrigin);
|
||||||
if (poseMatrix == null) {
|
|
||||||
this.pose_ = null;
|
|
||||||
} else {
|
|
||||||
this.setPoseFromMatrix(poseMatrix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setViews(fakeDeviceInit.views);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test API methods.
|
||||||
|
setViews(views) {
|
||||||
if (views) {
|
if (views) {
|
||||||
let changed = false;
|
let changed = false;
|
||||||
for (let i = 0; i < views.length; i++) {
|
for (let i = 0; i < views.length; i++) {
|
||||||
|
@ -182,17 +185,18 @@ class MockRuntime {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed && this.sessionClient_.ptr.isBound()) {
|
||||||
this.sessionClient_.onChanged(this.displayInfo_);
|
this.sessionClient_.onChanged(this.displayInfo_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setViewerOrigin(origin, emulatedPosition = false) {
|
||||||
setPoseFromMatrix(poseMatrix) {
|
let p = origin.position;
|
||||||
|
let q = origin.orientation;
|
||||||
this.pose_ = {
|
this.pose_ = {
|
||||||
orientation: null,
|
orientation: { x: q[0], y: q[1], z: q[2], w: q[3] },
|
||||||
position: null,
|
position: { x: p[0], y: p[1], z: p[2] },
|
||||||
angularVelocity: null,
|
angularVelocity: null,
|
||||||
linearVelocity: null,
|
linearVelocity: null,
|
||||||
angularAcceleration: null,
|
angularAcceleration: null,
|
||||||
|
@ -200,37 +204,13 @@ class MockRuntime {
|
||||||
inputState: null,
|
inputState: null,
|
||||||
poseIndex: 0
|
poseIndex: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
let pose = this.poseFromMatrix(poseMatrix);
|
|
||||||
for (let field in pose) {
|
|
||||||
if (this.pose_.hasOwnProperty(field)) {
|
|
||||||
this.pose_[field] = pose[field];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
poseFromMatrix(m) {
|
clearViewerOrigin() {
|
||||||
let m00 = m[0];
|
this.pose_ = null;
|
||||||
let m11 = m[5];
|
|
||||||
let m22 = m[10];
|
|
||||||
|
|
||||||
// The max( 0, ... ) is just a safeguard against rounding error.
|
|
||||||
let orientation = new gfx.mojom.Quaternion();
|
|
||||||
orientation.w = Math.sqrt(Math.max(0, 1 + m00 + m11 + m22)) / 2;
|
|
||||||
orientation.x = Math.sqrt(Math.max(0, 1 + m00 - m11 - m22)) / 2;
|
|
||||||
orientation.y = Math.sqrt(Math.max(0, 1 - m00 + m11 - m22)) / 2;
|
|
||||||
orientation.z = Math.sqrt(Math.max(0, 1 - m00 - m11 + m22)) / 2;
|
|
||||||
|
|
||||||
let position = new gfx.mojom.Point3F();
|
|
||||||
position.x = m[12];
|
|
||||||
position.y = m[13];
|
|
||||||
position.z = m[14];
|
|
||||||
|
|
||||||
return {
|
|
||||||
orientation, position
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper methods
|
||||||
getNonImmersiveDisplayInfo() {
|
getNonImmersiveDisplayInfo() {
|
||||||
let displayInfo = this.getImmersiveDisplayInfo();
|
let displayInfo = this.getImmersiveDisplayInfo();
|
||||||
|
|
||||||
|
@ -296,6 +276,8 @@ class MockRuntime {
|
||||||
let upTan = (1 + m[9]) / m[5];
|
let upTan = (1 + m[9]) / m[5];
|
||||||
let downTan = (1 - m[9]) / m[5];
|
let downTan = (1 - m[9]) / m[5];
|
||||||
|
|
||||||
|
let offset = fakeXRViewInit.viewOffset.position;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fieldOfView: {
|
fieldOfView: {
|
||||||
upDegrees: toDegrees(upTan),
|
upDegrees: toDegrees(upTan),
|
||||||
|
@ -303,9 +285,9 @@ class MockRuntime {
|
||||||
leftDegrees: toDegrees(leftTan),
|
leftDegrees: toDegrees(leftTan),
|
||||||
rightDegrees: toDegrees(rightTan)
|
rightDegrees: toDegrees(rightTan)
|
||||||
},
|
},
|
||||||
offset: { x: 0, y: 0, z: 0 },
|
offset: { x: offset[0], y: offset[1], z: offset[2] },
|
||||||
renderWidth: 20,
|
renderWidth: fakeXRViewInit.resolution.width,
|
||||||
renderHeight: 20
|
renderHeight: fakeXRViewInit.resolution.height
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,6 +387,7 @@ class MockRuntime {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mojo helper classes
|
||||||
class MockXRPresentationProvider {
|
class MockXRPresentationProvider {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.binding_ = new mojo.Binding(device.mojom.XRPresentationProvider, this);
|
this.binding_ = new mojo.Binding(device.mojom.XRPresentationProvider, this);
|
||||||
|
@ -448,4 +431,21 @@ class MockXRPresentationProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is a temporary workaround for the fact that spinning up webxr before
|
||||||
|
// the mojo interceptors are created will cause the interceptors to not get
|
||||||
|
// registered, so we have to create this before we query xr;
|
||||||
let XRTest = new ChromeXRTest();
|
let XRTest = new ChromeXRTest();
|
||||||
|
|
||||||
|
// This test API is also used to run Chrome's internal legacy VR tests; however,
|
||||||
|
// those fail if navigator.xr has been used. Those tests will set a bool telling
|
||||||
|
// us not to try to check navigator.xr
|
||||||
|
if ((typeof legacy_vr_test === 'undefined') || !legacy_vr_test) {
|
||||||
|
// Some tests may run in the http context where navigator.xr isn't exposed
|
||||||
|
// This should just be to test that it isn't exposed, but don't try to set up
|
||||||
|
// the test framework in this case.
|
||||||
|
if (navigator.xr) {
|
||||||
|
navigator.xr.test = XRTest;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navigator.vr = { test: XRTest };
|
||||||
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
// assert_equals can fail when comparing floats due to precision errors, so
|
|
||||||
// use assert_approx_equals with this constant instead
|
|
||||||
const FLOAT_EPSILON = 0.001;
|
|
||||||
|
|
||||||
// Identity matrix
|
|
||||||
const IDENTITY_MATRIX = [1, 0, 0, 0,
|
|
||||||
0, 1, 0, 0,
|
|
||||||
0, 0, 1, 0,
|
|
||||||
0, 0, 0, 1];
|
|
||||||
|
|
||||||
// A valid pose matrix for when we don't care about specific values
|
|
||||||
const VALID_POSE_MATRIX = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1];
|
|
||||||
|
|
||||||
const VALID_PROJECTION_MATRIX =
|
|
||||||
[1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
|
|
||||||
|
|
||||||
const VALID_VIEW_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
|
||||||
|
|
||||||
// A valid VRPose for when we want the HMD to report being at the origin
|
|
||||||
const ORIGIN_POSE = IDENTITY_MATRIX;
|
|
||||||
|
|
||||||
// A valid input grip matrix for when we don't care about specific values
|
|
||||||
const VALID_GRIP = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
|
||||||
|
|
||||||
// A valid input pointer offset for when we don't care about specific values
|
|
||||||
const VALID_POINTER_OFFSET = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1];
|
|
||||||
|
|
||||||
const VALID_GRIP_WITH_POINTER_OFFSET =
|
|
||||||
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 3, 1];
|
|
||||||
|
|
||||||
const VALID_STAGE_TRANSFORM =
|
|
||||||
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1.0, 1.65, -1.0, 1];
|
|
|
@ -8,17 +8,26 @@ const IDENTITY_MATRIX = [1, 0, 0, 0,
|
||||||
0, 0, 1, 0,
|
0, 0, 1, 0,
|
||||||
0, 0, 0, 1];
|
0, 0, 0, 1];
|
||||||
|
|
||||||
// A valid pose matrix for when we don't care about specific values
|
const IDENTITY_TRANSFORM = {
|
||||||
const VALID_POSE_MATRIX = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1];
|
position: [0, 0, 0],
|
||||||
|
orientation: [0, 0, 0, 1],
|
||||||
|
};
|
||||||
|
|
||||||
|
// A valid pose matrix/transform for when we don't care about specific values
|
||||||
|
// Note that these two should be identical, just different representations
|
||||||
|
const VALID_POSE_MATRIX = [0, 1, 0, 0,
|
||||||
|
0, 0, 1, 0,
|
||||||
|
1, 0, 0, 0,
|
||||||
|
1, 1, 1, 1];
|
||||||
|
|
||||||
|
const VALID_POSE_TRANSFORM = {
|
||||||
|
position: [1, 1, 1],
|
||||||
|
orientation: [0.5, 0.5, 0.5, 0.5]
|
||||||
|
};
|
||||||
|
|
||||||
const VALID_PROJECTION_MATRIX =
|
const VALID_PROJECTION_MATRIX =
|
||||||
[1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
|
[1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
|
||||||
|
|
||||||
const VALID_VIEW_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
|
||||||
|
|
||||||
// A valid VRPose for when we want the HMD to report being at the origin
|
|
||||||
const ORIGIN_POSE = IDENTITY_MATRIX;
|
|
||||||
|
|
||||||
// A valid input grip matrix for when we don't care about specific values
|
// A valid input grip matrix for when we don't care about specific values
|
||||||
const VALID_GRIP = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
const VALID_GRIP = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
||||||
|
|
||||||
|
@ -39,3 +48,51 @@ const VALID_BOUNDS = [
|
||||||
{ x: -3.5, y: 0, z: 0.0 },
|
{ x: -3.5, y: 0, z: 0.0 },
|
||||||
{ x: -3.0, y: 0, z: -2.0 }
|
{ x: -3.0, y: 0, z: -2.0 }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const VALID_RESOLUTION = {
|
||||||
|
width: 20,
|
||||||
|
height: 20
|
||||||
|
};
|
||||||
|
|
||||||
|
const LEFT_OFFSET = {
|
||||||
|
position: [-0.1, 0, 0],
|
||||||
|
orientation: [0, 0, 0, 1]
|
||||||
|
};
|
||||||
|
|
||||||
|
const RIGHT_OFFSET = {
|
||||||
|
position: [0.1, 0, 0],
|
||||||
|
orientation: [0, 0, 0, 1]
|
||||||
|
};
|
||||||
|
|
||||||
|
const VALID_VIEWS = [{
|
||||||
|
eye:"left",
|
||||||
|
projectionMatrix: VALID_PROJECTION_MATRIX,
|
||||||
|
viewOffset: LEFT_OFFSET,
|
||||||
|
resolution: VALID_RESOLUTION
|
||||||
|
}, {
|
||||||
|
eye:"right",
|
||||||
|
projectionMatrix: VALID_PROJECTION_MATRIX,
|
||||||
|
viewOffset: RIGHT_OFFSET,
|
||||||
|
resolution: VALID_RESOLUTION
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const NON_IMMERSIVE_VIEWS = [{
|
||||||
|
eye: "none",
|
||||||
|
projectionMatrix: VALID_PROJECTION_MATRIX,
|
||||||
|
viewOffset: IDENTITY_TRANSFORM,
|
||||||
|
resolution: VALID_RESOLUTION,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const TRACKED_IMMERSIVE_DEVICE = {
|
||||||
|
supportsImmersive: true,
|
||||||
|
views: VALID_VIEWS,
|
||||||
|
viewerOrigin: IDENTITY_TRANSFORM
|
||||||
|
};
|
||||||
|
|
||||||
|
const VALID_NON_IMMERSIVE_DEVICE = {
|
||||||
|
supportsImmersive: false,
|
||||||
|
views: NON_IMMERSIVE_VIEWS,
|
||||||
|
viewerOrigin: IDENTITY_TRANSFORM
|
||||||
|
};
|
||||||
|
|
|
@ -39,15 +39,15 @@ function xr_session_promise_test(
|
||||||
|
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
name,
|
name,
|
||||||
(t) =>
|
(t) =>{
|
||||||
XRTest.simulateDeviceConnection(fakeDeviceInit)
|
return navigator.xr.test.simulateDeviceConnection(fakeDeviceInit)
|
||||||
.then((controller) => {
|
.then((controller) => {
|
||||||
testDeviceController = controller;
|
testDeviceController = controller;
|
||||||
return gl.makeXRCompatible();
|
return gl.makeXRCompatible();
|
||||||
})
|
})
|
||||||
.then(() => new Promise((resolve, reject) => {
|
.then(() => new Promise((resolve, reject) => {
|
||||||
// Perform the session request in a user gesture.
|
// Perform the session request in a user gesture.
|
||||||
XRTest.simulateUserActivation(() => {
|
navigator.xr.test.simulateUserActivation(() => {
|
||||||
navigator.xr.requestSession(sessionMode)
|
navigator.xr.requestSession(sessionMode)
|
||||||
.then((session) => {
|
.then((session) => {
|
||||||
testSession = session;
|
testSession = session;
|
||||||
|
@ -75,8 +75,9 @@ function xr_session_promise_test(
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Cleanup system state.
|
// Cleanup system state.
|
||||||
testSession.end().catch(() => {});
|
testSession.end().catch(() => {});
|
||||||
XRTest.simulateDeviceDisconnection();
|
return navigator.xr.test.disconnectAllDevices();
|
||||||
}),
|
})
|
||||||
|
},
|
||||||
properties);
|
properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,4 +139,4 @@ let loadChromiumResources = Promise.resolve().then(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
return chain;
|
return chain;
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas id="webgl-canvas"></canvas>
|
<canvas id="webgl-canvas"></canvas>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test("An XR-compatible webglCanvasContext can be created",
|
xr_promise_test("An XR-compatible webglCanvasContext can be created",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
|
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => {
|
.then( (controller) => {
|
||||||
webglCanvas = document.getElementById('webgl-canvas');
|
webglCanvas = document.getElementById('webgl-canvas');
|
||||||
gl = webglCanvas.getContext('webgl', {xrCompatible: true});
|
gl = webglCanvas.getContext('webgl', {xrCompatible: true});
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas id="webgl-canvas"></canvas>
|
<canvas id="webgl-canvas"></canvas>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"A lost webglCanvasContext should not be able to set xr compatibility",
|
"A lost webglCanvasContext should not be able to set xr compatibility",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
|
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => {
|
.then( (controller) => {
|
||||||
webglCanvas = document.getElementById('webgl-canvas');
|
webglCanvas = document.getElementById('webgl-canvas');
|
||||||
gl = webglCanvas.getContext('webgl', {xrCompatible: true});
|
gl = webglCanvas.getContext('webgl', {xrCompatible: true});
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
<script>
|
<script>
|
||||||
xr_session_promise_test(
|
xr_session_promise_test(
|
||||||
"Tests requestSession resolves when supported",
|
"Tests requestSession resolves when supported",
|
||||||
(session) => {
|
(session) => {
|
||||||
assert_not_equals(session, null);
|
assert_not_equals(session, null);
|
||||||
}, { supportsImmersive:true }, 'immersive-vr');
|
}, TRACKED_IMMERSIVE_DEVICE, 'immersive-vr');
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"Requesting immersive session outside of a user gesture rejects",
|
"Requesting immersive session outside of a user gesture rejects",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
|
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => promise_rejects(
|
.then( (controller) => promise_rejects(
|
||||||
t, 'SecurityError', navigator.xr.requestSession('immersive-vr')));
|
t, 'SecurityError', navigator.xr.requestSession('immersive-vr')));
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"Requesting an immersive session when unsupported rejects",
|
"Requesting an immersive session when unsupported rejects",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:false })
|
return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => new Promise((resolve) => {
|
.then( (controller) => new Promise((resolve) => {
|
||||||
XRTest.simulateUserActivation( () => {
|
navigator.xr.test.simulateUserActivation( () => {
|
||||||
resolve(promise_rejects(
|
resolve(promise_rejects(
|
||||||
t,
|
t,
|
||||||
"NotSupportedError",
|
"NotSupportedError",
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"Requesting a session with no mode rejects",
|
"Requesting a session with no mode rejects",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:false })
|
return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => new Promise((resolve) => {
|
.then( (controller) => new Promise((resolve) => {
|
||||||
XRTest.simulateUserActivation( () => {
|
navigator.xr.test.simulateUserActivation( () => {
|
||||||
resolve(promise_rejects(
|
resolve(promise_rejects(
|
||||||
t,
|
t,
|
||||||
new TypeError(),
|
new TypeError(),
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"Requesting non-immersive session outside of a user gesture succeeds",
|
"Requesting non-immersive session outside of a user gesture succeeds",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:false })
|
return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => navigator.xr.requestSession('inline'))
|
.then( (controller) => navigator.xr.requestSession('inline'))
|
||||||
.then( (session) => { assert_not_equals(session, null); });
|
.then( (session) => { assert_not_equals(session, null); });
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"supportsSession resolves when immersive options supported",
|
"supportsSession resolves when immersive options supported",
|
||||||
() => {
|
() => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
|
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => navigator.xr.supportsSession('immersive-vr'));
|
.then( (controller) => navigator.xr.supportsSession('immersive-vr'));
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"supportsSession rejects when options not supported",
|
"supportsSession rejects when options not supported",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:false })
|
return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => {
|
.then( (controller) => {
|
||||||
return promise_rejects(
|
return promise_rejects(
|
||||||
t,
|
t,
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"supportsSession resolves when inline options supported",
|
"supportsSession resolves when inline options supported",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
|
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => {
|
.then( (controller) => {
|
||||||
// Inline sessions should be supported.
|
// Inline sessions should be supported.
|
||||||
return navigator.xr.supportsSession('inline');
|
return navigator.xr.supportsSession('inline');
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script src="resources/test-constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
<script src="resources/xr-test-asserts.js"></script>
|
<script src="resources/xr-test-asserts.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
@ -11,20 +11,9 @@
|
||||||
let immersiveTestName = "XRFrame.getPose works for immersive sessions";
|
let immersiveTestName = "XRFrame.getPose works for immersive sessions";
|
||||||
let nonImmersiveTestName = "XRFrame.getPose works for non-immersive sessions";
|
let nonImmersiveTestName = "XRFrame.getPose works for non-immersive sessions";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive:true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = function(session, fakeDeviceController, t) {
|
let testFunction = function(session, fakeDeviceController, t) {
|
||||||
// Need to have a valid pose or input events don't process.
|
|
||||||
fakeDeviceController.setXRPresentationFrameData(VALID_POSE_MATRIX, [{
|
|
||||||
eye:"left",
|
|
||||||
projectionMatrix: VALID_PROJECTION_MATRIX,
|
|
||||||
viewMatrix: VALID_VIEW_MATRIX
|
|
||||||
}, {
|
|
||||||
eye:"right",
|
|
||||||
projectionMatrix: VALID_PROJECTION_MATRIX,
|
|
||||||
viewMatrix: VALID_VIEW_MATRIX
|
|
||||||
}]);
|
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
session.requestReferenceSpace('local'),
|
session.requestReferenceSpace('local'),
|
||||||
session.requestReferenceSpace('local')
|
session.requestReferenceSpace('local')
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
let nonImmersiveTestName = "XRFrame methods throw exceptions outside of the " +
|
let nonImmersiveTestName = "XRFrame methods throw exceptions outside of the " +
|
||||||
"requestAnimationFrame callback for non-immersive sessions";
|
"requestAnimationFrame callback for non-immersive sessions";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive:true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = (testSession, testController, t) => new Promise((resolve) => {
|
let testFunction = (testSession, testController, t) => new Promise((resolve) => {
|
||||||
let staleFrame = null;
|
let staleFrame = null;
|
||||||
|
@ -54,4 +55,4 @@
|
||||||
fakeDeviceInitParams, 'inline');
|
fakeDeviceInitParams, 'inline');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script src="resources/webxr_test_constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script src="resources/webxr_test_asserts.js"></script>
|
<script src="resources/webxr_test_asserts.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let constructor_test_name = "XRRay constructors work";
|
let constructor_test_name = "XRRay constructors work";
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<script src="resources/webxr_test_constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script src="resources/webxr_test_asserts.js"></script>
|
<script src="resources/webxr_test_asserts.js"></script>
|
||||||
<script src="resources/webxr_math_utils.js"></script>
|
<script src="resources/webxr_math_utils.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let matrix_tests_name = "XRRay matrix works";
|
let matrix_tests_name = "XRRay matrix works";
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
<script src="resources/webxr_test_constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas id="webgl-canvas"></canvas>
|
<canvas id="webgl-canvas"></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let testName = "XRRigidTransform constructor works";
|
let testName = "XRRigidTransform constructor works";
|
||||||
let fakeDeviceInitParams = { supportsImmersive: true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction =
|
let testFunction =
|
||||||
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
|
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
<script src="resources/webxr_test_constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas id="webgl-canvas"></canvas>
|
<canvas id="webgl-canvas"></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let testName = "XRRigidTransform inverse works";
|
let testName = "XRRigidTransform inverse works";
|
||||||
let fakeDeviceInitParams = { supportsImmersive: true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction =
|
let testFunction =
|
||||||
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
|
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<script src="resources/webxr_test_constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script src="resources/webxr_test_asserts.js"></script>
|
<script src="resources/webxr_test_asserts.js"></script>
|
||||||
<script src="resources/webxr_math_utils.js"></script>
|
<script src="resources/webxr_math_utils.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let matrix_tests_name = "XRRigidTransform matrix works";
|
let matrix_tests_name = "XRRigidTransform matrix works";
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
let nonImmersiveTestName = "XRSession requestAnimationFrame callbacks can be "
|
let nonImmersiveTestName = "XRSession requestAnimationFrame callbacks can be "
|
||||||
+ "unregistered with cancelAnimationFrame for non-immersive sessions";
|
+ "unregistered with cancelAnimationFrame for non-immersive sessions";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive:true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = (session) => new Promise((resolve, reject) => {
|
let testFunction = (session) => new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
<script>
|
<script>
|
||||||
let immersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
|
let immersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
|
||||||
|
@ -10,7 +11,7 @@
|
||||||
let nonImmersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
|
let nonImmersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
|
||||||
+ "behavior when given invalid handles on non-immersive testSession";
|
+ "behavior when given invalid handles on non-immersive testSession";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive:true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = (testSession) => new Promise((resolve) => {
|
let testFunction = (testSession) => new Promise((resolve) => {
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const immersivetestName = "end event fires when immersive session ends";
|
const immersivetestName = "end event fires when immersive session ends";
|
||||||
const nonimmersiveTestName = "end event fires when non-immersive session ends";
|
const nonimmersiveTestName = "end event fires when non-immersive session ends";
|
||||||
let watcherDone = new Event("watcherdone");
|
let watcherDone = new Event("watcherdone");
|
||||||
const fakeDeviceInitParams = { supportsImmersive:true };
|
const fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = function(session, testDeviceController, t) {
|
let testFunction = function(session, testDeviceController, t) {
|
||||||
let eventWatcher = new EventWatcher(t, session, ["end", "watcherdone"]);
|
let eventWatcher = new EventWatcher(t, session, ["end", "watcherdone"]);
|
||||||
|
@ -32,4 +33,4 @@
|
||||||
xr_session_promise_test(nonimmersiveTestName, testFunction,
|
xr_session_promise_test(nonimmersiveTestName, testFunction,
|
||||||
fakeDeviceInitParams, 'inline');
|
fakeDeviceInitParams, 'inline');
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -3,18 +3,19 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
xr_promise_test(
|
xr_promise_test(
|
||||||
"Test prevention of multiple simultaneous immersive sessions",
|
"Test prevention of multiple simultaneous immersive sessions",
|
||||||
(t) => {
|
(t) => {
|
||||||
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
|
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
|
||||||
.then( (controller) => new Promise((resolve) => {
|
.then( (controller) => new Promise((resolve) => {
|
||||||
XRTest.simulateUserActivation( () => {
|
navigator.xr.test.simulateUserActivation( () => {
|
||||||
resolve(navigator.xr.requestSession('immersive-vr')
|
resolve(navigator.xr.requestSession('immersive-vr')
|
||||||
.then( (session) => new Promise((resolve) => {
|
.then( (session) => new Promise((resolve) => {
|
||||||
XRTest.simulateUserActivation( () => {
|
navigator.xr.test.simulateUserActivation( () => {
|
||||||
// Requesting a second immersive session when another immersive
|
// Requesting a second immersive session when another immersive
|
||||||
// session is active should fail. Immersive sessions
|
// session is active should fail. Immersive sessions
|
||||||
// should take up the users entire view, and therefore it should
|
// should take up the users entire view, and therefore it should
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
// End the immersive session and try again. Now the immersive
|
// End the immersive session and try again. Now the immersive
|
||||||
// session creation should succeed.
|
// session creation should succeed.
|
||||||
return session.end().then( () => new Promise((resolve) => {
|
return session.end().then( () => new Promise((resolve) => {
|
||||||
XRTest.simulateUserActivation( () => {
|
navigator.xr.test.simulateUserActivation( () => {
|
||||||
resolve(navigator.xr.requestSession('immersive-vr'));
|
resolve(navigator.xr.requestSession('immersive-vr'));
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
let nonImmersiveTestName = "XRSession requestAnimationFrame calls the " +
|
let nonImmersiveTestName = "XRSession requestAnimationFrame calls the " +
|
||||||
"provided callback a non-immersive session";
|
"provided callback a non-immersive session";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive:true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = (testSession) => new Promise((resolve) => {
|
let testFunction = (testSession) => new Promise((resolve) => {
|
||||||
function onFrame(time, xrFrame) {
|
function onFrame(time, xrFrame) {
|
||||||
|
@ -29,4 +30,4 @@
|
||||||
fakeDeviceInitParams, 'inline');
|
fakeDeviceInitParams, 'inline');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -3,31 +3,13 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const testName = "RequestAnimationFrame resolves with good data";
|
const testName = "RequestAnimationFrame resolves with good data";
|
||||||
|
|
||||||
const identityMatrix = new Float32Array([
|
const fakeDeviceInitOptions = TRACKED_IMMERSIVE_DEVICE;
|
||||||
1, 0, 0, 0,
|
|
||||||
0, 1, 0, 0,
|
|
||||||
0, 0, 1, 0,
|
|
||||||
0, 0, 0, 1
|
|
||||||
]);
|
|
||||||
|
|
||||||
const rightFakeXRViewInit = {
|
|
||||||
eye:"right",
|
|
||||||
projectionMatrix: identityMatrix,
|
|
||||||
viewMatrix: identityMatrix
|
|
||||||
};
|
|
||||||
|
|
||||||
const leftFakeXRViewInit = {
|
|
||||||
eye:"left",
|
|
||||||
projectionMatrix: identityMatrix,
|
|
||||||
viewMatrix: identityMatrix
|
|
||||||
};
|
|
||||||
|
|
||||||
const fakeDeviceInitOptions = { supportsImmersive:true };
|
|
||||||
|
|
||||||
let testSession;
|
let testSession;
|
||||||
|
|
||||||
|
@ -52,8 +34,8 @@
|
||||||
let viewerPose = xrFrame.getViewerPose(referenceSpace);
|
let viewerPose = xrFrame.getViewerPose(referenceSpace);
|
||||||
|
|
||||||
assert_not_equals(viewerPose, null);
|
assert_not_equals(viewerPose, null);
|
||||||
for(let i = 0; i < identityMatrix.length; i++) {
|
for(let i = 0; i < IDENTITY_MATRIX.length; i++) {
|
||||||
assert_equals(viewerPose.transform.matrix[i], identityMatrix[i]);
|
assert_equals(viewerPose.transform.matrix[i], IDENTITY_MATRIX[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_not_equals(viewerPose.views, null);
|
assert_not_equals(viewerPose.views, null);
|
||||||
|
@ -65,11 +47,6 @@
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
testDeviceController.setXRPresentationFrameData(
|
|
||||||
identityMatrix,
|
|
||||||
[rightFakeXRViewInit, leftFakeXRViewInit]
|
|
||||||
);
|
|
||||||
|
|
||||||
testSession.requestAnimationFrame(onFrame);
|
testSession.requestAnimationFrame(onFrame);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
|
<script src="resources/xr-test-asserts.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -12,12 +14,22 @@
|
||||||
let nonImmersiveTestName =
|
let nonImmersiveTestName =
|
||||||
"XRFrame getViewerPose updates on the next frame for non-immersive sessions";
|
"XRFrame getViewerPose updates on the next frame for non-immersive sessions";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive: true };
|
let fakeDeviceInitParams = {
|
||||||
|
supportsImmersive: true,
|
||||||
|
views: VALID_VIEWS
|
||||||
|
};
|
||||||
|
|
||||||
// Valid matrices for when we don't care about specific values
|
// A valid pose matrix/transform for when we don't care about specific values
|
||||||
const validPoseMatrix = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1];
|
// Note that these two should be identical, just different representations
|
||||||
const validProjectionMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
|
const expectedPoseMatrix = [0, 1, 0, 0,
|
||||||
const validViewMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
0, 0, 1, 0,
|
||||||
|
1, 0, 0, 0,
|
||||||
|
1, 1, 1, 1];
|
||||||
|
|
||||||
|
const poseTransform = {
|
||||||
|
position: [1, 1, 1],
|
||||||
|
orientation: [0.5, 0.5, 0.5, 0.5]
|
||||||
|
};
|
||||||
|
|
||||||
let testFunction = function(session, fakeDeviceController, t) {
|
let testFunction = function(session, fakeDeviceController, t) {
|
||||||
return session.requestReferenceSpace('local')
|
return session.requestReferenceSpace('local')
|
||||||
|
@ -30,16 +42,7 @@
|
||||||
// Expecting to not get a pose since none has been supplied
|
// Expecting to not get a pose since none has been supplied
|
||||||
assert_equals(vrFrame.getViewerPose(referenceSpace), null);
|
assert_equals(vrFrame.getViewerPose(referenceSpace), null);
|
||||||
|
|
||||||
fakeDeviceController.setXRPresentationFrameData(
|
fakeDeviceController.setViewerOrigin(poseTransform);
|
||||||
validPoseMatrix, [{
|
|
||||||
eye:"left",
|
|
||||||
projectionMatrix: validProjectionMatrix,
|
|
||||||
viewMatrix: validViewMatrix
|
|
||||||
}, {
|
|
||||||
eye:"right",
|
|
||||||
projectionMatrix: validProjectionMatrix,
|
|
||||||
viewMatrix: validViewMatrix
|
|
||||||
}]);
|
|
||||||
|
|
||||||
// Check that pose does not update pose within the same frame.
|
// Check that pose does not update pose within the same frame.
|
||||||
assert_equals(vrFrame.getViewerPose(referenceSpace), null);
|
assert_equals(vrFrame.getViewerPose(referenceSpace), null);
|
||||||
|
@ -51,10 +54,7 @@
|
||||||
|
|
||||||
let poseMatrix = pose.transform.matrix;
|
let poseMatrix = pose.transform.matrix;
|
||||||
assert_not_equals(poseMatrix, null);
|
assert_not_equals(poseMatrix, null);
|
||||||
|
assert_matrix_approx_equals(poseMatrix, expectedPoseMatrix, FLOAT_EPSILON);
|
||||||
for(let i = 0; i < poseMatrix.length; i++) {
|
|
||||||
assert_equals(poseMatrix[i], validPoseMatrix[i]);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Finished.
|
// Finished.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
let nonImmersiveTestName =
|
let nonImmersiveTestName =
|
||||||
"Non-immersive XRSession requestReferenceSpace returns expected objects";
|
"Non-immersive XRSession requestReferenceSpace returns expected objects";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive: true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = function(session, fakeDeviceController, t) {
|
let testFunction = function(session, fakeDeviceController, t) {
|
||||||
return promise_rejects(t, new TypeError(), session.requestReferenceSpace('foo'))
|
return promise_rejects(t, new TypeError(), session.requestReferenceSpace('foo'))
|
||||||
|
@ -61,4 +62,4 @@
|
||||||
nonImmersiveTestName, testFunction, fakeDeviceInitParams, 'inline');
|
nonImmersiveTestName, testFunction, fakeDeviceInitParams, 'inline');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<script src=/resources/testharness.js></script>
|
<script src=/resources/testharness.js></script>
|
||||||
<script src=/resources/testharnessreport.js></script>
|
<script src=/resources/testharnessreport.js></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -12,14 +13,7 @@
|
||||||
let inlineTestName =
|
let inlineTestName =
|
||||||
"Identity reference space provides correct poses for inline sessions";
|
"Identity reference space provides correct poses for inline sessions";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive: true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
const identityMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
||||||
|
|
||||||
// Valid matrices for when we don't care about specific values
|
|
||||||
const validPoseMatrix = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1];
|
|
||||||
const validProjectionMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
|
|
||||||
const validViewMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
|
||||||
|
|
||||||
let testFunction = function(session, fakeDeviceController, t) {
|
let testFunction = function(session, fakeDeviceController, t) {
|
||||||
return session.requestReferenceSpace('viewer')
|
return session.requestReferenceSpace('viewer')
|
||||||
|
@ -37,19 +31,10 @@
|
||||||
assert_not_equals(poseMatrix, null);
|
assert_not_equals(poseMatrix, null);
|
||||||
|
|
||||||
for(let i = 0; i < poseMatrix.length; i++) {
|
for(let i = 0; i < poseMatrix.length; i++) {
|
||||||
assert_equals(poseMatrix[i], identityMatrix[i]);
|
assert_equals(poseMatrix[i], IDENTITY_MATRIX[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fakeDeviceController.setXRPresentationFrameData(
|
fakeDeviceController.setViewerOrigin(VALID_POSE_TRANSFORM);
|
||||||
validPoseMatrix, [{
|
|
||||||
eye:"left",
|
|
||||||
projectionMatrix: validProjectionMatrix,
|
|
||||||
viewMatrix: validViewMatrix
|
|
||||||
}, {
|
|
||||||
eye:"right",
|
|
||||||
projectionMatrix: validProjectionMatrix,
|
|
||||||
viewMatrix: validViewMatrix
|
|
||||||
}]);
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
t.step( () => {
|
t.step( () => {
|
||||||
|
@ -62,7 +47,7 @@
|
||||||
assert_not_equals(poseMatrix, null);
|
assert_not_equals(poseMatrix, null);
|
||||||
|
|
||||||
for(let i = 0; i < poseMatrix.length; i++) {
|
for(let i = 0; i < poseMatrix.length; i++) {
|
||||||
assert_equals(poseMatrix[i], identityMatrix[i]);
|
assert_equals(poseMatrix[i], IDENTITY_MATRIX[i]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script src="resources/test-constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
<script src="resources/xr-test-asserts.js"></script>
|
<script src="resources/xr-test-asserts.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
@ -11,20 +11,9 @@
|
||||||
let immersiveTestName = "XRView.eye is correct for immersive sessions";
|
let immersiveTestName = "XRView.eye is correct for immersive sessions";
|
||||||
let nonImmersiveTestName = "XRView.eye is correct for non-immersive sessions";
|
let nonImmersiveTestName = "XRView.eye is correct for non-immersive sessions";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive:true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = function(session, fakeDeviceController, t) {
|
let testFunction = function(session, fakeDeviceController, t) {
|
||||||
// Need to have a valid pose or input events don't process.
|
|
||||||
fakeDeviceController.setXRPresentationFrameData(VALID_POSE_MATRIX, [{
|
|
||||||
eye:"left",
|
|
||||||
projectionMatrix: VALID_PROJECTION_MATRIX,
|
|
||||||
viewMatrix: VALID_VIEW_MATRIX
|
|
||||||
}, {
|
|
||||||
eye:"right",
|
|
||||||
projectionMatrix: VALID_PROJECTION_MATRIX,
|
|
||||||
viewMatrix: VALID_VIEW_MATRIX
|
|
||||||
}]);
|
|
||||||
|
|
||||||
return session.requestReferenceSpace('viewer')
|
return session.requestReferenceSpace('viewer')
|
||||||
.then((space) => new Promise((resolve) => {
|
.then((space) => new Promise((resolve) => {
|
||||||
function onFrame(time, xrFrame) {
|
function onFrame(time, xrFrame) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script src="resources/test-constants.js"></script>
|
<script src="resources/webxr_test_constants.js"></script>
|
||||||
<script src="resources/webxr_util.js"></script>
|
<script src="resources/webxr_util.js"></script>
|
||||||
<script src="resources/xr-test-asserts.js"></script>
|
<script src="resources/xr-test-asserts.js"></script>
|
||||||
<canvas></canvas>
|
<canvas></canvas>
|
||||||
|
@ -11,20 +11,9 @@
|
||||||
let immersiveTestName = "XRWebGLLayer reports a valid viewports for immersive sessions";
|
let immersiveTestName = "XRWebGLLayer reports a valid viewports for immersive sessions";
|
||||||
let inlineTestName = "XRWebGLLayer reports a valid viewports for inline sessions";
|
let inlineTestName = "XRWebGLLayer reports a valid viewports for inline sessions";
|
||||||
|
|
||||||
let fakeDeviceInitParams = { supportsImmersive:true };
|
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
|
||||||
|
|
||||||
let testFunction = function(session, fakeDeviceController, t) {
|
let testFunction = function(session, fakeDeviceController, t) {
|
||||||
// Need to have a valid pose.
|
|
||||||
fakeDeviceController.setXRPresentationFrameData(VALID_POSE_MATRIX, [{
|
|
||||||
eye:"left",
|
|
||||||
projectionMatrix: VALID_PROJECTION_MATRIX,
|
|
||||||
viewMatrix: VALID_VIEW_MATRIX
|
|
||||||
}, {
|
|
||||||
eye:"right",
|
|
||||||
projectionMatrix: VALID_PROJECTION_MATRIX,
|
|
||||||
viewMatrix: VALID_VIEW_MATRIX
|
|
||||||
}]);
|
|
||||||
|
|
||||||
return session.requestReferenceSpace('viewer')
|
return session.requestReferenceSpace('viewer')
|
||||||
.then((space) => new Promise((resolve) => {
|
.then((space) => new Promise((resolve) => {
|
||||||
function onFrame(time, xrFrame) {
|
function onFrame(time, xrFrame) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче