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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-broken-image.html

Issue 2700823002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 years, 9 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
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <script src="../../resources/testharness.js"></script>
2 <html> 2 <script src="../../resources/testharnessreport.js"></script>
3 <head> 3
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <script> 4 <script>
7 window.jsTestIsAsync = true;
8 description("This test checks behavior of Canvas::drawImage with a broken so urce image.");
9 5
10 // Create an image with invalid data. 6 // Create an image with invalid data.
11 var invalidImage = new Image(); 7 var invalidImage = new Image();
12 invalidImage.src = 'resources/shadow-offset.js'; 8 invalidImage.src = 'resources/shadow-offset.js';
13 invalidImage.onerror = draw;
14 9
15 var ctx = document.createElement("canvas").getContext('2d'); 10 var ctx = document.createElement("canvas").getContext('2d');
16 function draw() { 11 function draw() {
17 // null and undefined images should throw TypeError 12 // null and undefined images should throw TypeError
18 shouldThrow("ctx.drawImage(null, 0, 0)"); 13 assert_throws(null, function() {ctx.drawImage(null, 0, 0)});
19 shouldThrow("ctx.drawImage(null, 0, 0, 20, 20)"); 14 assert_throws(null, function() {ctx.drawImage(null, 0, 0, 20, 20)});
20 shouldThrow("ctx.drawImage(null, 0, 0, 20, 20, 0, 0, 20, 20)"); 15 assert_throws(null, function() {ctx.drawImage(null, 0, 0, 20, 20, 0, 0, 20, 20)});
21 shouldThrow("ctx.drawImage(undefined, 0, 0)"); 16 assert_throws(null, function() {ctx.drawImage(undefined, 0, 0)});
22 shouldThrow("ctx.drawImage(undefined, 0, 0, 20, 20)"); 17 assert_throws(null, function() {ctx.drawImage(undefined, 0, 0, 20, 20)});
23 shouldThrow("ctx.drawImage(undefined, 0, 0, 20, 20, 0, 0, 20, 20)"); 18 assert_throws(null, function() {ctx.drawImage(undefined, 0, 0, 20, 20, 0, 0, 20, 20)});
24 19
25 // broken images should not throw 20 // broken images should not throw
26 shouldThrow("ctx.drawImage(invalidImage, 0, 0)"); 21 assert_throws(null, function() {ctx.drawImage(invalidImage, 0, 0)});
27 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 20, 20)"); 22 assert_throws(null, function() {ctx.drawImage(invalidImage, 0, 0, 20, 20)});
28 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 20, 20, 0, 0, 20, 20)"); 23 assert_throws(null, function() {ctx.drawImage(invalidImage, 0, 0, 20, 20, 0, 0, 20, 20)});
29 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 0, 20)"); 24 assert_throws(null, function() {ctx.drawImage(invalidImage, 0, 0, 0, 20)});
30 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 0, 20, 0, 0, 20, 20)"); 25 assert_throws(null, function() {ctx.drawImage(invalidImage, 0, 0, 0, 20, 0, 0, 20, 20)});
26 }
27
28 async_test(t => {
29 invalidImage.onerror = function() {
30 t.step(draw);
31 t.done();
32 }
33 }, "This test checks behavior of Canvas::drawImage with a broken source image.") ;
31 34
32 finishJSTest();
33 }
34 </script> 35 </script>
35 </body> 36 </body>
36 </html> 37 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698