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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/draw-focus-if-needed.html

Issue 2700823002: 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/draw-focus-if-needed.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/draw-focus-if-needed.html b/third_party/WebKit/LayoutTests/fast/canvas/draw-focus-if-needed.html
index 8bfb2ea3bfefca1cead0a7fbe0dd3cb2a3933937..394f4b98c85899c4f535df3abcd29187e0c07ce0 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/draw-focus-if-needed.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/draw-focus-if-needed.html
@@ -1,47 +1,47 @@
<!DOCTYPE HTML>
<head>
-<title>Canvas test: drawFocusIfNeeded</title>
-<script src="../../resources/js-test.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
</head>
-<body style="padding: 0; margin: 0">
<canvas id="canvas" class="output" width="300" height="350">
<button id="button1"></button>
<button id="button2"></button>
</canvas>
<script>
-if (window.testRunner)
- testRunner.dumpAsText();
+test(function(t) {
-document.getElementById("button1").focus();
-
-var canvas = document.getElementById("canvas").getContext("2d");
-
-shouldThrow('canvas.drawFocusIfNeeded(null);');
-shouldThrow('canvas.drawFocusIfNeeded();');
-
-canvas.beginPath();
-canvas.rect(50, 50, 200, 100);
-canvas.fillStyle = "#ccf";
-canvas.fill();
-// re-test null case after having defined a path (regression test for crbug.com/353248)
-shouldThrow('canvas.drawFocusIfNeeded(null);');
-canvas.drawFocusIfNeeded(document.getElementById("button1"));
-
-canvas.beginPath();
-canvas.rect(50, 200, 200, 100);
-canvas.fillStyle = "#cfc";
-canvas.fill();
-canvas.drawFocusIfNeeded(document.getElementById("button2"));
-
-// The top rect"s focus ring is tied to button1, which is focused.
-// It should have an outline in some color other than the background color.
-var imageData = canvas.getImageData(49, 50, 1, 1);
-var data = imageData.data;
-shouldBe("data[0] != 0 || data[1] != 0 || data[2] != 0", "true");
-
-// The bottom rect"s focus ring is tied to button2, which is not focused.
-imageData = canvas.getImageData(49, 200, 1, 1);
-data = imageData.data;
-shouldBe("data[0] == 0 && data[1] == 0 && data[2] == 0", "true");
+ document.getElementById("button1").focus();
+
+ var canvas = document.getElementById("canvas").getContext("2d");
+
+ assert_throws(null, function(){canvas.drawFocusIfNeeded(null);});
+ assert_throws(null, function(){canvas.drawFocusIfNeeded();});
+
+ canvas.beginPath();
+ canvas.rect(50, 50, 200, 100);
+ canvas.fillStyle = "#ccf";
+ canvas.fill();
+ // re-test null case after having defined a path (regression test for crbug.com/353248)
+ assert_throws(null, function(){canvas.drawFocusIfNeeded(null);});
+ canvas.drawFocusIfNeeded(document.getElementById("button1"));
+
+ canvas.beginPath();
+ canvas.rect(50, 200, 200, 100);
+ canvas.fillStyle = "#cfc";
+ canvas.fill();
+ canvas.drawFocusIfNeeded(document.getElementById("button2"));
+
+ // The top rect's focus ring is tied to button1, which is focused.
+ // It should have an outline in some color other than the background color.
+ var imageData = canvas.getImageData(49, 50, 1, 1);
+ var data = imageData.data;
+ assert_true(data[0] != 0 || data[1] != 0 || data[2] != 0);
+
+ // The bottom rect"s focus ring is tied to button2, which is not focused.
+ imageData = canvas.getImageData(49, 200, 1, 1);
+ data = imageData.data;
+ assert_true(data[0] == 0 && data[1] == 0 && data[2] == 0);
+
+}, 'Canvas test: drawFocusIfNeeded');
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698