1 description("Tests the timestamps provided to prefixed webkitRequestAnimationFrame callbacks");
3 var firstTimestamp = undefined;
4 var secondTimestamp = undefined;
5 var legacyFirstTimestamp = undefined;
6 var legacySecondTimestamp = undefined;
7 var deltaError = undefined;
9 function busyWait(millis) {
10 var start = Date.now();
11 while (Date.now()-start < millis) {}
14 window.requestAnimationFrame(function(timestamp) {
15 firstTimestamp = timestamp;
18 window.webkitRequestAnimationFrame(function(timestamp) {
19 legacyFirstTimestamp = timestamp;
21 window.requestAnimationFrame(function(timestamp) {
22 secondTimestamp = timestamp;
25 window.webkitRequestAnimationFrame(function(timestamp) {
26 legacySecondTimestamp = timestamp;
28 shouldBeGreaterThanOrEqual("legacyFirstTimestamp", "firstTimestamp");
29 shouldBeGreaterThanOrEqual("legacySecondTimestamp", "secondTimestamp");
30 deltaError = Math.abs((legacySecondTimestamp - legacyFirstTimestamp) - (secondTimestamp - firstTimestamp));
31 shouldBeTrue("deltaError < 0.001");
32 testRunner.notifyDone();
38 if (window.testRunner)
39 testRunner.waitUntilDone();