Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / media / media-source / mediasource-append-buffer.html
blobce6044796f26c2f5ac54c0e8e7d9c655fd95ff53
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script>
6 <script src="mediasource-util.js"></script>
7 <link rel='stylesheet' href='/w3c/resources/testharness.css'>
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
14 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
15 test.expectEvent(sourceBuffer, 'update', 'Append success.');
16 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
17 sourceBuffer.appendBuffer(mediaData);
19 assert_true(sourceBuffer.updating, 'updating attribute is true');
21 test.waitForExpectedEvents(function()
23 assert_false(sourceBuffer.updating, 'updating attribute is false');
24 test.done();
25 });
26 }, 'Test SourceBuffer.appendBuffer() event dispatching.');
28 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
30 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
31 test.expectEvent(sourceBuffer, 'update', 'Append success.');
32 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
33 sourceBuffer.appendBuffer(mediaData);
35 assert_true(sourceBuffer.updating, 'updating attribute is true');
37 assert_throws('InvalidStateError',
38 function() { sourceBuffer.appendBuffer(mediaData); },
39 'appendBuffer() throws an exception there is a pending append.');
41 assert_true(sourceBuffer.updating, 'updating attribute is true');
43 test.waitForExpectedEvents(function()
45 assert_false(sourceBuffer.updating, 'updating attribute is false');
46 test.done();
47 });
48 }, 'Test SourceBuffer.appendBuffer() call during a pending appendBuffer().');
50 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
52 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
53 test.expectEvent(sourceBuffer, 'abort', 'Append aborted.');
54 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
55 sourceBuffer.appendBuffer(mediaData);
57 assert_true(sourceBuffer.updating, 'updating attribute is true');
59 sourceBuffer.abort();
61 assert_false(sourceBuffer.updating, 'updating attribute is false');
63 test.waitForExpectedEvents(function()
65 assert_false(sourceBuffer.updating, 'updating attribute is false');
66 test.done();
67 });
68 }, 'Test SourceBuffer.abort() call during a pending appendBuffer().');
70 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
72 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
73 test.expectEvent(sourceBuffer, 'update', 'Append success.');
74 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
75 sourceBuffer.appendBuffer(mediaData);
76 assert_true(sourceBuffer.updating, 'updating attribute is true');
78 test.waitForExpectedEvents(function()
80 assert_false(sourceBuffer.updating, 'updating attribute is false');
82 test.expectEvent(mediaSource, 'sourceended', 'MediaSource sourceended event');
83 mediaSource.endOfStream();
84 assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"');
85 });
87 test.waitForExpectedEvents(function()
89 assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"');
91 test.expectEvent(mediaSource, 'sourceopen', 'MediaSource sourceopen event');
92 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
93 test.expectEvent(sourceBuffer, 'update', 'Append success.');
94 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
95 sourceBuffer.appendBuffer(mediaData);
97 assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"');
98 assert_true(sourceBuffer.updating, 'updating attribute is true');
99 });
101 test.waitForExpectedEvents(function()
103 assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"');
104 assert_false(sourceBuffer.updating, 'updating attribute is false');
105 test.done();
107 }, 'Test SourceBuffer.appendBuffer() triggering an "ended" to "open" transition.');
109 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
111 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
112 test.expectEvent(sourceBuffer, 'update', 'Append success.');
113 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
114 sourceBuffer.appendBuffer(mediaData);
115 assert_true(sourceBuffer.updating, 'updating attribute is true');
117 test.waitForExpectedEvents(function()
119 assert_false(sourceBuffer.updating, 'updating attribute is false');
121 test.expectEvent(mediaSource, 'sourceended', 'MediaSource sourceended event');
122 mediaSource.endOfStream();
123 assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"');
126 test.waitForExpectedEvents(function()
128 assert_equals(mediaSource.readyState, 'ended', 'MediaSource readyState is "ended"');
130 test.expectEvent(mediaSource, 'sourceopen', 'MediaSource sourceopen event');
131 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
132 test.expectEvent(sourceBuffer, 'update', 'Append success.');
133 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
134 sourceBuffer.appendBuffer(new Uint8Array(0));
136 assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"');
137 assert_true(sourceBuffer.updating, 'updating attribute is true');
140 test.waitForExpectedEvents(function()
142 assert_equals(mediaSource.readyState, 'open', 'MediaSource readyState is "open"');
143 assert_false(sourceBuffer.updating, 'updating attribute is false');
144 test.done();
146 }, 'Test zero byte SourceBuffer.appendBuffer() call triggering an "ended" to "open" transition.');
148 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
150 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
151 test.expectEvent(sourceBuffer, 'abort', 'Append aborted.');
152 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
153 sourceBuffer.appendBuffer(mediaData);
155 assert_true(sourceBuffer.updating, 'updating attribute is true');
156 assert_equals(mediaSource.activeSourceBuffers.length, 0, 'activeSourceBuffers.length');
158 test.expectEvent(mediaSource.sourceBuffers, 'removesourcebuffer', 'sourceBuffers');
159 mediaSource.removeSourceBuffer(sourceBuffer);
161 assert_false(sourceBuffer.updating, 'updating attribute is false');
163 assert_throws('InvalidStateError',
164 function() { sourceBuffer.appendBuffer(mediaData); },
165 'appendBuffer() throws an exception because it isn\'t attached to the mediaSource anymore.');
167 test.waitForExpectedEvents(function()
169 assert_false(sourceBuffer.updating, 'updating attribute is false');
170 test.done();
172 }, 'Test MediaSource.removeSourceBuffer() call during a pending appendBuffer().');
174 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
176 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
177 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
178 sourceBuffer.appendBuffer(mediaData);
180 assert_true(sourceBuffer.updating, 'updating attribute is true');
182 assert_throws('InvalidStateError',
183 function() { mediaSource.duration = 1.0; },
184 'set duration throws an exception when updating attribute is true.');
186 test.waitForExpectedEvents(function()
188 assert_false(sourceBuffer.updating, 'updating attribute is false');
189 test.done();
191 }, 'Test set MediaSource.duration during a pending appendBuffer() for one of its SourceBuffers.');
193 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
195 test.failOnEvent(mediaSource, 'sourceended');
197 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
198 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
199 sourceBuffer.appendBuffer(mediaData);
201 assert_true(sourceBuffer.updating, 'updating attribute is true');
203 assert_throws('InvalidStateError',
204 function() { mediaSource.endOfStream(); },
205 'endOfStream() throws an exception when updating attribute is true.');
207 assert_equals(mediaSource.readyState, 'open');
209 test.waitForExpectedEvents(function()
211 assert_false(sourceBuffer.updating, 'updating attribute is false');
212 assert_equals(mediaSource.readyState, 'open');
213 test.done();
215 }, 'Test MediaSource.endOfStream() during a pending appendBuffer() for one of its SourceBuffers.');
217 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
219 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
220 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
221 sourceBuffer.appendBuffer(mediaData);
223 assert_true(sourceBuffer.updating, 'updating attribute is true');
225 assert_throws('InvalidStateError',
226 function() { sourceBuffer.timestampOffset = 10.0; },
227 'set timestampOffset throws an exception when updating attribute is true.');
229 test.waitForExpectedEvents(function()
231 assert_false(sourceBuffer.updating, 'updating attribute is false');
232 test.done();
234 }, 'Test set SourceBuffer.timestampOffset during a pending appendBuffer().');
236 mediasource_test(function(test, mediaElement, mediaSource)
238 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
240 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
241 test.expectEvent(sourceBuffer, 'update', 'Append success.');
242 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
243 sourceBuffer.appendBuffer(new Uint8Array(0));
245 assert_true(sourceBuffer.updating, 'updating attribute is true');
247 test.waitForExpectedEvents(function()
249 assert_false(sourceBuffer.updating, 'updating attribute is false');
250 test.done();
252 }, 'Test appending an empty ArrayBufferView.');
254 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
256 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
257 test.expectEvent(sourceBuffer, 'update', 'Append success.');
258 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
260 var arrayBufferView = new Uint8Array(mediaData);
262 assert_equals(arrayBufferView.length, mediaData.length, 'arrayBufferView.length before transfer.');
264 // Send the buffer as in a message so it gets neutered.
265 window.postMessage( 'test', '*', [arrayBufferView.buffer]);
267 assert_equals(arrayBufferView.length, 0, 'arrayBufferView.length after transfer.');
269 sourceBuffer.appendBuffer(arrayBufferView);
271 assert_true(sourceBuffer.updating, 'updating attribute is true');
273 test.waitForExpectedEvents(function()
275 assert_false(sourceBuffer.updating, 'updating attribute is false');
276 test.done();
278 }, 'Test appending a neutered ArrayBufferView.');
280 mediasource_test(function(test, mediaElement, mediaSource)
282 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
284 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
285 test.expectEvent(sourceBuffer, 'update', 'Append success.');
286 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
287 sourceBuffer.appendBuffer(new ArrayBuffer(0));
289 assert_true(sourceBuffer.updating, 'updating attribute is true');
291 test.waitForExpectedEvents(function()
293 assert_false(sourceBuffer.updating, 'updating attribute is false');
294 test.done();
296 }, 'Test appending an empty ArrayBuffer.');
298 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
300 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
301 test.expectEvent(sourceBuffer, 'update', 'Append success.');
302 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
304 var arrayBuffer = mediaData.buffer.slice();
306 assert_equals(arrayBuffer.byteLength, mediaData.buffer.byteLength, 'arrayBuffer.byteLength before transfer.');
308 // Send the buffer as in a message so it gets neutered.
309 window.postMessage( 'test', '*', [arrayBuffer]);
311 assert_equals(arrayBuffer.byteLength, 0, 'arrayBuffer.byteLength after transfer.');
313 sourceBuffer.appendBuffer(arrayBuffer);
315 assert_true(sourceBuffer.updating, 'updating attribute is true');
317 test.waitForExpectedEvents(function()
319 assert_false(sourceBuffer.updating, 'updating attribute is false');
320 test.done();
322 }, 'Test appending a neutered ArrayBuffer.');
324 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
326 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
327 var halfIndex = (initSegment.length - 1) / 2;
328 var partialInitSegment = initSegment.subarray(0, halfIndex);
329 var remainingInitSegment = initSegment.subarray(halfIndex);
330 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
332 test.expectEvent(sourceBuffer, 'updateend', 'partialInitSegment append ended.');
333 sourceBuffer.appendBuffer(partialInitSegment);
335 test.waitForExpectedEvents(function()
337 assert_equals(mediaElement.readyState, mediaElement.HAVE_NOTHING);
338 assert_equals(mediaSource.duration, Number.NaN);
339 test.expectEvent(sourceBuffer, 'updateend', 'remainingInitSegment append ended.');
340 test.expectEvent(mediaElement, 'loadedmetadata', 'loadedmetadata event received.');
341 sourceBuffer.appendBuffer(remainingInitSegment);
344 test.waitForExpectedEvents(function()
346 assert_equals(mediaElement.readyState, mediaElement.HAVE_METADATA);
347 assert_equals(mediaSource.duration, segmentInfo.durationInInitSegment);
348 test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.');
349 test.expectEvent(mediaElement, 'loadeddata', 'loadeddata fired.');
350 sourceBuffer.appendBuffer(mediaSegment);
353 test.waitForExpectedEvents(function()
355 assert_greater_than_equal(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA);
356 assert_equals(sourceBuffer.updating, false);
357 assert_equals(mediaSource.readyState, 'open');
358 test.done();
360 }, 'Test appendBuffer with partial init segments.');
362 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
364 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
365 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
366 var halfIndex = (mediaSegment.length - 1) / 2;
367 var partialMediaSegment = mediaSegment.subarray(0, halfIndex);
368 var remainingMediaSegment = mediaSegment.subarray(halfIndex);
370 test.expectEvent(sourceBuffer, 'updateend', 'InitSegment append ended.');
371 test.expectEvent(mediaElement, 'loadedmetadata', 'loadedmetadata done.');
372 sourceBuffer.appendBuffer(initSegment);
374 test.waitForExpectedEvents(function()
376 assert_equals(mediaElement.readyState, mediaElement.HAVE_METADATA);
377 assert_equals(mediaSource.duration, segmentInfo.durationInInitSegment);
378 test.expectEvent(sourceBuffer, 'updateend', 'partial media segment append ended.');
379 sourceBuffer.appendBuffer(partialMediaSegment);
382 test.waitForExpectedEvents(function()
384 test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.');
385 test.expectEvent(mediaElement, 'loadeddata', 'loadeddata fired.');
386 sourceBuffer.appendBuffer(remainingMediaSegment);
389 test.waitForExpectedEvents(function()
391 assert_greater_than_equal(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA);
392 assert_equals(mediaSource.readyState, 'open');
393 assert_equals(sourceBuffer.updating, false);
394 test.done();
396 }, 'Test appendBuffer with partial media segments.');
398 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
400 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
401 var partialInitSegment = initSegment.subarray(0, initSegment.length / 2);
402 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
404 test.expectEvent(sourceBuffer, 'updateend', 'partialInitSegment append ended.');
405 sourceBuffer.appendBuffer(partialInitSegment);
407 test.waitForExpectedEvents(function()
409 // Call abort to reset the parser.
410 sourceBuffer.abort();
412 // Append the full intiialization segment.
413 test.expectEvent(sourceBuffer, 'updateend', 'initSegment append ended.');
414 sourceBuffer.appendBuffer(initSegment);
417 test.waitForExpectedEvents(function()
419 test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.');
420 test.expectEvent(mediaElement, 'loadeddata', 'loadeddata fired.');
421 sourceBuffer.appendBuffer(mediaSegment);
424 test.waitForExpectedEvents(function()
426 test.done();
428 }, 'Test abort in the middle of an initialization segment.');
430 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
432 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
433 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
434 var partialMediaSegment = mediaSegment.subarray(0, 3 * mediaSegment.length / 4);
435 var partialBufferedRanges = null;
437 test.expectEvent(sourceBuffer, 'updateend', 'initSegment append ended.');
438 sourceBuffer.appendBuffer(initSegment);
440 test.waitForExpectedEvents(function()
442 test.expectEvent(sourceBuffer, 'updateend', 'partialMediaSegment append ended.');
443 sourceBuffer.appendBuffer(partialMediaSegment);
446 test.waitForExpectedEvents(function()
448 // Call abort to reset the parser.
449 sourceBuffer.abort();
451 // Keep a copy of the buffered ranges before we append the whole media segment.
452 partialBufferedRanges = sourceBuffer.buffered;
453 assert_equals(partialBufferedRanges.length, 1, 'partialBufferedRanges has 1 range');
455 // Append the full media segment.
456 test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.');
457 sourceBuffer.appendBuffer(mediaSegment);
460 test.waitForExpectedEvents(function()
462 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
464 assert_equals(sourceBuffer.buffered.length, 1, 'sourceBuffer.buffered has 1 range');
465 assert_equals(sourceBuffer.buffered.length, partialBufferedRanges.length, 'sourceBuffer.buffered and partialBufferedRanges are the same length.');
466 assert_equals(sourceBuffer.buffered.start(0), partialBufferedRanges.start(0), 'sourceBuffer.buffered and partialBufferedRanges start times match.');
467 assert_greater_than(sourceBuffer.buffered.end(0), partialBufferedRanges.end(0), 'sourceBuffer.buffered has a higher end time than partialBufferedRanges.');
468 test.done();
470 }, 'Test abort in the middle of a media segment.');
472 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
474 test.expectEvent(mediaSource.sourceBuffers, 'removesourcebuffer', 'SourceBuffer removed.');
475 mediaSource.removeSourceBuffer(sourceBuffer);
476 test.waitForExpectedEvents(function()
478 assert_throws('InvalidStateError',
479 function() { sourceBuffer.abort(); },
480 'sourceBuffer.abort() throws an exception for InvalidStateError.');
482 test.done();
484 }, 'Test abort after removing sourcebuffer.');
486 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
488 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
489 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
491 test.expectEvent(sourceBuffer, 'updateend', 'initSegment append ended.');
492 sourceBuffer.appendBuffer(initSegment);
494 test.waitForExpectedEvents(function()
496 assert_equals(mediaSource.readyState, 'open', 'readyState is open after init segment appended.');
497 test.expectEvent(sourceBuffer, 'updateend', 'mediaSegment append ended.');
498 sourceBuffer.appendBuffer(mediaSegment);
501 test.waitForExpectedEvents(function()
503 assert_equals(sourceBuffer.buffered.length, 1, 'sourceBuffer has a buffered range');
504 assert_equals(mediaSource.readyState, 'open', 'readyState is open after media segment appended.');
505 test.expectEvent(mediaSource, 'sourceended', 'source ended');
506 mediaSource.endOfStream();
509 test.waitForExpectedEvents(function()
511 assert_equals(mediaSource.readyState, 'ended', 'readyState is ended.');
512 assert_throws('InvalidStateError',
513 function() { sourceBuffer.abort(); },
514 'sourceBuffer.abort() throws an exception for InvalidStateError.');
515 test.done();
518 }, 'Test abort after readyState is ended following init segment and media segment.');
520 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
522 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
523 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
524 sourceBuffer.appendWindowStart = 1;
525 sourceBuffer.appendWindowEnd = 100;
526 sourceBuffer.appendBuffer(mediaData);
528 test.waitForExpectedEvents(function()
530 assert_false(sourceBuffer.updating, 'updating attribute is false');
531 sourceBuffer.abort();
532 assert_equals(sourceBuffer.appendWindowStart, 0, 'appendWindowStart is reset to 0');
533 assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY,
534 'appendWindowEnd is reset to +INFINITY');
535 test.done();
537 }, 'Test abort after appendBuffer update ends.');
539 mediasource_test(function(test, mediaElement, mediaSource)
541 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);
543 test.expectEvent(sourceBuffer, 'updatestart', 'Append started.');
544 test.expectEvent(sourceBuffer, 'update', 'Append success.');
545 test.expectEvent(sourceBuffer, 'updateend', 'Append ended.');
547 assert_throws( { name: 'TypeError'} ,
548 function() { sourceBuffer.appendBuffer(null); },
549 'appendBuffer(null) throws an exception.');
550 test.done();
551 }, 'Test appending null.');
553 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
555 mediaSource.removeSourceBuffer(sourceBuffer);
557 assert_throws( { name: 'InvalidStateError'} ,
558 function() { sourceBuffer.appendBuffer(mediaData); },
559 'appendBuffer() throws an exception when called after removeSourceBuffer().');
560 test.done();
561 }, 'Test appending after removeSourceBuffer().');
562 </script>
563 </body>
564 </html>