Bug 1145327 Part 2: Add test to ensure requestAnimationFrame callback timestamps always go forward in time. r=birtles,dholbert

This commit is contained in:
Mason Chang 2015-03-24 14:28:34 -07:00
parent 2429563580
commit fb9a78d6a7
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test RequestAnimationFrame Timestamps are monotonically increasing</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script>
var lastRequestAnimationFrameTimestamp = 0;
var requestAnimationFrameCount = 20;
var currentCount = 0;
// Test that all timestamps are always increasing
// and do not ever go backwards
function rafCallback(aTimestamp) {
SimpleTest.ok(aTimestamp > lastRequestAnimationFrameTimestamp,
"New RequestAnimationFrame timestamp should be later than the previous RequestAnimationFrame timestamp");
lastRequestAnimationFrameTimestamp = aTimestamp;
if (currentCount == requestAnimationFrameCount) {
SimpleTest.finish();
} else {
currentCount++;
window.requestAnimationFrame(rafCallback);
}
}
window.requestAnimationFrame(rafCallback);
SimpleTest.waitForExplicitFinish();
</script>

View File

@ -3,6 +3,7 @@ support-files =
testcommon.js
[animation-timeline/test_animation-timeline.html]
[animation-timeline/test_request_animation_frame.html]
skip-if = buildapp == 'mulet'
[css-animations/test_animations-dynamic-changes.html]
[css-animations/test_animation-effect-name.html]