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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html

Issue 2695963004: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Fixing canvas-text-ideographic-space.html to pass on Mac trybots 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-toBlob-defaultpng.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html
index 14cab6668d827a04063b0ca7f3104b443a399f32..1cd192382cd528deef2702389d5a174f090440b7 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html
@@ -1,47 +1,38 @@
-<script src = "../../resources/js-test.js"></script>
-<script type = 'text/javascript'>
-jsTestIsAsync = true;
-description("Test that verifies whether the image data survives the toBlob process after async image encoding");
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
-if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
-}
+<script>
+async_test(t => {
+
+ var canvas = document.createElement("canvas");
+ var ctx = canvas.getContext("2d");
+ ctx.fillStyle = "#FF0000";
+ ctx.fillRect(0, 0, 150, 75);
+ var canvas2 = document.createElement("canvas");
+ var ctx2 = canvas2.getContext("2d");
+
+ var newImg = new Image();
+ newImg.onload = function() {
+ // 300x150 is the default size of the canvas, which is the source of the newImg.
+ ctx2.drawImage(newImg, 0, 0, 300, 150);
-var canvas = document.createElement("canvas");
-var ctx = canvas.getContext("2d");
-ctx.fillStyle = "#FF0000";
-ctx.fillRect(0, 0, 150, 75);
-var canvas2 = document.createElement("canvas");
-var ctx2 = canvas2.getContext("2d");
-
-var newImg = new Image();
-newImg.onload = function() {
- // 300x150 is the default size of the canvas, which is the source of the newImg.
- ctx2.drawImage(newImg, 0, 0, 300, 150);
-
- var imageData1 = ctx.getImageData(0, 0, 150, 75).data;
- var imageData2 = ctx2.getImageData(0, 0, 150, 75).data;
- var imageMatched = true;
- for (var i = 1; i < imageData1.length; i++)
- {
- if (imageData1[i]!=imageData2[i])
- {
- imageMatched = false;
- break;
- }
+ var imageData1 = ctx.getImageData(0, 0, 150, 75).data;
+ var imageData2 = ctx2.getImageData(0, 0, 150, 75).data;
+ var imageMatched = true;
+ for (var i = 1; i < imageData1.length; i++)
+ if (imageData1[i]!=imageData2[i])
+ {
+ imageMatched = false;
+ break;
+ }
+ assert_true(imageMatched);
+ t.done();
}
- if (imageMatched)
- testPassed("image data survives through the toBlob and PNG Image encoder");
- else
- testFailed("image data does not survive through the toBlob and PNG Image encoder");
-
- finishJSTest();
-}
-
-canvas.toBlob(function(blob) {
- url = URL.createObjectURL(blob);
- newImg.src = url;
-});
-
+
+ canvas.toBlob(function(blob) {
+ url = URL.createObjectURL(blob);
+ newImg.src = url;
+ });
+
+}, "Verify whether the image data survives the toBlob process after async image encoding.");
</script>

Powered by Google App Engine
This is Rietveld 408576698