| OLD | NEW |
| (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 |
| 56 }, "Test track default list construction, length, and indexed proper
ty getter"); |
| 57 |
| 58 </script> |
| 59 </body> |
| 60 </html> |
| OLD | NEW |