Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: LayoutTests/http/tests/media/media-source/mediasource-trackdefaultlist.html

Issue 702583002: MSE: Implement TrackDefaultList object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@WIP_blink_trackdefaults_and_add_tracks_to_init_segment_processing
Patch Set: Simplified..(addressed PS3 comments and rebased) Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script>
6
7 <link rel='stylesheet' href='/w3c/resources/testharness.css'>
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12
13 test(function()
14 {
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"),
21
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")
27 ];
28
29 // Get a new array containing the same objects as |originalTrack Defaults|.
30 var trackDefaults = originalTrackDefaults.slice();
31
32 var trackDefaultList = new TrackDefaultList(trackDefaults);
33 assert_array_equals(trackDefaultList, originalTrackDefaults, "co nstruction and read-back succeeded");
34 assert_equals(trackDefaultList[trackDefaultList.length], undefin ed, "out of range indexed property getter result is undefined");
35 assert_equals(trackDefaultList[trackDefaultList.length + 1], und efined, "out of range indexed property getter result is undefined");
36
37 // Introduce same-type, same-empty-string-byteStreamTrackId conf lict in trackDefaults[0 vs 4].
38 trackDefaults[4] = new TrackDefault("audio", "en-US", "label", [ "main"], "");
39 assert_equals(trackDefaults[0].type, trackDefaults[4].type, "sam e-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");
44
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, "sam e-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");
52
53 // Confirm the constructed TrackDefaultList makes a shallow copy of the supplied TrackDefault sequence.
54 assert_array_equals(trackDefaultList, originalTrackDefaults, "re ad-back of original trackDefaultList unchanged");
55 assert_equals(trackDefaultList.length, originalTrackDefaults.len gth, "lists have same cardinality");
56 for (var i = 0; i < trackDefaultList.length; ++i)
57 assert_true(trackDefaultList[i] === originalTrackDefaults[i] , "objects at index " + i + " are the same");
philipj_slow 2014/12/12 23:04:28 assert_equals also uses === internally, sorry I mi
wolenetz 2014/12/15 20:31:48 Done.
58
59 }, "Test track default list construction, length, and indexed proper ty getter");
60
61 </script>
62 </body>
63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698