tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_request_animation_frame.html (993B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <title>Test RequestAnimationFrame Timestamps are monotonically increasing</title>
      4 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      6 <script>
      7  var lastRequestAnimationFrameTimestamp = 0;
      8  var requestAnimationFrameCount = 20;
      9  var currentCount = 0;
     10 
     11  // Test that all timestamps are always increasing
     12  // and do not ever go backwards
     13  function rafCallback(aTimestamp) {
     14    SimpleTest.ok(aTimestamp > lastRequestAnimationFrameTimestamp,
     15      "New RequestAnimationFrame timestamp should be later than the previous RequestAnimationFrame timestamp");
     16    lastRequestAnimationFrameTimestamp = aTimestamp;
     17    if (currentCount == requestAnimationFrameCount) {
     18      SimpleTest.finish();
     19    } else {
     20      currentCount++;
     21      window.requestAnimationFrame(rafCallback);
     22    }
     23  }
     24 
     25  window.requestAnimationFrame(rafCallback);
     26  SimpleTest.waitForExplicitFinish();
     27 </script>