Chromium Code Reviews| Index: LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html |
| diff --git a/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html b/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..053023f13cc780701e2ba7bc12270b6715765f35 |
| --- /dev/null |
| +++ b/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html |
| @@ -0,0 +1,32 @@ |
| +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| +<html> |
| +<head> |
| +<script src = "../../resources/testharness.js"></script> |
| +<script src= "../../resources/testharnessreport.js"></script> |
| +<p>Test whether we can create object url from canvas.toBlob and put it in image</p> |
| +<script type = 'text/javascript'> |
| +var newImg; |
| + |
| +function tryTestToBlob() |
| +{ |
| + test(function() { |
| + var canvas = document.createElement("canvas"); |
| + var ctx = canvas.getContext("2d"); |
| + ctx.fillStyle = "#FF0000"; |
| + ctx.fillRect(0, 0, 150, 75); |
| + |
| + canvas.toBlob(function(blob) { |
|
Justin Novosad
2015/08/20 20:38:42
This needs to be written as an asynchronous test.
|
| + newImg = document.createElement("img"); |
| + url = URL.createObjectURL(blob); |
| + newImg.src = url; |
| + document.body.appendChild(newImg); |
| + assert_equals(newImg.src.substring(0, 9), "blob:null", |
| + "The img is created as blob:null"); |
| + }); |
| + }, "toBlob function running successfully"); |
| +} |
| +</script> |
| +</head> |
| +<body onload="tryTestToBlob()"> |
| +</body> |
| +</html> |