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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability.html

Issue 2251493003: Adding nullability support to ImageBitmapRenderingContext.transferImageBitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments from patch set 1. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability.html b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability.html
new file mode 100644
index 0000000000000000000000000000000000000000..7bdf714b2aa70668fee2da683f310271ebd58ee3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<canvas id = 'dstCanvas' width='100' height='100'></canvas>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+
+function testCanvasReset(ctx) {
+ var colorData = ctx.getImageData(50, 50, 1, 1).data;
Justin Novosad 2016/08/16 20:52:07 This test is going to crash. There is no 'getImage
zakerinasab 2016/08/17 20:39:28 Corrected.
+ assert_equals(colorData[0], 0);
+ assert_equals(colorData[1], 0);
+ assert_equals(colorData[2], 0);
+ assert_equals(colorData[3], 0);
+}
+
+function testCanvas_0f0(ctx) {
+ var colorData = ctx.getImageData(50, 50, 1, 1).data;
Justin Novosad 2016/08/16 20:52:07 Same here
zakerinasab 2016/08/17 20:39:28 Acknowledged.
+ assert_equals(colorData[0], 0);
+ assert_equals(colorData[1], 255);
+ assert_equals(colorData[2], 0);
+ assert_equals(colorData[3], 255);
+}
+
+function testNullParameterTransferFromImageBitmap(image) {
+ var dstCanvas = document.getElementById('dstCanvas');
+ var dstCtx = dstCanvas.getContext('bitmaprenderer');
+ dstCtx.transferFromImageBitmap(image);
+ testCanvas_0f0(ctx);
+ //Calling transferFromImageBitmap(null) must reset dstCtx
+ dstCtx.transferFromImageBitmap(null);
+ testCanvasReset(dstCtx);
+}
+
+test(function() {
+ var canvas = document.createElement('canvas');
+ canvas.width = canvas.height = 100;
+ var ctx = canvas.getContext('2d');
+ testCanvasReset(ctx);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 100);
+ testCanvas_0f0(ctx);
+
+ createImageBitmap(canvas).then(testNullParameterTransferFromImageBitmap);
Justin Novosad 2016/08/16 20:52:07 The test will end before testNullParameterTransfer
zakerinasab 2016/08/17 20:39:28 Acknowledged.
+}, 'testNullParameterTransferFromImageBitmap should not return any error');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698