[chromium] Use WEBPImportPictureRGBX|BGRX to import picture data
[WebKit-https.git] / LayoutTests / fast / canvas / canvas-toDataURL-webp.html
1 <canvas id="canvas" width="64px" height="64px" style="display: none"></canvas>
2 <pre id="log"></pre>
3 <img id="result">
4 <script>
5 if (window.layoutTestController) {
6     window.layoutTestController.dumpAsText(pixelTest = true);
7     window.layoutTestController.waitUntilDone();
8 }
9
10 function webpDataURLTest()
11 {
12     var canvas = document.getElementById('canvas');
13     var context = canvas.getContext('2d');
14     context.drawImage(window.image, 0, 0, canvas.width, canvas.height);
15
16     var dataURL = canvas.toDataURL('image/webp', 0.8);
17     if (!dataURL.match(/^data:image\/webp[;,]/))
18         document.getElementById('log').textContent += "FAIL: canvas.toDataURL('image/webp') not supported";
19     else
20         document.getElementById('result').src = dataURL;
21
22     if (window.layoutTestController)
23         window.layoutTestController.notifyDone();
24 }
25
26 var image = new Image();
27 image.onload = webpDataURLTest;
28 image.src = 'resources/html5.png';
29 </script>