OLD | NEW |
(Empty) | |
| 1 <script src = "../../resources/js-test.js"></script> |
| 2 <script type = "text/javascript"> |
| 3 if (window.testRunner) |
| 4 { |
| 5 testRunner.dumpAsText(); |
| 6 testRunner.waitUntilDone(); |
| 7 } |
| 8 |
| 9 description("Test that toBlob(mimeType) ignores the case of 'mimeType'."); |
| 10 |
| 11 canvas = document.createElement('canvas'); |
| 12 var counter; |
| 13 |
| 14 function tryMimeType(mimeType, expectedMimeType) |
| 15 { |
| 16 canvas.toBlob(function(blob) { |
| 17 if (blob.type === expectedMimeType) { |
| 18 testPassed(""); |
| 19 } |
| 20 else { |
| 21 testFailed(blob.type + " does not match " + expectedMimeType); |
| 22 } |
| 23 counter = counter - 1; |
| 24 if (window.testRunner) { |
| 25 if (counter == 0) { |
| 26 testRunner.notifyDone(); |
| 27 } |
| 28 } |
| 29 }, mimeType); |
| 30 } |
| 31 |
| 32 counter = 4; |
| 33 |
| 34 //Note that due to the async nature of toBlob, these callbacks may complete |
| 35 // at random order but they will all print PASS when they pass. |
| 36 tryMimeType("image/PNG", "image/png"); |
| 37 |
| 38 tryMimeType("imaGE/jpEg", "image/jpeg"); |
| 39 |
| 40 tryMimeType("ImAgE/WeBp", "image/webp"); |
| 41 |
| 42 //Unsupported mime type falls back to png |
| 43 tryMimeType("image/bmp", "image/png"); |
| 44 |
| 45 </Script> |
OLD | NEW |