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

Unified Diff: LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html

Issue 1257253004: [HTMLCanvasElement.toBlob] Default callback version without scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: A small change from thread safe bind to common bind based on Kinuko's review Created 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html
diff --git a/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html b/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html
new file mode 100644
index 0000000000000000000000000000000000000000..db05ae61ebc512f107ff00f457472f30ca5aee99
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html
@@ -0,0 +1,31 @@
+<script src = "../../resources/js-test.js"></script>
+<script type = 'text/javascript'>
+description("Test that verifies whether the image data survives the toBlob process");
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+var canvas = document.createElement("canvas");
+var ctx = canvas.getContext("2d");
+ctx.fillStyle = "#FF0000";
+ctx.fillRect(0, 0, 150, 75);
+var canvas2 = document.createElement("canvas");
+var ctx2 = canvas2.getContext("2d");
+
+var newImg = new Image();
+newImg.onload = function() {
+ ctx2.drawImage(newImg, 0, 0, 150, 75);
+ //Randomly pick a pixel to check whether they match
Noel Gordon 2015/08/28 08:53:47 This doesn't appear to be random pixel pick (it al
xlai (Olivia) 2015/08/28 19:54:19 Acknowledged for randomized pixel picking.
+ shouldBe('ctx.getImageData(0, 0, 150, 75).data[4]', 'ctx2.getImageData(0, 0, 150, 75).data[4]');
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+canvas.toBlob(function(blob) {
+ url = URL.createObjectURL(blob);
+ newImg.src = url;
+});
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698