Chromium Code Reviews| 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..6a69d2ac4a28626344f94da9f20a1b374ee04b9d |
| --- /dev/null |
| +++ b/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
| @@ -0,0 +1,51 @@ |
| +<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 == 8) { |
|
Justin Novosad
2015/08/20 20:38:42
To make the test easier to extend, you should coun
xlai (Olivia)
2015/08/20 21:36:28
Doing that might result in a flaky test. If the bl
|
| + testRunner.notifyDone(); |
| + } |
| + } |
| + }, mimeType); |
| +} |
| + |
| +function startTest() |
|
Justin Novosad
2015/08/20 20:38:42
This function does not really serve a purpose. It'
|
| +{ |
| + counter = 0; |
|
Justin Novosad
2015/08/20 20:38:42
declaration and init can be on same line.
|
| + |
| + //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/png", "image/png"); |
| + tryMimeType("image/PNG", "image/png"); |
|
Justin Novosad
2015/08/20 20:38:42
Just one test is enough to verify case insensitivi
xlai (Olivia)
2015/08/20 21:36:28
Acknowledged and elsewhere.
|
| + |
| + tryMimeType("image/jpeg", "image/jpeg"); |
| + tryMimeType("imaGE/jpEg", "image/jpeg"); |
| + tryMimeType("IMAGE/JPEG", "image/jpeg"); |
| + |
| + tryMimeType("image/webp", "image/webp"); |
| + tryMimeType("ImAgE/WeBp", "image/webp"); |
| +} |
| + |
| +startTest(); |
| +</Script> |