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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-defaultpng.html

Issue 1614173002: Removal all idle-task implementations in toBlob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased with master Created 4 years, 11 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
(Empty)
1 <script src = "../../../resources/js-test.js"></script>
2 <script type = 'text/javascript'>
3 jsTestIsAsync = true;
4 description("Test that verifies whether the image data survives the toBlob proce ss after async image encoding");
5
6 if (window.testRunner) {
7 testRunner.waitUntilDone();
8 }
9
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");
16
17 var newImg = new Image();
18 newImg.onload = function() {
19 // 300x150 is the default size of the canvas, which is the source of the new Img.
20 ctx2.drawImage(newImg, 0, 0, 300, 150);
21
22 var imageData1 = ctx.getImageData(0, 0, 150, 75).data;
23 var imageData2 = ctx2.getImageData(0, 0, 150, 75).data;
24 var imageMatched = true;
25 for (var i = 1; i < imageData1.length; i++)
26 {
27 if (imageData1[i]!=imageData2[i])
28 {
29 imageMatched = false;
30 break;
31 }
32 }
33 if (imageMatched)
34 testPassed("image data survives through the toBlob and PNG Image encoder ");
35 else
36 testFailed("image data does not survive through the toBlob and PNG Image encoder");
37
38 finishJSTest();
39 }
40
41 canvas.toBlob(function(blob) {
42 url = URL.createObjectURL(blob);
43 newImg.src = url;
44 });
45
46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698