https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 8aa53dd361f53703c6c67c4b007a472832a855a2 authored by Marcos Cáceres on 22 November 2018, 02:14:30 UTC
fix: copy pasta
Tip revision: 8aa53dd
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