Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-animated.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-animated.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-animated.html |
| index 454f9400818d6ad599731609a718ae38846fddb1..d084c29f77f8d4e66f3339de068a448494e4c235 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-animated.html |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-animated.html |
| @@ -1,44 +1,29 @@ |
| -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| -<html> |
| - <head> |
| - <script src="../../resources/js-test.js"></script> |
| - </head> |
| - <body onload="javascript:ready()"> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| - <!-- This image is an animated GIF (1px by 1px). Animation time is 0ms. First frame has the color rgb(64, 4, 30). The second one has the color rgb(10, 153, 30) --> |
| - <img id="image" src="data:image/gif;base64,R0lGODlhAQABAIACAEAEHgqZHiH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAkAAAEALAAAAAABAAEAAAICRAEAIfkECAAA/wAsAAAAAAEAAQAAAgJMAQA7" alt="Animated Image" /> |
| - <canvas id="canvas" width="1" height="1"></canvas> |
| +<body onload="javascript:ready()"> |
| - <script> |
| - description("When drawing an animated image to a canvas, the poster frame (or the first frame) should be printed.<br/>This test passes if the canvas is filled with the color rgb(64, 4, 30)."); |
| +<!-- This image is an animated GIF (1px by 1px). Animation time is 0ms. First frame has the color rgb(64, 4, 30). The second one has the color rgb(10, 153, 30) --> |
| +<img id="image" src="data:image/gif;base64,R0lGODlhAQABAIACAEAEHgqZHiH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAkAAAEALAAAAAABAAEAAAICRAEAIfkECAAA/wAsAAAAAAEAAQAAAgJMAQA7" alt="Animated Image" /> |
| - if (window.testRunner) { |
| - testRunner.waitUntilDone(); |
| - } |
| +<canvas id="canvas" width="1" height="1"></canvas> |
| +<script> |
| +function ready() { |
| + var canvas = document.getElementById("canvas"); |
| + var image = document.getElementById("image"); |
| - function ready() { |
| - var canvas = document.getElementById("canvas"); |
| - var image = document.getElementById("image"); |
| + var canvasContext = canvas.getContext("2d"); |
| - var canvasContext = canvas.getContext("2d"); |
| + test(function(t) { |
|
Justin Novosad
2017/02/09 20:32:01
Test may quit before this runs. Please keep this
zakerinasab
2017/02/13 16:25:19
Done.
|
| + canvasContext.drawImage(image, 0, 0); |
| - window.setTimeout(function() { |
| + imageData = canvasContext.getImageData(0, 0, 1, 1); |
| - canvasContext.drawImage(image, 0, 0); |
| - |
| - imageData = canvasContext.getImageData(0, 0, 1, 1); |
| - |
| - shouldBe("imageData.data[0]", "64"); |
| - shouldBe("imageData.data[1]", "4"); |
| - shouldBe("imageData.data[2]", "30"); |
| - |
| - if (window.testRunner) |
| - testRunner.notifyDone(); |
| - |
| - }, 200); |
| - } |
| - </script> |
| - |
| - </body> |
| -</html> |
| + assert_equals(imageData.data[0], 64); |
| + assert_equals(imageData.data[1], 4); |
| + assert_equals(imageData.data[2], 30); |
| + }, 'When drawing an animated image to a canvas, the poster frame (or the first frame) should be printed. This test passes if the canvas is filled with the color rgb(64, 4, 30).'); |
| +} |
| +</script> |
| +</body> |