Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-animated.html

Issue 2674863003: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ae15679302b435459e37f3eaea7db9c4d1aaf51c 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,27 @@
-<!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>
+
+<script>
+async_test(t => {
+ window.onload = function() {
+ var canvas = document.getElementById("canvas");
+ var image = document.getElementById("image");
+ var canvasContext = canvas.getContext("2d");
+ t.step(function(){
+ canvasContext.drawImage(image, 0, 0);
+ imageData = canvasContext.getImageData(0, 0, 1, 1);
+ assert_equals(imageData.data[0], 64);
+ assert_equals(imageData.data[1], 4);
+ assert_equals(imageData.data[2], 30);
+ });
+ t.done();
+ }
+}, '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>
- <!-- 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>
-
- <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).");
-
- if (window.testRunner) {
- testRunner.waitUntilDone();
- }
-
-
- function ready() {
- var canvas = document.getElementById("canvas");
- var image = document.getElementById("image");
-
- var canvasContext = canvas.getContext("2d");
-
- window.setTimeout(function() {
-
- 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>

Powered by Google App Engine
This is Rietveld 408576698