Auto merge of #25259 - Manishearth:wpt-fixes, r=asajeffrey

Various webxr WPT fixes

Needs https://github.com/servo/webxr/pull/108

r? @asajeffrey

Went through most of the failing tests and fixed them. Many of the remaining ones fail due to unsupported features that I can slowly whittle away.
This commit is contained in:
bors-servo 2019-12-12 18:13:15 -05:00 committed by GitHub
commit 748edb2cd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 212 additions and 180 deletions

View file

@ -727760,7 +727760,7 @@
"testharness"
],
"webxr/xrDevice_requestSession_no_mode.https.html": [
"de77b38c868e3b5dad88b8eface770b16b5f16c1",
"5ef249c58186131f8e467da48cfafebe65df9adf",
"testharness"
],
"webxr/xrDevice_requestSession_non_immersive_no_gesture.https.html": [
@ -727872,7 +727872,7 @@
"testharness"
],
"webxr/xrSession_requestAnimationFrame_timestamp.https.html": [
"2796be9987b5f23e92d5f114fdaa972a5323a37c",
"8f5c21cba4015da10b9031f1cf100138e958c46e",
"testharness"
],
"webxr/xrSession_requestReferenceSpace.https.html": [
@ -727928,7 +727928,7 @@
"testharness"
],
"webxr/xrWebGLLayer_constructor.https.html": [
"0584da79c12def757f951ec53c4c048f18c39b8c",
"dda7ec80310f7ff8aac582a98410886ab4d1b81d",
"testharness"
],
"webxr/xrWebGLLayer_framebuffer_draw.https.html": [

View file

@ -1,4 +0,0 @@
[render_state_vertical_fov_immersive.https.html]
[inlineVerticalFieldOfView is set appropriately on immersively sessions]
expected: FAIL

View file

@ -1,4 +0,0 @@
[render_state_vertical_fov_inline.https.html]
[inlineVerticalFieldOfView is set appropriately on inline sessions]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrDevice_requestSession_no_mode.https.html]
[Requesting a session with no mode rejects]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrDevice_requestSession_non_immersive_no_gesture.https.html]
[Requesting non-immersive session outside of a user gesture succeeds]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrSession_requestAnimationFrame_getViewerPose.https.html]
[XRFrame getViewerPose updates on the next frame for non-immersive sessions]
expected: FAIL
[XRFrame getViewerPose updates on the next frame for immersive sessions]
expected: FAIL

View file

@ -1,8 +0,0 @@
[xrSession_requestAnimationFrame_timestamp.https.html]
expected: TIMEOUT
[XRFrame getViewerPose updates on the next frame for immersive]
expected: FAIL
[XRFrame getViewerPose updates on the next frame for non-immersive]
expected: TIMEOUT

View file

@ -1,4 +1,5 @@
[xrWebGLLayer_constructor.https.html]
expected: ERROR
[Ensure that XRWebGLLayer's constructor throws appropriate errors]
expected: FAIL
expected: TIMEOUT

View file

@ -1,4 +0,0 @@
[xrWebGLLayer_viewports.https.html]
[XRWebGLLayer reports a valid viewports for inline sessions]
expected: FAIL

View file

@ -11,11 +11,10 @@
return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
.then( (controller) => new Promise((resolve) => {
navigator.xr.test.simulateUserActivation( () => {
resolve(promise_rejects(
t,
new TypeError(),
navigator.xr.requestSession()
))
t.step_func(() => {
assert_throws(new TypeError(), () => navigator.xr.requestSession())
})
resolve()
});
}));
});

View file

@ -20,25 +20,23 @@ let testFunction = function(session, fakeDeviceController, t) {
let counter = 0;
let windowFrameTime = 0;
let frameTime = 0;
let lastFrameTime = 0;
let firstFrame = true;
function onFrameFirst(time, xrFrame) {
lastFrameTime = frameTime;
frameTime = time;
firstFrame = false;
let now = performance.now();
t.step( () => {
// This callback must be the first one called.
assert_equals(counter, 0);
// window.requestAnimationFrame and session.requestAnimationFrame
// should be providing timestamps that are on the same scale and
// within a resonable margin of error of eachother. This means that
// this frame's timestamp should be larger than one provided to a
// previous window.requestAnimationFrame and should also be within
// a sane delta of it. One minute is probably overly generous here,
// but it will at least catch cases where the times are reported with
// entirely different bases.
assert_greater_than(frameTime, windowFrameTime);
assert_approx_equals(frameTime, windowFrameTime, ONE_MINUTE);
if (!firstFrame) {
assert_greater_than(frameTime, lastFrameTime);
assert_approx_equals(frameTime, lastFrameTime, TEN_SECONDS);
}
// There's going to be some disparity between performance.now() and
// the timestamp passed into the callback, but it shouldn't be huge.
@ -47,6 +45,12 @@ let testFunction = function(session, fakeDeviceController, t) {
assert_approx_equals(frameTime, now, TEN_SECONDS);
});
if (firstFrame) {
session.requestAnimationFrame(onFrameFirst);
} else {
resolve();
}
counter++;
}
@ -65,21 +69,14 @@ let testFunction = function(session, fakeDeviceController, t) {
// Make sure all the previous callbacks fired as expected.
assert_equals(counter, 11);
});
// Finished.
resolve();
}
window.requestAnimationFrame((time) => {
windowFrameTime = time;
// Queue up several callbacks
session.requestAnimationFrame(onFrameFirst);
for (let i = 0; i < 10; ++i) {
session.requestAnimationFrame(onFrameSubsequent);
}
session.requestAnimationFrame(onFrameLast);
});
session.requestAnimationFrame(onFrameFirst);
// Queue up several callbacks
for (let i = 0; i < 10; ++i) {
session.requestAnimationFrame(onFrameSubsequent);
}
session.requestAnimationFrame(onFrameLast);
}));
};

View file

@ -31,12 +31,14 @@ xr_promise_test("Ensure that XRWebGLLayer's constructor throws appropriate error
navigator.xr.test.simulateUserActivation(() => {
navigator.xr.requestSession('immersive-vr')
.then((session) => {
try {
let webglLayerIncompatible = new XRWebGLLayer(session, gl);
assert_unreached("XRWebGLLayer should fail when created with a context that is not XRCompatible")
} catch (err) {
assert_equals(err.name, "InvalidStateError");
}
t.step_func(() => {
try {
let webglLayerIncompatible = new XRWebGLLayer(session, gl);
assert_unreached("XRWebGLLayer should fail when created with a context that is not XRCompatible")
} catch (err) {
assert_equals(err.name, "InvalidStateError");
}
})
gl.makeXRCompatible();