/image/test/reftest/apng/delaytest.html

http://github.com/zpao/v8monkey · HTML · 41 lines · 35 code · 6 blank · 0 comment · 0 complexity · c2c4268599183cf2a973bf0fc1013e50 MD5 · raw file

  1. <!DOCTYPE HTML>
  2. <html class="reftest-wait">
  3. <head>
  4. <title>Delayed image reftest wrapper</title>
  5. </head>
  6. <body>
  7. <img id="image1">
  8. <script>
  9. // This loads a externally specified image, forces a draw (in case of
  10. // decode-on-draw), waits 100ms, and then triggers the reftest snapshot.
  11. // This allows the animation on the page to complete.
  12. //
  13. // Use as "delaytest.html?animation.png"
  14. //
  15. // Get the image URL from our URL
  16. var imgURL = document.location.search.substr(1);
  17. // Load the image
  18. var img = document.images[0];
  19. img.src = imgURL;
  20. img.onload = forceDecode;
  21. function forceDecode() {
  22. // We need to force drawing of the image in an invisible context
  23. var canvas = document.createElement("canvas");
  24. var ctx = canvas.getContext("2d");
  25. ctx.drawImage(img, 0, 0);
  26. // We've force the decode. start the timer to trigger the reftest
  27. startTimer();
  28. }
  29. function startTimer() {
  30. const delay = 100;
  31. setTimeout("document.documentElement.className = '';", delay);
  32. }
  33. </script>
  34. </body>
  35. </html>