Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / drawImage-with-broken-image.html
blobafb0f143f003c867e1a913439a8851b31a6082d7
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <script>
7 window.jsTestIsAsync = true;
8 description("This test checks behavior of Canvas::drawImage with a broken source image.");
10 // Create an image with invalid data.
11 var invalidImage = new Image();
12 invalidImage.src = 'resources/shadow-offset.js';
13 invalidImage.onerror = draw;
15 var ctx = document.createElement("canvas").getContext('2d');
16 function draw() {
17 // null and undefined images should throw TypeError
18 shouldThrow("ctx.drawImage(null, 0, 0)");
19 shouldThrow("ctx.drawImage(null, 0, 0, 20, 20)");
20 shouldThrow("ctx.drawImage(null, 0, 0, 20, 20, 0, 0, 20, 20)");
21 shouldThrow("ctx.drawImage(undefined, 0, 0)");
22 shouldThrow("ctx.drawImage(undefined, 0, 0, 20, 20)");
23 shouldThrow("ctx.drawImage(undefined, 0, 0, 20, 20, 0, 0, 20, 20)");
25 // broken images should not throw
26 shouldThrow("ctx.drawImage(invalidImage, 0, 0)");
27 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 20, 20)");
28 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 20, 20, 0, 0, 20, 20)");
29 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 0, 20)");
30 shouldThrow("ctx.drawImage(invalidImage, 0, 0, 0, 20, 0, 0, 20, 20)");
32 finishJSTest();
34 </script>
35 </body>
36 </html>