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

Side by Side Diff: third_party/WebKit/LayoutTests/virtual/threaded/fast/canvas-toBlob/canvas-createImageBitmap-from-canvas-toBlob.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 <!DOCTYPE html>
2 <script src="../../../../resources/js-test.js"></script>
3 <script>
4 jsTestIsAsync = true;
5
6 description("Tests that createImageBitmap from a canvas.toBlob object should hav e the same pixel data as the blob.");
7
8 var imageData2;
9 var imageData3;
10
11 var canvas1 = document.createElement("canvas");
12 var ctx1 = canvas1.getContext("2d");
13 ctx1.fillStyle = "#FF0000";
14 ctx1.fillRect(0, 0, 150, 75);
15
16 var newImg = new Image();
17 newImg.onload = function() {
18 var canvas3 = document.createElement("canvas");
19 var ctx3 = canvas3.getContext("2d");
20 ctx3.drawImage(newImg, 0, 0, 150, 75);
21
22 imageData3 = ctx3.getImageData(0, 0, 150, 75).data;
23 var imageMatched = true;
24 for (var i = 1; i < imageData2.length; i++) {
25 if (imageData2[i] != imageData3[i]) {
26 imageMatched = false;
27 break;
28 }
29 }
30 if (imageMatched)
31 testPassed("image data from the created ImageBitmap and the originated b lob is the same");
32 else
33 testFailed("image data from the created ImageBitmap and the originated b lob is NOT the same");
34 finishJSTest();
35 }
36
37 canvas1.toBlob(function(blob) {
38 createImageBitmap(blob).then(imageBitmap => {
39 var canvas2 = document.createElement("canvas");
40 var ctx2 = canvas2.getContext("2d");
41 ctx2.drawImage(imageBitmap, 0, 0, 150, 75);
42 imageData2 = ctx2.getImageData(0, 0, 150, 75).data;
43 url = URL.createObjectURL(blob);
44 newImg.src = url;
45 });
46 });
47 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698