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> |