blob: e772296b2911cd6760b7ae94fc4c89ac5f9b3e72 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<span id="e"></span>
<span id="f"></span>
<script>
description("Tests the timestamps provided to prefixed webkitRequestAnimationFrame callbacks");
var firstTimestamp = undefined;
var secondTimestamp = undefined;
var legacyFirstTimestamp = undefined;
var legacySecondTimestamp = undefined;
var deltaError = undefined;
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;
shouldBeGreaterThanOrEqual("legacyFirstTimestamp", "firstTimestamp");
shouldBeGreaterThanOrEqual("legacySecondTimestamp", "secondTimestamp");
deltaError = Math.abs((legacySecondTimestamp - legacyFirstTimestamp) - (secondTimestamp - firstTimestamp));
shouldBeTrue("deltaError < 0.001");
testRunner.notifyDone();
});
busyWait(10);
if (window.testRunner)
testRunner.displayAndTrackRepaints();
});
if (window.testRunner)
window.setTimeout(function() {
testRunner.displayAndTrackRepaints();
});
if (window.testRunner)
testRunner.waitUntilDone();
</script>
</body>
</html>