Index: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-toBlob-invalid.js |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-toBlob-invalid.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-toBlob-invalid.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8d1e8ec3a05f08af74748f97281a1390623774b9 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-toBlob-invalid.js |
@@ -0,0 +1,17 @@ |
+description("Test the handling of invalid arguments in canvas toBlob()."); |
+ |
+var canvas = document.createElement('canvas'); |
+var ctx = canvas.getContext("2d"); |
+ctx.strokeStyle = "red"; |
+ctx.strokeRect(0, 0, 50, 50); |
+ |
+shouldThrow("canvas.toBlob();"); |
+shouldThrow("canvas.toBlob(null);"); |
+shouldThrow("canvas.toBlob(undefined);"); |
+// Passing the callback argument without blob handle silently fails. |
+shouldNotThrow("canvas.toBlob(function() {});"); |
+ |
+// Invalid quality argument will fall back to default value |
+shouldNotThrow("canvas.toBlob(function(blob) {}, 'image/jpeg', 500)"); |
+ |
+ |