summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js')
-rw-r--r--LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js b/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js
new file mode 100644
index 0000000..52d9b90
--- /dev/null
+++ b/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js
@@ -0,0 +1,37 @@
+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.webkitRequestAnimationFrame(function(timestamp) {
+ firstTimestamp = timestamp;
+ shouldBeDefined("firstTimestamp");
+ window.webkitRequestAnimationFrame(function(timestamp) {
+ secondTimestamp = timestamp;
+ shouldBeDefined("secondTimestamp");
+ shouldBeTrue("secondTimestamp > firstTimestamp");
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ });
+ busyWait(10);
+ if (window.layoutTestController)
+ layoutTestController.display();
+});
+
+
+if (window.layoutTestController)
+ window.setTimeout(function() {
+ layoutTestController.display();
+ });
+
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var successfullyParsed = true;