diff --git a/testing/web-platform/tests/webcodecs/image-decoder.any.js b/testing/web-platform/tests/webcodecs/image-decoder.any.js index f33a60a1f6ca..2c13b72cbd1a 100644 --- a/testing/web-platform/tests/webcodecs/image-decoder.any.js +++ b/testing/web-platform/tests/webcodecs/image-decoder.any.js @@ -85,3 +85,18 @@ promise_test(t => { promise_test(t => { return testFourColorsDecode('four-colors.gif', 'image/gif'); }, 'Test GIF image decoding.'); + +promise_test(t => { + return fetch('four-colors.png').then(response => { + let decoder = new ImageDecoder({data: response.body, type: 'junk/type'}); + return promise_rejects_dom(t, 'NotSupportedError', decoder.decode()); + }); +}, 'Test invalid mime type rejects decode() requests'); + +promise_test(t => { + return fetch('four-colors.png').then(response => { + let decoder = new ImageDecoder({data: response.body, type: 'junk/type'}); + return promise_rejects_dom( + t, 'NotSupportedError', decoder.decodeMetadata()); + }); +}, 'Test invalid mime type rejects decodeMetadata() requests');