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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/toDataURL-noData.html

Issue 2701053003: 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/toDataURL-noData.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/toDataURL-noData.html b/third_party/WebKit/LayoutTests/fast/canvas/toDataURL-noData.html
index 9fd5a85e19e457d3a6aeb6d2c00616d360deff9c..5cfc53afcc47a1d23ef050c39c5862556f5ae23e 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/toDataURL-noData.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/toDataURL-noData.html
@@ -1,64 +1,56 @@
-<html>
-<head>
- <script>
- if (window.testRunner)
- testRunner.dumpAsText();
-
- function log(msg)
- {
- document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
- }
-
- function testToDataURL()
- {
- var canvas1 = document.getElementById("zero-Zero")
- var canvas2 = document.getElementById("zero-oneHundred");
- var canvas3 = document.getElementById("oneHundred-zero");
-
- testMIMEType(canvas1, "0x0", undefined);
- testMIMEType(canvas2, "0x100", undefined);
- testMIMEType(canvas3, "100x0", undefined);
-
- testMIMEType(canvas1, "0x0" , "image/jpeg");
- testMIMEType(canvas2, "0x100", "image/jpeg");
- testMIMEType(canvas3, "100x0", "image/jpeg");
-
- testMIMEType(canvas1, "0x0" , "image/webp");
- testMIMEType(canvas2, "0x100", "image/webp");
- testMIMEType(canvas3, "100x0", "image/webp");
- }
-
- function testMIMEType(canvas, description, mimeType)
- {
- var ctx = canvas.getContext("2d");
-
- // draw into canvas
- ctx.fillStyle = "rgb(200,0,0)";
- ctx.fillRect(10, 10, 55, 50);
- ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
- ctx.fillRect(30, 30, 55, 50);
-
- var dataURL;
-
- if (mimeType == undefined) {
- dataURL = canvas.toDataURL();
- log("mimeType: unspecified");
- } else {
- dataURL = canvas.toDataURL(mimeType);
- log("mimeType: " + mimeType);
- }
-
- if (dataURL == "data:,")
- log("PASS: Canvas of size " + description + " created data: url with no content - '" + dataURL + "'.");
- else
- log("FAIL: Canvas of size " + description + " did not create a data: url with no content - '" + dataURL + "'.");
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<canvas id="zero-Zero" width="0" height="0"></canvas>
+<canvas id="zero-oneHundred" width="0" height="100"></canvas>
+<canvas id="oneHundred-zero" width="100" height="0"></canvas>
+
+<script>
+
+function testToDataURL()
+{
+ var canvas1 = document.getElementById("zero-Zero")
+ var canvas2 = document.getElementById("zero-oneHundred");
+ var canvas3 = document.getElementById("oneHundred-zero");
+
+ testMIMEType(canvas1, "0x0", undefined);
+ testMIMEType(canvas2, "0x100", undefined);
+ testMIMEType(canvas3, "100x0", undefined);
+
+ testMIMEType(canvas1, "0x0" , "image/jpeg");
+ testMIMEType(canvas2, "0x100", "image/jpeg");
+ testMIMEType(canvas3, "100x0", "image/jpeg");
+
+ testMIMEType(canvas1, "0x0" , "image/webp");
+ testMIMEType(canvas2, "0x100", "image/webp");
+ testMIMEType(canvas3, "100x0", "image/webp");
+}
+
+function testMIMEType(canvas, description, mimeType)
+{
+ var ctx = canvas.getContext("2d");
+
+ // draw into canvas
+ ctx.fillStyle = "rgb(200,0,0)";
+ ctx.fillRect(10, 10, 55, 50);
+ ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
+ ctx.fillRect(30, 30, 55, 50);
+
+ var dataURL;
+
+ if (mimeType == undefined) {
+ dataURL = canvas.toDataURL();
+ } else {
+ dataURL = canvas.toDataURL(mimeType);
+ }
+
+ assert_equals (dataURL, "data:,");
+}
+
+async_test(t => {
+ window.onload = function() {
+ t.step(testToDataURL);
+ t.done();
}
- </script>
-</head>
-<body onload="testToDataURL();">
- <canvas id="zero-Zero" width="0" height="0"></canvas>
- <canvas id="zero-oneHundred" width="0" height="100"></canvas>
- <canvas id="oneHundred-zero" width="100" height="0"></canvas>
- <pre id='console'></pre>
-</body>
-</html>
+}, 'Verify that the custom properties on a Canvas 2D rendering context object are retained across GCs.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698