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 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | 7 <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <div id="log"></div> | 10 <div id="log"></div> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 test.expectEvent(sourceBuffer, "updateend", "mediaSegment append
ended."); | 98 test.expectEvent(sourceBuffer, "updateend", "mediaSegment append
ended."); |
99 test.expectEvent(mediaElement, "loadedmetadata", "mediaElement m
etadata."); | 99 test.expectEvent(mediaElement, "loadedmetadata", "mediaElement m
etadata."); |
100 sourceBuffer.appendBuffer(initSegment); | 100 sourceBuffer.appendBuffer(initSegment); |
101 | 101 |
102 test.waitForExpectedEvents(function() | 102 test.waitForExpectedEvents(function() |
103 { | 103 { |
104 assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE
_METADATA); | 104 assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE
_METADATA); |
105 | 105 |
106 test.expectEvent(mediaElement, "error", "mediaElement error.
"); | 106 test.expectEvent(mediaElement, "error", "mediaElement error.
"); |
107 test.expectEvent(mediaSource, "sourceended", "mediaSource en
ded."); | 107 test.expectEvent(mediaSource, "sourceended", "mediaSource en
ded."); |
108 test.expectEvent(mediaSource, "sourceclose", "mediaSource cl
osed."); | |
109 | |
110 mediaSource.endOfStream("decode"); | 108 mediaSource.endOfStream("decode"); |
111 }); | 109 }); |
112 | 110 |
113 test.waitForExpectedEvents(function() | 111 test.waitForExpectedEvents(function() |
114 { | 112 { |
115 assert_true(mediaElement.error != null); | 113 assert_true(mediaElement.error != null); |
116 assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_
DECODE); | 114 assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_
DECODE); |
117 | 115 assert_equals(mediaSource.readyState, "ended"); |
118 assert_equals(mediaSource.sourceBuffers.length, 0); | |
119 assert_equals(mediaSource.readyState, "closed"); | |
120 test.done(); | 116 test.done(); |
121 }); | 117 }); |
122 }, "Signaling 'decode' error via endOfStream() after initialization
segment has been appended and the HTMLMediaElement has reached HAVE_METADATA."); | 118 }, "Signaling 'decode' error via endOfStream() after initialization
segment has been appended and the HTMLMediaElement has reached HAVE_METADATA."); |
123 | 119 |
124 ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sou
rceBuffer, mediaData) | 120 ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sou
rceBuffer, mediaData) |
125 { | 121 { |
126 var initSegment = MediaSourceUtil.extractSegmentData(mediaData,
segmentInfo.init); | 122 var initSegment = MediaSourceUtil.extractSegmentData(mediaData,
segmentInfo.init); |
127 assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOT
HING); | 123 assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOT
HING); |
128 | 124 |
129 test.expectEvent(sourceBuffer, "updateend", "mediaSegment append
ended."); | 125 test.expectEvent(sourceBuffer, "updateend", "mediaSegment append
ended."); |
130 test.expectEvent(mediaElement, "loadedmetadata", "mediaElement m
etadata."); | 126 test.expectEvent(mediaElement, "loadedmetadata", "mediaElement m
etadata."); |
131 sourceBuffer.appendBuffer(initSegment); | 127 sourceBuffer.appendBuffer(initSegment); |
132 | 128 |
133 test.waitForExpectedEvents(function() | 129 test.waitForExpectedEvents(function() |
134 { | 130 { |
135 assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE
_METADATA); | 131 assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE
_METADATA); |
136 | 132 |
137 test.expectEvent(mediaElement, "error", "mediaElement error.
"); | 133 test.expectEvent(mediaElement, "error", "mediaElement error.
"); |
138 test.expectEvent(mediaSource, "sourceended", "mediaSource en
ded."); | 134 test.expectEvent(mediaSource, "sourceended", "mediaSource en
ded."); |
139 test.expectEvent(mediaSource, "sourceclose", "mediaSource cl
osed."); | |
140 | |
141 mediaSource.endOfStream("network"); | 135 mediaSource.endOfStream("network"); |
142 }); | 136 }); |
143 | 137 |
144 test.waitForExpectedEvents(function() | 138 test.waitForExpectedEvents(function() |
145 { | 139 { |
146 assert_true(mediaElement.error != null); | 140 assert_true(mediaElement.error != null); |
147 assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_
NETWORK); | 141 assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_
NETWORK); |
148 | 142 assert_equals(mediaSource.readyState, "ended"); |
149 assert_equals(mediaSource.sourceBuffers.length, 0); | |
150 assert_equals(mediaSource.readyState, "closed"); | |
151 test.done(); | 143 test.done(); |
152 }); | 144 }); |
153 }, "Signaling 'network' error via endOfStream() after initialization
segment has been appended and the HTMLMediaElement has reached HAVE_METADATA.")
; | 145 }, "Signaling 'network' error via endOfStream() after initialization
segment has been appended and the HTMLMediaElement has reached HAVE_METADATA.")
; |
154 </script> | 146 </script> |
155 </body> | 147 </body> |
156 </html> | 148 </html> |
OLD | NEW |