layout/base/tests/test_bug569520.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug569520.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=569520
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 569520</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=569520">Mozilla Bug 569520</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 569520 **/
    1.24 +SimpleTest.waitForExplicitFinish();
    1.25 +
    1.26 +var startNow = Date.now();
    1.27 +var start = window.mozAnimationStartTime;
    1.28 +var firstListenerArg;
    1.29 +var secondListenerArg;
    1.30 +var thirdListenerTime;
    1.31 +
    1.32 +// callback arg is wallclock from mozRequestAnimationFrame
    1.33 +function thirdListener(t) {
    1.34 +  thirdListenerTime = t;
    1.35 +
    1.36 +  // They really shouldn't be more than 100ms apart, but we can get weird
    1.37 +  // effects on slow machines.  5 minutes is our test timeout, though.
    1.38 +  ok(Math.abs(startNow - start) <= 5 * 60 * 1000, "Bogus animation start time");
    1.39 +
    1.40 +  ok(secondListenerArg >= firstListenerArg, // callback args from consecutive unprefixed requestAnimationFrame
    1.41 +     "Second listener should fire after first listener");
    1.42 +
    1.43 +  ok(thirdListenerTime >= start, "Third listener should fire after start");
    1.44 +
    1.45 +  SimpleTest.finish();
    1.46 +}
    1.47 +
    1.48 +// callback arg is from requestAnimationFrame and comparable to performance.now()
    1.49 +function secondListener(t) {
    1.50 +  secondListenerArg = t;
    1.51 +  mozRequestAnimationFrame(thirdListener);
    1.52 +}
    1.53 +
    1.54 +function firstListener(t) {
    1.55 +  firstListenerArg = t;
    1.56 +  requestAnimationFrame(secondListener);
    1.57 +}
    1.58 +
    1.59 +addLoadEvent(function() {
    1.60 +    setTimeout(function() {
    1.61 +      requestAnimationFrame(firstListener);
    1.62 +    }, 100);
    1.63 +  });
    1.64 +
    1.65 +
    1.66 +
    1.67 +
    1.68 +</script>
    1.69 +</pre>
    1.70 +</body>
    1.71 +</html>

mercurial