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 <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 function createMediaXHR(test, onFinished) { |
| 13 var mediaURL = "/media/resources/media-source/webm/test-a-5min-441
00Hz-1ch.webm"; |
| 14 var xhr = new XMLHttpRequest(); |
| 15 xhr.open('GET', mediaURL, true); |
| 16 xhr.responseType = 'legacystream'; |
| 17 test.failOnEvent(xhr, 'error'); |
| 18 xhr.onreadystatechange = function() { |
| 19 if (xhr.readyState == 4 && xhr.status == 200) { |
| 20 onFinished(); |
| 21 } |
| 22 }; |
| 23 return xhr; |
| 24 } |
| 25 |
| 26 mediasource_test(function(test, mediaElement, mediaSource) |
| 27 { |
| 28 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD
IO_ONLY_TYPE); |
| 29 sourceBuffer.mode = 'sequence'; |
| 30 |
| 31 function onUpdateEnd() { |
| 32 var xhr = createMediaXHR(test, function() |
| 33 { |
| 34 // We are appending data repeatedly in sequence mode, ther
e should be no gaps. |
| 35 assert_false(sourceBuffer.buffered.length > 1, "unexpected
gap in buffered ranges."); |
| 36 try { |
| 37 sourceBuffer.appendStream(xhr.response); |
| 38 } catch(ex) { |
| 39 assert_equals(ex.name, 'QuotaExceededError'); |
| 40 test.done(); |
| 41 } |
| 42 test.expectEvent(sourceBuffer, "updateend", "Append ended.
"); |
| 43 test.waitForExpectedEvents(onUpdateEnd); |
| 44 }); |
| 45 xhr.send(); |
| 46 } |
| 47 // Start appending data |
| 48 onUpdateEnd(); |
| 49 }, 'Calling appendStream repeatedly should fill up the buffer and thro
w a QuotaExceededError when buffer is full.'); |
| 50 </script> |
| 51 </body> |
| 52 </html> |
OLD | NEW |