blob: 8c4a2371250b02ca483569e973348e9adb752f58 [file] [log] [blame]
François Daoustade80c42016-06-30 07:43:591<!DOCTYPE html>
Matt Wolenetzb255ded2016-08-30 19:39:412<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
François Daoustade80c42016-06-30 07:43:593<meta charset="utf-8">
4<script src="/resources/testharness.js"></script>
5<script src="/resources/testharnessreport.js"></script>
6<script src="mediasource-util.js"></script>
7<script>
8 // Fill up a given SourceBuffer by appending data repeatedly via doAppendDataFunc until
9 // an exception is thrown. The thrown exception is passed to onCaughtExceptionCallback.
10 function fillUpSourceBuffer(test, sourceBuffer, doAppendDataFunc, onCaughtExceptionCallback) {
11 // We are appending data repeatedly in sequence mode, there should be no gaps.
12 assert_false(sourceBuffer.buffered.length > 1, "unexpected gap in buffered ranges.");
13 try {
14 doAppendDataFunc();
15 } catch(ex) {
16 onCaughtExceptionCallback(ex);
17 }
18 test.expectEvent(sourceBuffer, 'updateend', 'append ended.');
19 test.waitForExpectedEvents(function() { fillUpSourceBuffer(test, sourceBuffer, doAppendDataFunc, onCaughtExceptionCallback); });
20 }
21
22 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
23 {
24 sourceBuffer.mode = 'sequence';
25 fillUpSourceBuffer(test, sourceBuffer,
26 function () { // doAppendDataFunc
27 sourceBuffer.appendBuffer(mediaData);
28 },
29 function (ex) { // onCaughtExceptionCallback
30 assert_equals(ex.name, 'QuotaExceededError');
31 test.done();
32 });
33 }, 'Appending data repeatedly should fill up the buffer and throw a QuotaExceededError when buffer is full.');
Matt Wolenetzb255ded2016-08-30 19:39:4134</script>