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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-messagechannel-imagebitmap-transfer.html

Issue 2541683002: Make ImageBitmap transfers work in cases that require serialization (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/Source/bindings/core/v8/SerializedScriptValue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-messagechannel-imagebitmap-transfer.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-messagechannel-imagebitmap-transfer.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-messagechannel-imagebitmap-transfer.html
new file mode 100644
index 0000000000000000000000000000000000000000..d36bcb7c25368a4bb30cc31a51aaee4d86ebf63a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-messagechannel-imagebitmap-transfer.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+async_test(function(t) {
+ var channel = new MessageChannel;
+ channel.port1.onmessage = function(e) {
+ t.step(function() {
+ assert_true(e.data !== null);
+ assert_equals(e.data.width, 10);
+ assert_equals(e.data.height, 10);
+ var destCtx = document.createElement('canvas').getContext('2d');
+ destCtx.drawImage(e.data, 0, 0);
+ var pixel = destCtx.getImageData(5, 5, 1, 1).data;
+ assert_array_equals(pixel, [0, 255, 0, 255]);
+ });
+ t.done();
+ };
+ channel.port1.start();
+ var sourceCanvas = document.createElement('canvas');
+ sourceCanvas.width = sourceCanvas.height = 10;
+ var sourceCtx = sourceCanvas.getContext('2d');
+ sourceCtx.fillStyle = '#0f0';
+ sourceCtx.fillRect(0, 0, 10, 10);
+ createImageBitmap(sourceCanvas).then( bitmap => {
+ channel.port2.postMessage(bitmap, [bitmap]);
+ });
+}, "Test that an ImageBitmap generated from a canvas survives being transferred via a MessageChannel");
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698