Index: LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
diff --git a/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html b/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dc48053196fb9abb1dbbb1d56c69c639e3a7075d |
--- /dev/null |
+++ b/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
@@ -0,0 +1,45 @@ |
+<script src = "../../resources/js-test.js"></script> |
+<script type = "text/javascript"> |
+if (window.testRunner) |
+{ |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+} |
+ |
+description("Test that toBlob(mimeType) ignores the case of 'mimeType'."); |
+ |
+canvas = document.createElement('canvas'); |
+var counter; |
+ |
+function tryMimeType(mimeType, expectedMimeType) |
+{ |
+ canvas.toBlob(function(blob) { |
+ if (blob.type === expectedMimeType) { |
+ testPassed(""); |
+ } |
+ else { |
+ testFailed(blob.type + " does not match " + expectedMimeType); |
+ } |
+ counter = counter - 1; |
+ if (window.testRunner) { |
+ if (counter == 0) { |
+ testRunner.notifyDone(); |
+ } |
+ } |
+ }, mimeType); |
+} |
+ |
+counter = 4; |
+ |
+//Note that due to the async nature of toBlob, these callbacks may complete |
+// at random order but they will all print PASS when they pass. |
+tryMimeType("image/PNG", "image/png"); |
+ |
+tryMimeType("imaGE/jpEg", "image/jpeg"); |
+ |
+tryMimeType("ImAgE/WeBp", "image/webp"); |
+ |
+//Unsupported mime type falls back to png |
xlai (Olivia)
2015/08/21 18:40:05
Added a test for unsupported mime type as requeste
|
+tryMimeType("image/bmp", "image/png"); |
+ |
+</Script> |