Unreviewed gardening; update LayoutTests/media-source to the most recent version...
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / media-source / mediasource-is-type-supported.html
1 <!DOCTYPE html>
2 <!--  Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
3 <html>
4     <head>
5         <title>MediaSource.isTypeSupported() test cases.</title>
6         <script src="/resources/testharness.js"></script>
7         <script src="/resources/testharnessreport.js"></script>
8         <script src="mediasource-util.js"></script>
9     </head>
10     <body>
11         <div id="log"></div>
12         <script>
13           // Generate a distinct test for each type in types
14           function test_type_support(types, expectation, description)
15           {
16               for (var i = 0; i < types.length; ++i) {
17                   test(function()
18                   {
19                       assert_equals(MediaSource.isTypeSupported(types[i]),
20                                     expectation, 'supported');
21                   },  description + ' "' + types[i] + '"');
22               }
23           };
24
25           test_type_support([
26               'video',
27               'video/',
28               'video/webm',
29               'video/webm;',
30               'video/webm;codecs',
31               'video/webm;codecs=',
32               'video/webm;codecs="',
33               'video/webm;codecs=""',
34               'video/webm;codecs=","',
35               '',
36               null
37           ], false, 'Test invalid MIME format');
38
39           test_type_support([
40               'xxx',
41               'text/html',
42               'image/jpeg'
43           ], false, 'Test invalid MSE MIME media type');
44
45           test_type_support([
46               'audio/webm;codecs="vp8"',
47               'audio/mp4;codecs="avc1.4d001e"',
48           ], false, 'Test invalid mismatch between major type and codec ID');
49
50           test_type_support([
51               'audio/mp4;codecs="vorbis"',
52               'audio/webm;codecs="mp4a.40.2"',
53               'video/mp4;codecs="vp8"',
54               'video/webm;codecs="mp4a.40.2"',
55               'video/mp4;codecs="vorbis"',
56           ], false, 'Test invalid mismatch between minor type and codec ID');
57
58           test_type_support([
59               'audio/mp4;codecs="mp4a"',
60               'audio/mp4;codecs="mp4a.40"',
61               'audio/mp4;codecs="mp4a.40."',
62               'audio/mp4;codecs="mp4a.67.3"'
63           ], false, 'Test invalid codec ID');
64
65           test_type_support([
66               'video/webm;codecs="vp8"',
67               'video/webm;codecs="vorbis"',
68               'video/webm;codecs="vp8,vorbis"',
69               'video/webm;codecs="vorbis, vp8"',
70               'audio/webm;codecs="vorbis"',
71               'AUDIO/WEBM;CODECS="vorbis"',
72           ], true, 'Test valid WebM type');
73
74           test_type_support([
75               'video/mp4;codecs="avc1.4d001e"', // H.264 Main Profile level 3.0
76               'video/mp4;codecs="avc1.42001e"', // H.264 Baseline Profile level 3.0
77               'audio/mp4;codecs="mp4a.40.2"',   // MPEG4 AAC-LC
78               'audio/mp4;codecs="mp4a.40.5"',   // MPEG4 HE-AAC
79               'audio/mp4;codecs="mp4a.67"',     // MPEG2 AAC-LC
80               'video/mp4;codecs="mp4a.40.2"',
81               'video/mp4;codecs="avc1.4d001e,mp4a.40.2"',
82               'video/mp4;codecs="mp4a.40.2 , avc1.4d001e "',
83               'video/mp4;codecs="avc1.4d001e,mp4a.40.5"',
84           ], true, 'Test valid MP4 type');
85         </script>
86     </body>
87 </html>