https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 9ac1564951a43a313e49188ee24c90f330215b2e authored by François Beaufort on 06 December 2018, 10:51:49 UTC
[Picture-in-Picture] Don't require user gesture if capturing user media
Tip revision: 9ac1564
createImageBitmap-blob-invalidtype.html
<!DOCTYPE html>
<html>
<title>createImageBitmap: blob with wrong mime type</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<script>
promise_test(t => {
  // Source: https://commons.wikimedia.org/wiki/File:1x1.png (Public Domain)
  const IMAGE = atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAA" +
                     "ACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=");

  let bytes = new Array(IMAGE.length);
  for (let i = 0; i < IMAGE.length; i++) {
    bytes[i] = IMAGE.charCodeAt(i);
  }

  let blob = new Blob([new Uint8Array(bytes)], { type: "text/html"});

  return window.createImageBitmap(blob)
    .then(imageBitmap => {
      assert_true(true, "Image created!");
      assert_equals(imageBitmap.width, 1, "Image is 1x1");
      assert_equals(imageBitmap.height, 1, "Image is 1x1");
    });
});
</script>
back to top