Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / animation / script-tests / request-animation-frame-timestamps.js
blobbd2764d549f7f88042809359ad0c7b7c18fe801e
1 description("Tests the timestamps provided to requestAnimationFrame callbacks");
3 function busyWait(millis) {
4 var start = Date.now();
5 while (Date.now()-start < millis) {}
8 var firstTimestamp = undefined;
10 window.requestAnimationFrame(function(timestamp) {
11 firstTimestamp = timestamp;
12 shouldBeDefined("firstTimestamp");
13 busyWait(10);
14 });
16 var secondTimestamp = undefined;
17 window.requestAnimationFrame(function(timestamp) {
18 secondTimestamp = timestamp;
19 shouldBeDefined("secondTimestamp");
20 shouldBe("firstTimestamp", "secondTimestamp");
21 });
23 if (window.testRunner)
24 testRunner.waitUntilDone();
26 requestAnimationFrame(function() {
27 shouldBeDefined("firstTimestamp");
28 isSuccessfullyParsed();
29 if (window.testRunner)
30 testRunner.notifyDone();
31 });