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..69f9b9a95d2960f8ce0c1ad23fdfa04811fb138e |
| --- /dev/null |
| +++ b/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html |
| @@ -0,0 +1,39 @@ |
| +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| +<script src = "../../resources/js-test.js"></ script> |
| +<script type = 'text/javascript'> |
| +if (window.testRunner) |
| + testRunner.dumpAsText(); |
| + |
| +canvas = document.createElement("canvas"); |
|
Justin Novosad
2015/08/13 21:03:40
var canvas
xlai (Olivia)
2015/08/20 19:46:43
Done for this and elsewhere.
|
| +var ctx = canvas.getContext("2d"); |
| +ctx.fillStyle = "#FF0000"; |
| +ctx.fillRect(0, 0, 150, 75); |
| + |
| +canvas.toBlob(function(blob) { |
| + var newImg = document.createElement("img"), |
|
Justin Novosad
2015/08/13 21:03:40
, -> ;
|
| + url = URL.createObjectURL(blob); |
|
Justin Novosad
2015/08/13 21:03:39
indentation
|
| + newImg.onload = function() |
| + { |
| + // no longer need to read the blob so it's revoked |
| + URL.revokeObjectURL(url); |
|
Justin Novosad
2015/08/13 21:03:40
This will not be called because the test finishes
|
| + }; |
| + newImg.src = url; |
| + document.body.appendChild(newImg); |
| +}); |
| + |
| +function tryGetImageTag() |
| +{ |
| + var tags = document.getElementsByTagName('img'); |
|
Justin Novosad
2015/08/13 21:03:40
you should just make newImg global and use it dire
|
| + if (typeof tags == = "undefined") |
| + return ""; |
| + else if (typeof tags[0] == = "undefined") |
| + return ""; |
| + else |
| + return tags[0].src.substring(0, 9); |
| +} |
| + |
| +shouldBecomeEqual("tryGetImageTag()", "'blob:null'", function(){}, 1000); |
|
Justin Novosad
2015/08/13 21:03:40
Can you explain what exactly this tests, why is th
|
| + |
| +if (window.testRunner) |
| + testRunner.notifyDone(); |
|
Justin Novosad
2015/08/13 21:03:39
This belongs in the shouldBecomeEqual completion h
xlai (Olivia)
2015/08/20 19:46:43
Deleted this. Changed the shouldBecomeEqual to sho
|
| +</script> |