Index: LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html |
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html b/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html |
index 50134beb7b3d6a4b9291c638432cf2b464b356b2..523a005d269f2362fbc0ea4e5f2a4f40383649f4 100644 |
--- a/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html |
+++ b/LayoutTests/http/tests/media/media-source/mediasource-addsourcebuffer.html |
@@ -12,6 +12,15 @@ |
<script> |
mediasource_test(function(test, mediaElement, mediaSource) |
{ |
+ mediaSource.endOfStream(); |
+ assert_throws("InvalidStateError", |
+ function() { mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); }, |
+ "addSourceBuffer() threw an exception when in 'ended' state."); |
+ test.done(); |
+ }, "Test addSourceBuffer() in 'ended' state."); |
+ |
+ mediasource_test(function(test, mediaElement, mediaSource) |
+ { |
assert_throws("InvalidAccessError", |
function() { mediaSource.addSourceBuffer(""); }, |
"addSourceBuffer() threw an exception when passed an empty string."); |
@@ -26,7 +35,6 @@ |
test.done(); |
}, "Test addSourceBuffer() with unsupported type"); |
- |
mediasource_test(function(test, mediaElement, mediaSource) |
{ |
var mimetype = 'video/webm;codecs="vp8,vorbis"'; |
@@ -86,6 +94,25 @@ |
assert_equals(mediaSource.activeSourceBuffers[1], sourceBufferB, "sourceBufferB is in mediaSource.activeSourceBuffers"); |
test.done(); |
}, "Test addSourceBuffer() with AAC and H.264 in separate SourceBuffers"); |
+ |
+ mediasource_test(function(test, mediaElement, mediaSource) |
+ { |
+ var reachedLimit = false; |
+ |
+ // The 20 here is an arbitrary upper limit to make sure the test terminates. This test |
+ // assumes that implementations won't support more than 20 SourceBuffers simultaneously. |
+ for (var i = 0; i < 20; ++i) { |
+ try { |
+ mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); |
+ } catch(e) { |
+ assert_equals(e.name, "QuotaExceededError"); |
+ reachedLimit = true; |
+ break; |
+ } |
+ } |
+ assert_true(reachedLimit, "Reached SourceBuffer limit."); |
+ test.done(); |
+ }, "Test addSourceBuffer() QuotaExceededError."); |
</script> |
</body> |
</html> |