chromium/third_party/blink/web_tests/fast/canvas-api/canvas-toDataURL-case-insensitive-mimetype.html

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<script>
test(function(t) {

    canvas = document.createElement('canvas');
    
    function tryMimeType(mimeType) {
        re = new RegExp("^data:([^;, ]+)[;, ].*");
        data = canvas.toDataURL(mimeType);
        caps = data.match(re);
        if (caps.length != 2)
            return "FAIL";
        return caps[1];
    }
    
    assert_equals(tryMimeType('image/png'), 'image/png');
    assert_equals(tryMimeType('iMAge/Png'), 'image/png');
    assert_equals(tryMimeType('IMAGE/PNG'), 'image/png');
    
    if (tryMimeType("image/jpeg") == "image/jpeg") {
        assert_equals(tryMimeType('image/jpeg'), 'image/jpeg');
        assert_equals(tryMimeType('imAgE/jPEg'), 'image/jpeg');
        assert_equals(tryMimeType('IMAGE/JPEG'), 'image/jpeg');
    }
    
    if (tryMimeType("image/webp") == "image/webp") {
        assert_equals(tryMimeType('image/webp'), 'image/webp');
        assert_equals(tryMimeType('imAgE/wEBp'), 'image/webp');
        assert_equals(tryMimeType('IMAGE/WEBP'), 'image/webp');
    }

}, "Test that toDataURL(mimeType) ignores the case of 'mimeType'.");
</script>