Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various webxr WPT fixes #25259

Merged
merged 11 commits into from Dec 13, 2019

Update webxr timestamp test to not compare against window.rAF()

The exact desired behavior is unclear, see immersive-web/webxr#943 and immersive-web/webxr#225
  • Loading branch information
Manishearth committed Dec 12, 2019
commit 0bace66f70c27cad41f64eab85a74f2f2ce67797
"testharness"
],
"webxr/xrSession_requestAnimationFrame_timestamp.https.html": [
"2796be9987b5f23e92d5f114fdaa972a5323a37c",
"8f5c21cba4015da10b9031f1cf100138e958c46e",
"testharness"
],
"webxr/xrSession_requestReferenceSpace.https.html": [

This file was deleted.

@@ -20,25 +20,23 @@
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 @@
assert_approx_equals(frameTime, now, TEN_SECONDS);
});

if (firstFrame) {
session.requestAnimationFrame(onFrameFirst);
} else {
resolve();
}

counter++;
}

@@ -65,21 +69,14 @@
// 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);

}));
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.