Chromium Code Reviews| Index: LayoutTests/http/tests/media/media-source/mediasource-appendstream-quota-exceeded.html |
| diff --git a/LayoutTests/http/tests/media/media-source/mediasource-appendstream-quota-exceeded.html b/LayoutTests/http/tests/media/media-source/mediasource-appendstream-quota-exceeded.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..482d20759ff06c203cc1fc51fd4c4812920af0a7 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/media/media-source/mediasource-appendstream-quota-exceeded.html |
| @@ -0,0 +1,52 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <head> |
| + <script src="/w3c/resources/testharness.js"></script> |
| + <script src="/w3c/resources/testharnessreport.js"></script> |
| + <script src="mediasource-util.js"></script> |
| + <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
| + </head> |
| + <body> |
| + <div id="log"></div> |
| + <script> |
| + function createMediaXHR(test, onFinished) { |
| + var mediaURL = "/media/resources/media-source/webm/test-a-5min-44100Hz-1ch.webm"; |
| + var xhr = new XMLHttpRequest(); |
| + xhr.open('GET', mediaURL, true); |
| + xhr.responseType = 'legacystream'; |
| + test.failOnEvent(xhr, 'error'); |
| + xhr.onreadystatechange = function() { |
| + if (xhr.readyState == 4 && xhr.status == 200) { |
| + onFinished(); |
| + } |
| + }; |
| + return xhr; |
| + } |
| + |
| + mediasource_test(function(test, mediaElement, mediaSource) |
| + { |
| + var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE); |
| + sourceBuffer.mode = 'sequence'; |
| + |
| + function onUpdateEnd() { |
| + var xhr = createMediaXHR(test, function() |
| + { |
| + // We are appending data repeatedly in sequence mode, there should be no gaps. |
| + assert_false(sourceBuffer.buffered.length > 1, "unexpected gap in buffered ranges."); |
| + try { |
| + sourceBuffer.appendStream(xhr.response); |
| + } catch(ex) { |
| + assert_equals(ex.name, 'QuotaExceededError'); |
| + test.done(); |
| + } |
| + test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| + test.waitForExpectedEvents(onUpdateEnd); |
| + }); |
| + xhr.send(); |
| + } |
| + // Start appending data |
| + onUpdateEnd(); |
| + }, 'Calling appendStream repeatedly should fill up the buffer and throw a QuotaExceededError when buffer is full.'); |
|
wolenetz
2015/08/21 20:11:15
aside: Looks good for the Chromium implementation.
|
| + </script> |
| + </body> |
| +</html> |