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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <script src="../../resources/testharness.js"></script>
2 <script src="../../resources/testharnessreport.js"></script>
3
2 <canvas id="mycanvas"><button id="button"></button></canvas> 4 <canvas id="mycanvas"><button id="button"></button></canvas>
3 <script src="../../resources/js-test.js"></script>
4 <script> 5 <script>
5 description("This tests verifies that canvas API calls on a canvas with no backi ng or no visibility do not crash or throw exceptions.");
6
7 if (window.testRunner) {
8 testRunner.dumpAsText();
9 }
10
11 var canvas = document.getElementById('mycanvas'); 6 var canvas = document.getElementById('mycanvas');
12 var ctx = canvas.getContext('2d'); 7 var ctx = canvas.getContext('2d');
13 var button = document.getElementById('button'); 8 var button = document.getElementById('button');
14 button.focus(); 9 button.focus();
15 10
16 function testAPICalls() { 11 function testAPICalls() {
17 try { 12 ctx.beginPath();
18 ctx.beginPath(); 13 ctx.rect(0, 0, 10, 10);
19 ctx.rect(0, 0, 10, 10); 14 ctx.fill();
20 ctx.fill(); 15 ctx.stroke();
21 ctx.stroke(); 16 ctx.drawFocusIfNeeded(button);
22 ctx.drawFocusIfNeeded(button); 17 ctx.isPointInPath(0,0);
23 ctx.isPointInPath(0,0); 18 ctx.isPointInStroke(0,0);
24 ctx.isPointInStroke(0,0); 19 ctx.clearRect(0, 0, 5, 5);
25 ctx.clearRect(0, 0, 5, 5); 20 ctx.fillRect(0, 0, 5, 5);
26 ctx.fillRect(0, 0, 5, 5); 21 ctx.strokeRect(0, 0, 5, 5);
27 ctx.strokeRect(0, 0, 5, 5); 22 ctx.scrollPathIntoView();
28 ctx.scrollPathIntoView(); 23 data = ctx.createImageData(5, 5);
29 data = ctx.createImageData(5, 5); 24 ctx.putImageData(data, 0, 0);
30 ctx.putImageData(data, 0, 0); 25 ctx.font = "20px arial";
31 ctx.font = "20px arial"; 26 ctx.fillText("Test", 20, 20);
32 ctx.fillText("Test", 20, 20); 27 ctx.strokeText("Test", 20, 20);
33 ctx.strokeText("Test", 20, 20); 28 ctx.measureText("Test");
34 » ctx.measureText("Test"); 29 ctx.clip();
35 ctx.clip(); 30 ctx.drawImage(canvas, 0, 0);
36 ctx.drawImage(canvas, 0, 0); 31 ctx.getImageData(0, 0, 5, 5);
37 ctx.getImageData(0, 0, 5, 5); 32 canvas.toDataURL();
38 canvas.toDataURL();
39 } catch(err) {
40 testFailed("Unexpected exception.");
41 }
42 } 33 }
43 34
44 // First pass: normal conditions 35 test(function(){
45 testAPICalls();
46 36
47 // Test a zero size canvas 37 // First pass: normal conditions
48 canvas.width = 0; 38 testAPICalls();
49 testAPICalls();
50 39
51 // Test a canvas so large that it has no chance of successful allocating a backi ng 40 // Test a zero size canvas
52 canvas.width = 10000000; 41 canvas.width = 0;
53 canvas.height = 10000000; 42 testAPICalls();
54 testAPICalls();
55 43
56 // Test a canvas that is valid, but detached from the DOM 44 // Test a canvas so large that it has no chance of successful allocating a b acking
57 canvas.width = 100; 45 canvas.width = 10000000;
58 canvas.height = 100; 46 canvas.height = 10000000;
59 canvas.remove(); 47 testAPICalls();
60 testAPICalls();
61 48
49 // Test a canvas that is valid, but detached from the DOM
50 canvas.width = 100;
51 canvas.height = 100;
52 canvas.remove();
53 testAPICalls();
54
55 }, "Verify that canvas API calls on a canvas with no backing or no visibility do not crash or throw exceptions.");
62 </script> 56 </script>
OLDNEW
« 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