chromium/third_party/blink/web_tests/fast/canvas/canvas-messagechannel-imagebitmap-transfer.html

<!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>