Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-toBlob-defaultpng.html
blobdb05ae61ebc512f107ff00f457472f30ca5aee99
1 <script src = "../../resources/js-test.js"></script>
2 <script type = 'text/javascript'>
3 description("Test that verifies whether the image data survives the toBlob process");
5 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.waitUntilDone();
10 var canvas = document.createElement("canvas");
11 var ctx = canvas.getContext("2d");
12 ctx.fillStyle = "#FF0000";
13 ctx.fillRect(0, 0, 150, 75);
14 var canvas2 = document.createElement("canvas");
15 var ctx2 = canvas2.getContext("2d");
17 var newImg = new Image();
18 newImg.onload = function() {
19 ctx2.drawImage(newImg, 0, 0, 150, 75);
20 //Randomly pick a pixel to check whether they match
21 shouldBe('ctx.getImageData(0, 0, 150, 75).data[4]', 'ctx2.getImageData(0, 0, 150, 75).data[4]');
22 if (window.testRunner)
23 testRunner.notifyDone();
26 canvas.toBlob(function(blob) {
27 url = URL.createObjectURL(blob);
28 newImg.src = url;
29 });
31 </script>