mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +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"
|
"testharness"
|
||||||
],
|
],
|
||||||
"webxr/xrSession_requestAnimationFrame_timestamp.https.html": [
|
"webxr/xrSession_requestAnimationFrame_timestamp.https.html": [
|
||||||
"2796be9987b5f23e92d5f114fdaa972a5323a37c",
|
"8f5c21cba4015da10b9031f1cf100138e958c46e",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"webxr/xrSession_requestReferenceSpace.https.html": [
|
"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 counter = 0;
|
||||||
let windowFrameTime = 0;
|
let windowFrameTime = 0;
|
||||||
let frameTime = 0;
|
let frameTime = 0;
|
||||||
|
let lastFrameTime = 0;
|
||||||
|
let firstFrame = true;
|
||||||
|
|
||||||
function onFrameFirst(time, xrFrame) {
|
function onFrameFirst(time, xrFrame) {
|
||||||
|
lastFrameTime = frameTime;
|
||||||
frameTime = time;
|
frameTime = time;
|
||||||
|
firstFrame = false;
|
||||||
let now = performance.now();
|
let now = performance.now();
|
||||||
|
|
||||||
t.step( () => {
|
t.step( () => {
|
||||||
// This callback must be the first one called.
|
// This callback must be the first one called.
|
||||||
assert_equals(counter, 0);
|
assert_equals(counter, 0);
|
||||||
|
|
||||||
// window.requestAnimationFrame and session.requestAnimationFrame
|
if (!firstFrame) {
|
||||||
// should be providing timestamps that are on the same scale and
|
assert_greater_than(frameTime, lastFrameTime);
|
||||||
// within a resonable margin of error of eachother. This means that
|
assert_approx_equals(frameTime, lastFrameTime, TEN_SECONDS);
|
||||||
// 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);
|
|
||||||
|
|
||||||
// There's going to be some disparity between performance.now() and
|
// There's going to be some disparity between performance.now() and
|
||||||
// the timestamp passed into the callback, but it shouldn't be huge.
|
// 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);
|
assert_approx_equals(frameTime, now, TEN_SECONDS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (firstFrame) {
|
||||||
|
session.requestAnimationFrame(onFrameFirst);
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,21 +69,14 @@ let testFunction = function(session, fakeDeviceController, t) {
|
||||||
// Make sure all the previous callbacks fired as expected.
|
// Make sure all the previous callbacks fired as expected.
|
||||||
assert_equals(counter, 11);
|
assert_equals(counter, 11);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Finished.
|
|
||||||
resolve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.requestAnimationFrame((time) => {
|
session.requestAnimationFrame(onFrameFirst);
|
||||||
windowFrameTime = time;
|
// Queue up several callbacks
|
||||||
|
for (let i = 0; i < 10; ++i) {
|
||||||
// Queue up several callbacks
|
session.requestAnimationFrame(onFrameSubsequent);
|
||||||
session.requestAnimationFrame(onFrameFirst);
|
}
|
||||||
for (let i = 0; i < 10; ++i) {
|
session.requestAnimationFrame(onFrameLast);
|
||||||
session.requestAnimationFrame(onFrameSubsequent);
|
|
||||||
}
|
|
||||||
session.requestAnimationFrame(onFrameLast);
|
|
||||||
});
|
|
||||||
|
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue