<!DOCTYPE html>
<title>Tests the timestamps provided to prefixed webkitRequestAnimationFrame callbacks</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
async_test(t => {
var firstTimestamp;
var secondTimestamp;
var legacyFirstTimestamp;
var legacySecondTimestamp;
var deltaError;
function busyWait(millis) {
var start = Date.now();
while (Date.now() - start < millis) { }
}
window.requestAnimationFrame(function(timestamp) {
firstTimestamp = timestamp;
});
window.webkitRequestAnimationFrame(function(timestamp) {
legacyFirstTimestamp = timestamp;
window.requestAnimationFrame(function(timestamp) {
secondTimestamp = timestamp;
});
window.webkitRequestAnimationFrame(function(timestamp) {
legacySecondTimestamp = timestamp;
t.step(function() {
assert_greater_than_equal(legacyFirstTimestamp, firstTimestamp);
assert_greater_than_equal(legacySecondTimestamp, secondTimestamp);
deltaError = Math.abs((legacySecondTimestamp - legacyFirstTimestamp) - (secondTimestamp - firstTimestamp));
assert_less_than(deltaError, 0.3);
});
t.done();
});
busyWait(10);
});
}, "Test the timestamps provided to prefixed rAF callbacks");
</script>