OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="/w3c/resources/testharness.js"></script> | 4 <script src="/w3c/resources/testharness.js"></script> |
5 <script src="/w3c/resources/testharnessreport.js"></script> | 5 <script src="/w3c/resources/testharnessreport.js"></script> |
6 <script src="mediasource-util.js"></script> | 6 <script src="mediasource-util.js"></script> |
7 <script src="/media/resources/media-source/webm/segment-info.js"></scrip
t> | 7 <script src="/media/resources/media-source/webm/segment-info.js"></scrip
t> |
8 | 8 |
9 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | 9 <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
10 </head> | 10 </head> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea
dyState is \'open\''); | 72 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea
dyState is \'open\''); |
73 }); | 73 }); |
74 | 74 |
75 test.waitForExpectedEvents(function() | 75 test.waitForExpectedEvents(function() |
76 { | 76 { |
77 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea
dyState is \'open\''); | 77 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea
dyState is \'open\''); |
78 test.done(); | 78 test.done(); |
79 }); | 79 }); |
80 }, 'Test setting SourceBuffer.mode triggers parent MediaSource \'ended
\' to \'open\' transition.'); | 80 }, 'Test setting SourceBuffer.mode triggers parent MediaSource \'ended
\' to \'open\' transition.'); |
81 | 81 |
82 // FIXME: Once enough Chromium implementation lands, add tests for at
least confirming exception if append | 82 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour
ce, segmentInfo, sourceBuffer, mediaData) |
83 // state is PARSING_MEDIA_SEGMENT (per 3.1 setting mode steps 6-7). Se
e http://crbug.com/249422. | 83 { |
| 84 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, se
gmentInfo.init); |
| 85 var fullMediaSegment = MediaSourceUtil.extractSegmentData(mediaDat
a, segmentInfo.media[0]); |
| 86 var truncateAt = Math.floor(segmentInfo.media[0].size * 0.95); //
Pick first 95% of segment bytes. |
| 87 var partialMediaSegment = fullMediaSegment.subarray(0, truncateAt)
; |
| 88 var mediaSegmentRemainder = fullMediaSegment.subarray(truncateAt); |
| 89 |
| 90 // Append init segment. |
| 91 test.expectEvent(sourceBuffer, 'updateend', 'Init segment append e
nded.'); |
| 92 sourceBuffer.appendBuffer(initSegment); |
| 93 |
| 94 test.waitForExpectedEvents(function() |
| 95 { |
| 96 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); |
| 97 assert_equals(sourceBuffer.mode, 'segments'); |
| 98 sourceBuffer.mode = 'segments'; // No exception should occur. |
| 99 |
| 100 // Append first part of media segment. |
| 101 test.expectEvent(sourceBuffer, 'updateend', 'Partial media seg
ment append ended.'); |
| 102 sourceBuffer.appendBuffer(partialMediaSegment); |
| 103 }); |
| 104 |
| 105 test.waitForExpectedEvents(function() |
| 106 { |
| 107 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); |
| 108 assert_equals(sourceBuffer.mode, 'segments'); |
| 109 assert_throws('InvalidStateError', |
| 110 function() { sourceBuffer.mode = 'segments'; }, |
| 111 'Setting valid sourceBuffer.mode while still parsing media
segment threw InvalidStateError.'); |
| 112 |
| 113 // Append remainder of media segment. |
| 114 test.expectEvent(sourceBuffer, 'updateend', 'Append ended of r
emainder of media segment.'); |
| 115 sourceBuffer.appendBuffer(mediaSegmentRemainder); |
| 116 }); |
| 117 |
| 118 test.waitForExpectedEvents(function() |
| 119 { |
| 120 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); |
| 121 assert_equals(sourceBuffer.mode, 'segments'); |
| 122 sourceBuffer.mode = 'segments'; // No exception should occur. |
| 123 test.done(); |
| 124 }); |
| 125 }, 'Test setting SourceBuffer.mode while parsing media segment.'); |
| 126 |
| 127 // FIXME: Once 'sequence' mode implemented, add verification. See http
://crbug.com/249422. |
84 </script> | 128 </script> |
85 </body> | 129 </body> |
86 </html> | 130 </html> |
OLD | NEW |