Commit db70ccb2 authored by Alex Cooper's avatar Alex Cooper Committed by Commit Bot

Swap testFunction and xr_session_promise_test param orders

Purely mechanical changes to swap the order of params from the helpers
in xr-test-utils.js to match those from webxr_util.js so that porting
tests can be more straightforward.

Does not address the potentially more complicated work of only one
sessionMode or the test harness handling the baseLayer yet.

Bug: 981003
Change-Id: I5a57b814582b88297a98c64c1fa452fe22736ee0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1704697
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: default avatarBill Orr <billorr@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678451}
parent 43da8579
......@@ -24,7 +24,7 @@ let expectedHitMatrix = [1, 0, 0, 1,
0, 0, 1, 3,
0, 0, 0, 1];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
assert_equals(session.mode, 'immersive-ar');
assert_not_equals(session.environmentBlendMode, 'opaque');
return session.requestReferenceSpace('local').then((referenceSpace) => {
......@@ -53,6 +53,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -46,6 +46,6 @@ let testFunction = (session) => new Promise((resolve, reject) => {
});
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -16,7 +16,7 @@ let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let requestSessionModes = ['immersive-vr'];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or frame requests will be ignored.
session.updateRenderState({
......@@ -50,6 +50,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -25,7 +25,7 @@ function assertApproximatelyEqual(a, b, step, epsilon = FLOAT_EPSILON) {
assert_less_than(Math.abs(a - b), epsilon, step);
}
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or frame requests will be ignored.
session.updateRenderState({
baseLayer: new XRWebGLLayer(session, gl, { compositionDisabled: true })
......@@ -89,6 +89,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -2,7 +2,7 @@
// performs tests. If func returns a promise, test will only pass if the promise
// resolves.
function xr_session_promise_test(
func, deviceOptions, sessionModes, name, properties) {
name, func, deviceOptions, sessionModes, properties) {
if (document.getElementById('webgl-canvas') ||
document.getElementById('webgl2-canvas')) {
webglCanvasSetup();
......@@ -42,7 +42,7 @@ function xr_session_promise_test(
.then((session) => {
testSession = session;
testSession.mode = nextMode;
return func(session, t, fakeDeviceController);
return func(session, fakeDeviceController, t);
})
.then(() => {
// End the session. Silence any errors generated if the
......
......@@ -24,7 +24,7 @@ let requestSessionModes = [
'immersive-vr',
];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or else frame requests will be ignored.
session.updateRenderState({
baseLayer: new XRWebGLLayer(session, gl)
......@@ -94,6 +94,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -19,7 +19,7 @@ let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let requestSessionModes = ['immersive-vr'];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or frame requests will be ignored.
let webglLayer = new XRWebGLLayer(session, gl);
session.updateRenderState({ baseLayer: webglLayer });
......@@ -47,6 +47,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -16,7 +16,7 @@ let testName = "Immersive session ends if data provider disconnects.";
let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let requestSessionModes = ['immersive-vr'];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
return new Promise((resolve) => {
// Session must have a baseLayer or frame requests will be ignored.
session.updateRenderState({ baseLayer: new XRWebGLLayer(session, gl) });
......@@ -34,6 +34,6 @@ let testFunction = function(session, t, fakeDeviceController) {
}
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -16,7 +16,7 @@ let testName = "Inline session ends if magic window data provider disconnects.";
let fakeDeviceInitParams = VALID_NON_IMMERSIVE_DEVICE;
let requestSessionModes = ['inline'];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
return new Promise((resolve) => {
// Session must have a baseLayer or frame requests will be ignored.
session.updateRenderState({
......@@ -36,6 +36,6 @@ let testFunction = function(session, t, fakeDeviceController) {
}
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -19,23 +19,23 @@ let requestSessionModes = [
'immersive-vr',
];
let testFunction = function(session, t) {
let testFunction = function(session, fakeDeviceController, t) {
t.step(() => {
assert_equals(session.environmentBlendMode, 'opaque');
});
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
// TODO(https://crbug.com/828321): Enable once session options for AR are in place.
/*xr_session_promise_test( (session, t) => {
/*xr_session_promise_test("environmentBlendMode is correct for an AR device",
(session, fakeDeviceController, t) => {
t.step(() => {
assert_equals(session.environmentBlendMode, 'alpha-blend');
});
}, fakeDevices["FakeARPhone"], [
{ ar: true, outputContext: getOutputContext() }
],
"environmentBlendMode is correct for an AR device");*/
]);*/
</script>
......@@ -39,7 +39,7 @@ MockRuntime.prototype.requestHitTest = function(Ray) {
return new Promise((resolve,reject) => { });
}
let testFunction = function(session, t, controller) {
let testFunction = function(session, fakeDeviceController, t) {
return session.requestReferenceSpace('local')
.then((referenceSpace) => {
refSpace = referenceSpace;
......@@ -51,7 +51,7 @@ let testFunction = function(session, t, controller) {
.then(() => {
immediatelyResolveHitTest = false;
let hitTestPromise = session.requestHitTest(ray, refSpace);
controller.closeEnvironmentIntegrationProvider();
fakeDeviceController.closeEnvironmentIntegrationProvider();
return hitTestPromise;
})
.then(() => {
......@@ -63,6 +63,6 @@ let testFunction = function(session, t, controller) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -21,7 +21,7 @@ let requestSessionModes = [
'immersive-vr',
];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or else frame requests will be ignored.
session.updateRenderState({
baseLayer: new XRWebGLLayer(session, gl, {
......@@ -98,6 +98,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -33,7 +33,7 @@ let fakeDeviceInitParams = {
let requestSessionModes = ['immersive-vr'];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or frame requests will be ignored.
let webglLayer = new XRWebGLLayer(session, gl);
session.updateRenderState({ baseLayer: webglLayer });
......@@ -89,6 +89,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -34,7 +34,7 @@ let fakeDeviceInitParams = {
let requestSessionModes = ['immersive-vr'];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or frame requests will be ignored.
session.updateRenderState({ baseLayer: new XRWebGLLayer(session, gl) });
......@@ -81,6 +81,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -15,7 +15,7 @@ let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let requestSessionModes = ['immersive-vr'];
let testFunction = function(session, t, fakeDeviceController) {
let testFunction = function(session, fakeDeviceController, t) {
// Session must have a baseLayer or frame requests will be ignored.
let webglLayer = new XRWebGLLayer(session, gl);
session.updateRenderState({ baseLayer: webglLayer });
......@@ -79,6 +79,6 @@ let testFunction = function(session, t, fakeDeviceController) {
};
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -17,7 +17,7 @@ let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let requestSessionModes = ['immersive-vr'];
let testFunction =
(session, t, fakeDeviceController) => new Promise((resolve, reject) => {
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
try {
let webglLayerGood = new XRWebGLLayer(session, gl);
} catch (err) {
......@@ -54,6 +54,6 @@ let testFunction =
});
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -19,7 +19,7 @@ let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let requestSessionModes = ['immersive-vr'];
let testFunction =
(session, t, fakeDeviceController) => new Promise((resolve, reject) => {
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
// Session must have a baseLayer or else frame requests will be ignored.
let webglLayer = new XRWebGLLayer(session, gl);
session.updateRenderState({ baseLayer: webglLayer });
......@@ -63,6 +63,6 @@ let testFunction =
});
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -38,7 +38,7 @@ function setupProgram(gl, vertexSrc, fragmentSrc) {
}
let testFunction =
(session, t, fakeDeviceController) => new Promise((resolve, reject) => {
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
// Setup simple WebGL geometry to draw with.
let program = setupProgram(gl,
"attribute vec4 vPosition; void main() { gl_Position = vPosition; }",
......@@ -95,6 +95,6 @@ let testFunction =
});
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -17,7 +17,7 @@ let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
let requestSessionModes = ['immersive-vr'];
let testFunction =
(session, t, fakeDeviceController) => new Promise((resolve, reject) => {
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
// Session must have a baseLayer or else frame requests will be ignored.
let webglLayer = new XRWebGLLayer(session, gl);
let defaultFramebufferWidth = webglLayer.framebufferWidth;
......@@ -59,6 +59,6 @@ let testFunction =
});
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
......@@ -19,7 +19,7 @@ let requestSessionModes = [
];
let testFunction =
(session, t, fakeDeviceController) => new Promise((resolve, reject) => {
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
// Session must have a baseLayer or frame requests will be ignored.
let webglLayer = new XRWebGLLayer(session, gl, {
compositionDisabled: session.mode == 'inline' });
......@@ -119,6 +119,6 @@ let testFunction =
});
xr_session_promise_test(
testFunction, fakeDeviceInitParams, requestSessionModes, testName);
testName, testFunction, fakeDeviceInitParams, requestSessionModes);
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment