| Index: LayoutTests/http/tests/media/media-source/mediasource-evict-frames.html
|
| diff --git a/LayoutTests/http/tests/media/media-source/mediasource-evict-frames.html b/LayoutTests/http/tests/media/media-source/mediasource-evict-frames.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3970cdbb515fbd9c82a6f339ae757d5114d7df58
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/media/media-source/mediasource-evict-frames.html
|
| @@ -0,0 +1,84 @@
|
| +<!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>
|
| + // Fill up a given SourceBuffer by appending data repeatedly via doAppendDataFunc until
|
| + // an exception is thrown. The thrown exception is passed to onCaughtExceptionCallback.
|
| + function fillUpSourceBuffer(test, sourceBuffer, doAppendDataFunc, onCaughtExceptionCallback) {
|
| + // 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 {
|
| + doAppendDataFunc();
|
| + } catch(ex) {
|
| + onCaughtExceptionCallback(ex);
|
| + }
|
| + test.expectEvent(sourceBuffer, 'updateend', 'append ended.');
|
| + test.waitForExpectedEvents(function() { fillUpSourceBuffer(test, sourceBuffer, doAppendDataFunc, onCaughtExceptionCallback); });
|
| + }
|
| +
|
| + mediasource_test(function(test, mediaElement, mediaSource)
|
| + {
|
| + MediaSourceUtil.fetchManifestAndData(test, 'webm/test-a-192k-44100Hz-1ch-manifest.json', function(type, mediaData)
|
| + {
|
| + var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
|
| + sourceBuffer.mode = 'sequence';
|
| +
|
| + fillUpSourceBuffer(test, sourceBuffer,
|
| + function () { // doAppendDataFunc
|
| + sourceBuffer.appendBuffer(mediaData);
|
| + },
|
| + function (ex) { // onCaughtExceptionCallback
|
| + assert_equals(ex.name, 'QuotaExceededError');
|
| + test.done();
|
| + });
|
| + });
|
| + }, 'Appending data repeatedly should fill up the buffer and throw a QuotaExceededError when buffer is full.', {timeout: 25000});
|
| +
|
| + function createMediaXHR(test, onFinished) {
|
| + var mediaURL = "/media/resources/media-source/webm/test-a-192k-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.', {timeout: 45000});
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|