mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update webxr timestamp test to not compare against window.rAF()
The exact desired behavior is unclear, see https://github.com/immersive-web/webxr/issues/943 and https://github.com/immersive-web/webxr/issues/225
This commit is contained in:
parent
e27687497b
commit
0bace66f70
3 changed files with 21 additions and 32 deletions
|
@ -727627,7 +727627,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webxr/xrSession_requestAnimationFrame_timestamp.https.html": [
|
||||
"2796be9987b5f23e92d5f114fdaa972a5323a37c",
|
||||
"8f5c21cba4015da10b9031f1cf100138e958c46e",
|
||||
"testharness"
|
||||
],
|
||||
"webxr/xrSession_requestReferenceSpace.https.html": [
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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);
|
||||
|
||||
}));
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue