blob: 260dccb6010bc5f95a1c0b43f2e3605bbefb934e [file] [log] [blame]
<canvas id="canvas" width="64px" height="64px" style="display: none"></canvas>
<pre id="log"></pre>
<img id="result">
<script>
if (window.layoutTestController) {
window.layoutTestController.dumpAsText(pixelTest = true);
window.layoutTestController.waitUntilDone();
}
function webpDataURLTest()
{
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
context.drawImage(window.image, 0, 0, canvas.width, canvas.height);
var dataURL = canvas.toDataURL('image/webp', 0.8);
if (!dataURL.match(/^data:image\/webp[;,]/))
document.getElementById('log').textContent += "FAIL: canvas.toDataURL('image/webp') not supported";
else
document.getElementById('result').src = dataURL;
if (window.layoutTestController)
window.layoutTestController.notifyDone();
}
var image = new Image();
image.onload = webpDataURLTest;
image.src = 'resources/html5.png';
</script>