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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-before-css.html

Issue 2670353002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Corrections 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-before-css.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-before-css.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-before-css.html
index 51b562b5b75908ff1eccfbbb8de47acb09c57e21..d9feef797d25995b0821a562673fcda36ff230e1 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-before-css.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-before-css.html
@@ -2,12 +2,27 @@
<head>
<link rel="stylesheet" href="about:blank" type="text/css">
</head>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<canvas id="mycanvas" width="400" height="200"></canvas>
+
<body>
- <p>If the canvas below is black, then we managed to draw before loading stylesheets. Hooray!</p>
- <canvas id="mycanvas" width="400" height="200"></canvas>
- <script type="application/x-javascript">
- var canvas = document.getElementById("mycanvas");
- canvas.getContext("2d").fillRect(0, 0, canvas.width, canvas.height);
- </script>
+<script>
+test(function(t) {
+ var canvas = document.getElementById("mycanvas");
+ ctx = canvas.getContext("2d");
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+ checkPixel(25, 25, 0, 0, 0, 255);
+ checkPixel(75, 75, 0, 0, 0, 255);
+
+ function checkPixel(x, y, r, g, b, a) {
+ var data = ctx.getImageData(x,y,1,1).data;
Justin Novosad 2017/02/08 16:52:33 This is not correct. getImageData is independent o
zakerinasab 2017/02/08 19:04:10 Reverted.
+ assert_equals(data[0], r);
+ assert_equals(data[1], g);
+ assert_equals(data[2], b);
+ assert_equals(data[3], a);
+ }
+}, 'Tests if we can correctly draw before loading stylesheets.');
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698