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

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

Issue 2464093002: Revert of Consolidate implementation of ImageBitmapRenderingContext (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html
index 1c4979baa0dc8cf36cc39e4d15cab7c7f0e76f97..925ba43815a859f3138f6058a1b874e5dcbc1a94 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html
@@ -2,68 +2,37 @@
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
+
function testCanvas_0f0(ctx) {
- var colorData = ctx.getImageData(50, 50, 1, 1).data;
- assert_equals(colorData[0], 0);
- assert_equals(colorData[1], 255);
- assert_equals(colorData[2], 0);
- assert_equals(colorData[3], 255);
-}
-
-function testException(image) {
- var dstCanvas = document.createElement('canvas');
- dstCanvas.width = dstCanvas.height = 100;
- var dstCtx = dstCanvas.getContext('bitmaprenderer');
- assert_true(dstCtx instanceof ImageBitmapRenderingContext);
- dstCtx.transferFromImageBitmap(image);
-
- // image is detached after calling transferFromImageBitmap,
- // so call transferFromImageBitmap(image) should throw InvalidStateError
- assert_throws("InvalidStateError", function() {dstCtx.transferFromImageBitmap(image);});
+ var colorData = ctx.getImageData(50, 50, 1, 1).data;
+ assert_equals(colorData[0], 0);
+ assert_equals(colorData[1], 255);
+ assert_equals(colorData[2], 0);
+ assert_equals(colorData[3], 255);
}
function testDrawCanvasWithImageBitamp(image) {
- var dstCanvas = document.createElement('canvas');
- dstCanvas.width = dstCanvas.height = 100;
- var dstCtx = dstCanvas.getContext('bitmaprenderer');
- assert_true(dstCtx instanceof ImageBitmapRenderingContext);
- dstCtx.transferFromImageBitmap(image);
+ var dstCanvas = document.createElement('canvas');
+ dstCanvas.width = dstCanvas.height = 100;
+ var dstCtx = dstCanvas.getContext('bitmaprenderer');
+ dstCtx.transferFromImageBitmap(image);
- // Calling dstCtx.canvas should get the same canvas as the dstCanvas
- var testCanvas = dstCtx.canvas;
- assert_equals(dstCanvas.width, testCanvas.width);
- assert_equals(dstCanvas.height, testCanvas.height);
-
- // After transferFromImageBitmap, image's width && height should be 0
- assert_equals(image.width, 0);
- assert_equals(image.height, 0);
-
- var myCanvas = document.createElement('canvas');
- myCanvas.width = myCanvas.height = 100;
- var myCtx = myCanvas.getContext('2d');
- myCtx.drawImage(dstCanvas, 10, 10);
- testCanvas_0f0(myCtx);
+ var myCanvas = document.createElement('canvas');
+ myCanvas.width = myCanvas.height = 100;
+ var myCtx = myCanvas.getContext('2d');
+ myCtx.drawImage(dstCanvas, 10, 10);
+ testCanvas_0f0(myCtx);
}
promise_test(function() {
- var canvas = document.createElement('canvas');
- canvas.width = canvas.height = 100;
- var ctx = canvas.getContext('2d');
- ctx.fillStyle = '#0f0';
- ctx.fillRect(0, 0, 100, 100);
- testCanvas_0f0(ctx);
+ var canvas = document.createElement('canvas');
+ canvas.width = canvas.height = 100;
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 100);
+ testCanvas_0f0(ctx);
- return createImageBitmap(canvas).then(testDrawCanvasWithImageBitamp);
+ return createImageBitmap(canvas).then(testDrawCanvasWithImageBitamp);
}, 'testDrawCanvasWithImageBitamp should not return any error');
-promise_test(function() {
- var canvas = document.createElement('canvas');
- canvas.width = canvas.height = 100;
- var ctx = canvas.getContext('2d');
- ctx.fillStyle = '#0f0';
- ctx.fillRect(0, 0, 100, 100);
-
- return createImageBitmap(canvas).then(testException);
-}, 'transferFromImageBitmap(image) with a neutered image should throw InvalidStateError');
-
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698