Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / media / media-source / mediasource-trackdefaultlist.html
blob275d5a84e276085dcd914eec4490d2e5c8fc88f0
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script>
7 <link rel='stylesheet' href='/w3c/resources/testharness.css'>
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
13 test(function()
15 var originalTrackDefaults = [
16 // Same everything, but different byteStreamTrackID, should be allowed by the constructor.
17 new TrackDefault("audio", "en-US", "label", ["main"], ""),
18 new TrackDefault("audio", "en-US", "label", ["main"], "1"),
19 new TrackDefault("audio", "en-US", "label", ["main"], "2"),
20 new TrackDefault("audio", "en-US", "label", [""], "3"),
22 // Same everything, but different type, should be allowed by the constructor.
23 new TrackDefault("video", "en-US", "label", ["main"], ""),
24 new TrackDefault("video", "en-US", "label", ["main"], "1"),
25 new TrackDefault("video", "en-US", "label", ["main"], "2"),
26 new TrackDefault("video", "en-US", "label", [""], "3")
29 // Get a new array containing the same objects as |originalTrackDefaults|.
30 var trackDefaults = originalTrackDefaults.slice();
32 var trackDefaultList = new TrackDefaultList(trackDefaults);
33 assert_array_equals(trackDefaultList, originalTrackDefaults, "construction and read-back succeeded");
34 assert_equals(trackDefaultList[trackDefaultList.length], undefined, "out of range indexed property getter result is undefined");
35 assert_equals(trackDefaultList[trackDefaultList.length + 1], undefined, "out of range indexed property getter result is undefined");
37 // Introduce same-type, same-empty-string-byteStreamTrackId conflict in trackDefaults[0 vs 4].
38 trackDefaults[4] = new TrackDefault("audio", "en-US", "label", ["main"], "");
39 assert_equals(trackDefaults[0].type, trackDefaults[4].type, "same-type conflict setup");
40 assert_equals(trackDefaults[0].byteStreamTrackID, trackDefaults[4].byteStreamTrackID, "same-byteStreamTrackID conflict setup");
41 assert_throws("InvalidAccessError",
42 function() { new TrackDefaultList(trackDefaults); },
43 "TrackDefaultList construction should throw exception due to same type and byteStreamTrackID across at least 2 items in trackDefaults");
45 // Introduce same-type, same-non-empty-string-byteStreamTrackId conflict in trackDefaults[4 vs 5].
46 trackDefaults[4] = new TrackDefault("video", "en-US", "label", ["main"], "1");
47 assert_equals(trackDefaults[4].type, trackDefaults[5].type, "same-type conflict setup");
48 assert_equals(trackDefaults[4].byteStreamTrackID, trackDefaults[5].byteStreamTrackID, "same-byteStreamTrackID conflict setup");
49 assert_throws("InvalidAccessError",
50 function() { new TrackDefaultList(trackDefaults); },
51 "TrackDefaultList construction should throw exception due to same type and byteStreamTrackID across at least 2 items in trackDefaults");
53 // Confirm the constructed TrackDefaultList makes a shallow copy of the supplied TrackDefault sequence.
54 assert_array_equals(trackDefaultList, originalTrackDefaults, "read-back of original trackDefaultList unchanged");
56 }, "Test track default list construction, length, and indexed property getter");
58 test(function()
60 var trackDefaultList = new TrackDefaultList();
61 assert_array_equals(trackDefaultList, [], "empty list constructable without supplying optional trackDefaults parameter");
63 trackDefaultList = new TrackDefaultList([]);
64 assert_array_equals(trackDefaultList, [], "empty list constructable by supplying empty sequence as optional trackDefaults parameter");
65 }, "Test empty track default list construction with and without optional trackDefaults parameter");
67 </script>
68 </body>
69 </html>