<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<span id="e"></span>
<span id="f"></span>
<script>
jsTestIsAsync = true;

description("Tests the timestamps provided to requestAnimationFrame callbacks advance");

function busyWait(millis) {
    var start = Date.now();
    while (Date.now()-start < millis) {}
}

var firstTimestamp = undefined;
var secondTimestamp = undefined;

window.requestAnimationFrame(function(timestamp) {
    firstTimestamp = timestamp;
    shouldBeDefined("firstTimestamp");
    window.requestAnimationFrame(function(timestamp) {
        secondTimestamp = timestamp;
        shouldBeDefined("secondTimestamp");
        shouldBeTrue("secondTimestamp > firstTimestamp");
        finishJSTest();
    });
    busyWait(10);
    if (window.testRunner)
        testRunner.displayAndTrackRepaints();
});


if (window.testRunner)
    window.setTimeout(function() {
        testRunner.displayAndTrackRepaints();
    });
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
