summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps.js
blob: bd2764d549f7f88042809359ad0c7b7c18fe801e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
description("Tests the timestamps provided to requestAnimationFrame callbacks");

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

var firstTimestamp = undefined;

window.requestAnimationFrame(function(timestamp) {
    firstTimestamp = timestamp;
    shouldBeDefined("firstTimestamp");
    busyWait(10);
});

var secondTimestamp = undefined;
window.requestAnimationFrame(function(timestamp) {
    secondTimestamp = timestamp;
    shouldBeDefined("secondTimestamp");
    shouldBe("firstTimestamp", "secondTimestamp");
});

if (window.testRunner)
    testRunner.waitUntilDone();

requestAnimationFrame(function() {
    shouldBeDefined("firstTimestamp");
    isSuccessfullyParsed();
    if (window.testRunner)
        testRunner.notifyDone();
});