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

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

Issue 2189733003: Remove virtual test suits virtual/threaded/fast/canvas-toBlob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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.dumpAsText();
8 testRunner.waitUntilDone();
9 }
10
11 var canvas = document.createElement("canvas");
12 var ctx = canvas.getContext("2d");
13 ctx.fillStyle = "#FF0000";
14 ctx.fillRect(0, 0, 150, 75);
15 var canvas2 = document.createElement("canvas");
16 var ctx2 = canvas2.getContext("2d");
17
18 var newImg = new Image();
19 newImg.onload = function() {
20 // 300x150 is the default size of the canvas, which is the source of the new Img.
21 ctx2.drawImage(newImg, 0, 0, 300, 150);
22
23 var imageData1 = ctx.getImageData(0, 0, 150, 75).data;
24 var imageData2 = ctx2.getImageData(0, 0, 150, 75).data;
25 var imageMatched = true;
26 for (var i = 1; i < imageData1.length; i++)
27 {
28 if (imageData1[i]!=imageData2[i])
29 {
30 imageMatched = false;
31 break;
32 }
33 }
34 if (imageMatched)
35 testPassed("image data survives through the toBlob and PNG Image encoder ");
36 else
37 testFailed("image data does not survive through the toBlob and PNG Image encoder");
38
39 finishJSTest();
40 }
41
42 canvas.toBlob(function(blob) {
43 url = URL.createObjectURL(blob);
44 newImg.src = url;
45 });
46
47 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698