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

Side by Side Diff: LayoutTests/fast/canvas/toDataURL-supportedTypes.html

Issue 1302423004: Support lossy and lossless <canvas>.toDataURL for webp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing. Created 5 years, 3 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 <html> 1 <html>
2 <head> 2 <head>
3 <style> 3 <style>
4 img { border: 1px solid black; } 4 img { border: 1px solid black; }
5 pre { display: inline-block; margin: 5px; } 5 pre { display: inline-block; margin: 5px; }
6 </style> 6 </style>
7 <script> 7 <script>
8 if (window.testRunner) 8 if (window.testRunner)
9 testRunner.dumpAsText(); 9 testRunner.dumpAsText();
10 10
11 function draw() 11 function draw()
12 { 12 {
13 var canvas = document.getElementById("canvas"); 13 var canvas = document.getElementById("canvas");
14 var ctx = canvas.getContext("2d"); 14 var ctx = canvas.getContext("2d");
15 15
16 ctx.fillStyle = "rgb(200,0,0)"; 16 ctx.fillStyle = "rgb(200,0,0)";
17 ctx.fillRect(10, 10, 55, 50); 17 ctx.fillRect(10, 10, 55, 50);
18 ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; 18 ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
19 ctx.fillRect(30, 30, 55, 50); 19 ctx.fillRect(30, 30, 55, 50);
20 20
21 testToDataURL(); 21 testToDataURL();
22 } 22 }
23 23
24 // Default list of supported image formats. 24 // Default list of supported image formats.
25 var supportedMIMETypes = [ 25 var supportedMIMETypes = [
26 "image/png", 26 "image/png",
27 "image/jpeg", 27 "image/jpeg",
28 "image/gif", 28 "image/webp",
29 "image/webp.ll",
29 ]; 30 ];
30 31
31 function testToDataURL() 32 function testToDataURL()
32 { 33 {
33 // Test supported MIME types 34 // Test supported image formats.
34 for (var i in supportedMIMETypes) { 35 for (var i in supportedMIMETypes) {
35 testMIMEType(supportedMIMETypes[i]); 36 testMIMEType(supportedMIMETypes[i]);
36 } 37 }
37 38
38 // Test no MIME type 39 // Test invalid format type arguments.
39 testMIMEType(); 40 testMIMEType();
40 testMIMEType(null); 41 testMIMEType(null);
41 testMIMEType(undefined); 42 testMIMEType(undefined);
42 43
43 // Test other formats that we don't support 44 // Test other formats that we don't support.
45 testMIMEType("image/gif");
44 testMIMEType("image/x-webkitbitmap"); 46 testMIMEType("image/x-webkitbitmap");
45 } 47 }
46 48
47 function testMIMEType(mime) 49 function testMIMEType(mime)
48 { 50 {
49 var canvas = document.getElementById("canvas"); 51 var canvas = document.getElementById("canvas");
50 52
51 var hadArgument = arguments.length; 53 var hadArgument = arguments.length;
52 var url; 54 var url;
53 if (!hadArgument) 55 if (!hadArgument)
(...skipping 15 matching lines...) Expand all
69 71
70 document.body.appendChild(info); 72 document.body.appendChild(info);
71 document.body.appendChild(document.createElement("hr")); 73 document.body.appendChild(document.createElement("hr"));
72 } 74 }
73 </script> 75 </script>
74 </head> 76 </head>
75 <body onload="draw();"> 77 <body onload="draw();">
76 <canvas id="canvas" width="150" height="150"></canvas> The Actual Canvas <br ><hr> 78 <canvas id="canvas" width="150" height="150"></canvas> The Actual Canvas <br ><hr>
77 </body> 79 </body>
78 </html> 80 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698