52d9b90f89bf6b2c0780990e046d5e33212e97bf
[WebKit-https.git] / LayoutTests / fast / animation / script-tests / request-animation-frame-timestamps-advance.js
1 description("Tests the timestamps provided to requestAnimationFrame callbacks advance");
2
3 function busyWait(millis) {
4     var start = Date.now();
5     while (Date.now()-start < millis) {}
6 }
7
8 var firstTimestamp = undefined;
9 var secondTimestamp = undefined;
10
11 window.webkitRequestAnimationFrame(function(timestamp) {
12     firstTimestamp = timestamp;
13     shouldBeDefined("firstTimestamp");
14     window.webkitRequestAnimationFrame(function(timestamp) {
15         secondTimestamp = timestamp;
16         shouldBeDefined("secondTimestamp");
17         shouldBeTrue("secondTimestamp > firstTimestamp");
18         isSuccessfullyParsed();
19         if (window.layoutTestController)
20             layoutTestController.notifyDone();
21     });
22     busyWait(10);
23     if (window.layoutTestController)
24         layoutTestController.display();
25 });
26
27
28 if (window.layoutTestController)
29     window.setTimeout(function() {
30         layoutTestController.display();
31     });
32
33
34 if (window.layoutTestController)
35     layoutTestController.waitUntilDone();
36
37 var successfullyParsed = true;