gecko/layout/base/tests/test_bug588174.html

60 lines
1.6 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=569520
-->
<head>
<title>Test for Bug 569520</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=569520">Mozilla Bug 569520</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 569520 **/
SimpleTest.waitForExplicitFinish();
var startNow = Date.now();
var start = window.mozAnimationStartTime;
var firstListenerTime;
var secondListenerTime;
function secondListener(time) {
secondListenerTime = time;
// They really shouldn't be more than 100ms apart, but we can get weird
// effects on slow machines. 5 minutes is our test timeout, though.
ok(Math.abs(startNow - start) <= 5 * 60 * 1000, "Bogus animation start time");
ok(firstListenerTime >= start, "First listener should fire after start");
// FIXME: The timer filtering code makes the refresh driver call back in 0ms
// sometimes!
ok(secondListenerTime >= firstListenerTime,
"Second listener should fire after first listener");
SimpleTest.finish();
}
function firstListener(time) {
firstListenerTime = time;
mozRequestAnimationFrame(secondListener);
}
addLoadEvent(function() {
setTimeout(function() {
mozRequestAnimationFrame(firstListener);
}, 100);
});
</script>
</pre>
</body>
</html>