layout/base/tests/test_bug569520.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=569520
     5 -->
     6 <head>
     7   <title>Test for Bug 569520</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=569520">Mozilla Bug 569520</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 569520 **/
    21 SimpleTest.waitForExplicitFinish();
    23 var startNow = Date.now();
    24 var start = window.mozAnimationStartTime;
    25 var firstListenerArg;
    26 var secondListenerArg;
    27 var thirdListenerTime;
    29 // callback arg is wallclock from mozRequestAnimationFrame
    30 function thirdListener(t) {
    31   thirdListenerTime = t;
    33   // They really shouldn't be more than 100ms apart, but we can get weird
    34   // effects on slow machines.  5 minutes is our test timeout, though.
    35   ok(Math.abs(startNow - start) <= 5 * 60 * 1000, "Bogus animation start time");
    37   ok(secondListenerArg >= firstListenerArg, // callback args from consecutive unprefixed requestAnimationFrame
    38      "Second listener should fire after first listener");
    40   ok(thirdListenerTime >= start, "Third listener should fire after start");
    42   SimpleTest.finish();
    43 }
    45 // callback arg is from requestAnimationFrame and comparable to performance.now()
    46 function secondListener(t) {
    47   secondListenerArg = t;
    48   mozRequestAnimationFrame(thirdListener);
    49 }
    51 function firstListener(t) {
    52   firstListenerArg = t;
    53   requestAnimationFrame(secondListener);
    54 }
    56 addLoadEvent(function() {
    57     setTimeout(function() {
    58       requestAnimationFrame(firstListener);
    59     }, 100);
    60   });
    65 </script>
    66 </pre>
    67 </body>
    68 </html>

mercurial