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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-large-pattern.html

Issue 2681423002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: 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-large-pattern.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-large-pattern.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-large-pattern.html
index 1ba4fa6af3d2f86239f0f596c519caca6fc96e28..d9d16dd240d91af925a056640da4ce600236eca8 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-large-pattern.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-large-pattern.html
@@ -1,47 +1,27 @@
-<!DOCTYPE HTML>
-<html>
-<body>
- <script src="../../resources/js-test.js"></script>
- <script type="text/javascript">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+// This test does not currently succeed because skia does not handle
+// canvases more than 32k pixels wide. For now, this test serves the
+// purpose of verifying that this use case does not crash the browser.
+// Crasher bug: crbug.com/281504
- description("Verifies createPattern using a source image that is a canvas 40k pixels wide.");
- // This test does not currently succeed because skia does not handle
- // canvases more than 32k pixels wide. For now, this test serves the
- // purpose of verifying that this use case does not crash the browser.
- // Crasher bug: crbug.com/281504
+test(function(t) {
+ var canvas = document.createElement('canvas');
+ canvas.width = 40000;
+ var context = canvas.getContext('2d');
+ context.fillStyle = '#0f0';
+ context.fillRect(0, 0, 1, 1);
- var canvas = document.createElement('canvas');
- canvas.width = 40000;
- var context = canvas.getContext('2d');
- context.fillStyle = '#0f0';
- context.fillRect(0, 0, 1, 1);
+ var dstCanvas = document.createElement('canvas');
+ var dstContext = dstCanvas.getContext('2d');
+ var pattern = dstContext.createPattern(canvas, 'repeat');
+ dstContext.fillStyle = pattern;
+ dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height);
- var dstCanvas = document.createElement('canvas');
- var dstContext = dstCanvas.getContext('2d');
- var pattern = dstContext.createPattern(canvas, 'repeat');
- dstContext.fillStyle = pattern;
- dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height);
-
- var imageData = dstContext.getImageData(0, 0, 1, 1);
- var imgdata = imageData.data;
- shouldBe("imgdata[0]", "0");
- shouldBe("imgdata[1]", "255");
- shouldBe("imgdata[2]", "0");
- shouldBe("imgdata[3]", "255");
-
- imageData = dstContext.getImageData(1, 0, 1, 1);
- imgdata = imageData.data;
- shouldBe("imgdata[0]", "0");
- shouldBe("imgdata[1]", "0");
- shouldBe("imgdata[2]", "0");
- shouldBe("imgdata[3]", "0");
-
- imageData = dstContext.getImageData(0, 1, 1, 1);
- imgdata = imageData.data;
- shouldBe("imgdata[0]", "0");
- shouldBe("imgdata[1]", "0");
- shouldBe("imgdata[2]", "0");
- shouldBe("imgdata[3]", "0");
- </script>
-</body>
-</html>
+ //assert_array_equals(dstContext.getImageData(0, 0, 1, 1).data, [0, 255, 0, 255]);
Justin Novosad 2017/02/16 15:41:56 Why are these commented-out? Without theses assert
zakerinasab 2017/02/16 18:12:40 I removed some comment tags. The thing is that thi
+ //assert_array_equals(dstContext.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0]);
+ //assert_array_equals(dstContext.getImageData(0, 1, 1, 1).data, [0, 0, 0, 0]);
+
+}, 'Tests createPattern using a source image that is a canvas 40k pixels wide.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698