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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.html b/third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.html
index 8044178c7e45f99a0744399d30b478a0388a9a27..6ce3212b9111b0644edff40b2613ddef74051454 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.html
@@ -1,62 +1,56 @@
-<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
<canvas id="mycanvas"><button id="button"></button></canvas>
-<script src="../../resources/js-test.js"></script>
<script>
-description("This tests verifies that canvas API calls on a canvas with no backing or no visibility do not crash or throw exceptions.");
-
-if (window.testRunner) {
- testRunner.dumpAsText();
-}
-
var canvas = document.getElementById('mycanvas');
var ctx = canvas.getContext('2d');
var button = document.getElementById('button');
button.focus();
function testAPICalls() {
- try {
- ctx.beginPath();
- ctx.rect(0, 0, 10, 10);
- ctx.fill();
- ctx.stroke();
- ctx.drawFocusIfNeeded(button);
- ctx.isPointInPath(0,0);
- ctx.isPointInStroke(0,0);
- ctx.clearRect(0, 0, 5, 5);
- ctx.fillRect(0, 0, 5, 5);
- ctx.strokeRect(0, 0, 5, 5);
- ctx.scrollPathIntoView();
- data = ctx.createImageData(5, 5);
- ctx.putImageData(data, 0, 0);
- ctx.font = "20px arial";
- ctx.fillText("Test", 20, 20);
- ctx.strokeText("Test", 20, 20);
- ctx.measureText("Test");
- ctx.clip();
- ctx.drawImage(canvas, 0, 0);
- ctx.getImageData(0, 0, 5, 5);
- canvas.toDataURL();
- } catch(err) {
- testFailed("Unexpected exception.");
- }
+ ctx.beginPath();
+ ctx.rect(0, 0, 10, 10);
+ ctx.fill();
+ ctx.stroke();
+ ctx.drawFocusIfNeeded(button);
+ ctx.isPointInPath(0,0);
+ ctx.isPointInStroke(0,0);
+ ctx.clearRect(0, 0, 5, 5);
+ ctx.fillRect(0, 0, 5, 5);
+ ctx.strokeRect(0, 0, 5, 5);
+ ctx.scrollPathIntoView();
+ data = ctx.createImageData(5, 5);
+ ctx.putImageData(data, 0, 0);
+ ctx.font = "20px arial";
+ ctx.fillText("Test", 20, 20);
+ ctx.strokeText("Test", 20, 20);
+ ctx.measureText("Test");
+ ctx.clip();
+ ctx.drawImage(canvas, 0, 0);
+ ctx.getImageData(0, 0, 5, 5);
+ canvas.toDataURL();
}
-// First pass: normal conditions
-testAPICalls();
+test(function(){
+
+ // First pass: normal conditions
+ testAPICalls();
-// Test a zero size canvas
-canvas.width = 0;
-testAPICalls();
+ // Test a zero size canvas
+ canvas.width = 0;
+ testAPICalls();
-// Test a canvas so large that it has no chance of successful allocating a backing
-canvas.width = 10000000;
-canvas.height = 10000000;
-testAPICalls();
+ // Test a canvas so large that it has no chance of successful allocating a backing
+ canvas.width = 10000000;
+ canvas.height = 10000000;
+ testAPICalls();
-// Test a canvas that is valid, but detached from the DOM
-canvas.width = 100;
-canvas.height = 100;
-canvas.remove();
-testAPICalls();
+ // Test a canvas that is valid, but detached from the DOM
+ canvas.width = 100;
+ canvas.height = 100;
+ canvas.remove();
+ testAPICalls();
+}, "Verify that canvas API calls on a canvas with no backing or no visibility do not crash or throw exceptions.");
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698