@@ -110,6 +110,20 @@ promise_test(t => {
110
110
} ) ) ;
111
111
} , "Test that decodingInfo rejects if the video configuration contentType doesn't parse" ) ;
112
112
113
+ // See https://mimesniff.spec.whatwg.org/#example-valid-mime-type-string
114
+ promise_test ( t => {
115
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
116
+ type : 'file' ,
117
+ video : {
118
+ contentType : 'video/webm;' ,
119
+ width : 800 ,
120
+ height : 600 ,
121
+ bitrate : 3000 ,
122
+ framerate : 24 ,
123
+ } ,
124
+ } ) ) ;
125
+ } , "Test that decodingInfo rejects if the video configuration contentType is not a valid MIME type string" ) ;
126
+
113
127
promise_test ( t => {
114
128
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
115
129
type : 'file' ,
@@ -172,6 +186,45 @@ promise_test(t => {
172
186
} ) ) ;
173
187
} , "Test that decodingInfo rejects if the video configuration contentType has one parameter that isn't codecs" ) ;
174
188
189
+ promise_test ( t => {
190
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
191
+ type : 'file' ,
192
+ video : {
193
+ contentType : 'video/webm' ,
194
+ width : 800 ,
195
+ height : 600 ,
196
+ bitrate : 3000 ,
197
+ framerate : 24 ,
198
+ } ,
199
+ } ) ) ;
200
+ } , "Test that decodingInfo rejects if the video configuration contentType does not imply a single media codec but has no codecs parameter" ) ;
201
+
202
+ promise_test ( t => {
203
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
204
+ type : 'file' ,
205
+ video : {
206
+ contentType : 'video/webm; codecs="vp09.00.10.08, vp8"' ,
207
+ width : 800 ,
208
+ height : 600 ,
209
+ bitrate : 3000 ,
210
+ framerate : 24 ,
211
+ }
212
+ } ) ) ;
213
+ } , "Test that decodingInfo rejects if the video configuration contentType has a codecs parameter that indicates multiple video codecs" ) ;
214
+
215
+ promise_test ( t => {
216
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
217
+ type : 'file' ,
218
+ video : {
219
+ contentType : 'video/webm; codecs="vp09.00.10.08, opus"' ,
220
+ width : 800 ,
221
+ height : 600 ,
222
+ bitrate : 3000 ,
223
+ framerate : 24 ,
224
+ }
225
+ } ) ) ;
226
+ } , "Test that decodingInfo rejects if the video configuration contentType has a codecs parameter that indicates both an audio and a video codec" ) ;
227
+
175
228
promise_test ( t => {
176
229
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
177
230
type : 'file' ,
@@ -183,7 +236,7 @@ promise_test(t => {
183
236
framerate : '24000/1001' ,
184
237
}
185
238
} ) ) ;
186
- } , "Test that decodingInfo() rejects framerate in the form of x/y" ) ;
239
+ } , "Test that decodingInfo rejects framerate in the form of x/y" ) ;
187
240
188
241
promise_test ( t => {
189
242
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -196,7 +249,7 @@ promise_test(t => {
196
249
framerate : '24000/0' ,
197
250
}
198
251
} ) ) ;
199
- } , "Test that decodingInfo() rejects framerate in the form of x/0" ) ;
252
+ } , "Test that decodingInfo rejects framerate in the form of x/0" ) ;
200
253
201
254
promise_test ( t => {
202
255
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -209,7 +262,7 @@ promise_test(t => {
209
262
framerate : '0/10001' ,
210
263
}
211
264
} ) ) ;
212
- } , "Test that decodingInfo() rejects framerate in the form of 0/y" ) ;
265
+ } , "Test that decodingInfo rejects framerate in the form of 0/y" ) ;
213
266
214
267
promise_test ( t => {
215
268
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -222,7 +275,7 @@ promise_test(t => {
222
275
framerate : '-24000/10001' ,
223
276
}
224
277
} ) ) ;
225
- } , "Test that decodingInfo() rejects framerate in the form of -x/y" ) ;
278
+ } , "Test that decodingInfo rejects framerate in the form of -x/y" ) ;
226
279
227
280
promise_test ( t => {
228
281
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -235,7 +288,7 @@ promise_test(t => {
235
288
framerate : '24000/-10001' ,
236
289
}
237
290
} ) ) ;
238
- } , "Test that decodingInfo() rejects framerate in the form of x/-y" ) ;
291
+ } , "Test that decodingInfo rejects framerate in the form of x/-y" ) ;
239
292
240
293
promise_test ( t => {
241
294
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -248,7 +301,7 @@ promise_test(t => {
248
301
framerate : '24000/' ,
249
302
}
250
303
} ) ) ;
251
- } , "Test that decodingInfo() rejects framerate in the form of x/" ) ;
304
+ } , "Test that decodingInfo rejects framerate in the form of x/" ) ;
252
305
253
306
promise_test ( t => {
254
307
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -261,14 +314,22 @@ promise_test(t => {
261
314
framerate : '1/3x' ,
262
315
}
263
316
} ) ) ;
264
- } , "Test that decodingInfo() rejects framerate with trailing unallowed characters" ) ;
317
+ } , "Test that decodingInfo rejects framerate with trailing unallowed characters" ) ;
265
318
266
319
promise_test ( t => {
267
320
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
268
321
type : 'file' ,
269
322
audio : { contentType : 'fgeoa' } ,
270
323
} ) ) ;
271
- } , "Test that decodingInfo rejects if the audio configuration contenType doesn't parse" ) ;
324
+ } , "Test that decodingInfo rejects if the audio configuration contentType doesn't parse" ) ;
325
+
326
+ // See https://mimesniff.spec.whatwg.org/#example-valid-mime-type-string
327
+ promise_test ( t => {
328
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
329
+ type : 'file' ,
330
+ audio : { contentType : 'audio/mpeg;' } ,
331
+ } ) ) ;
332
+ } , "Test that decodingInfo rejects if the audio configuration contentType is not a valid MIME type string" ) ;
272
333
273
334
promise_test ( t => {
274
335
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -282,7 +343,7 @@ promise_test(t => {
282
343
type : 'file' ,
283
344
audio : { contentType : 'audio/webm; codecs="opus"; foo="bar"' } ,
284
345
} ) ) ;
285
- } , "Test that decodingInfo rejects if the audio configuration contentType has more than one parameters " ) ;
346
+ } , "Test that decodingInfo rejects if the audio configuration contentType has more than one parameter " ) ;
286
347
287
348
promise_test ( t => {
288
349
return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
@@ -291,6 +352,27 @@ promise_test(t => {
291
352
} ) ) ;
292
353
} , "Test that decodingInfo rejects if the audio configuration contentType has one parameter that isn't codecs" ) ;
293
354
355
+ promise_test ( t => {
356
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
357
+ type : 'file' ,
358
+ audio : { contentType : 'audio/webm' } ,
359
+ } ) ) ;
360
+ } , "Test that decodingInfo rejects if the audio configuration contentType does not imply a single media codec but has no codecs parameter" ) ;
361
+
362
+ promise_test ( t => {
363
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
364
+ type : 'file' ,
365
+ audio : { contentType : 'audio/webm; codecs="vorbis, opus"' } ,
366
+ } ) ) ;
367
+ } , "Test that decodingInfo rejects if the audio configuration contentType has a codecs parameter that indicates multiple audio codecs" ) ;
368
+
369
+ promise_test ( t => {
370
+ return promise_rejects_js ( t , TypeError , navigator . mediaCapabilities . decodingInfo ( {
371
+ type : 'file' ,
372
+ audio : { contentType : 'audio/webm; codecs="vp09.00.10.08, opus"' } ,
373
+ } ) ) ;
374
+ } , "Test that decodingInfo rejects if the audio configuration contentType has a codecs parameter that indicates both an audio and a video codec" ) ;
375
+
294
376
promise_test ( t => {
295
377
return navigator . mediaCapabilities . decodingInfo ( {
296
378
type : 'file' ,
0 commit comments