Index: LayoutTests/http/tests/media/media-source/mediasource-closed.html |
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-closed.html b/LayoutTests/http/tests/media/media-source/mediasource-closed.html |
index 13e41bfa9e2f8ab4090842a2944237f5fc0317cd..b70b439d62932d3e5e7b7e6835fa6e1692083b10 100644 |
--- a/LayoutTests/http/tests/media/media-source/mediasource-closed.html |
+++ b/LayoutTests/http/tests/media/media-source/mediasource-closed.html |
@@ -36,6 +36,7 @@ |
assert_equals(mediaSource.sourceBuffers.length, 0, "sourceBuffers is empty"); |
assert_equals(mediaSource.activeSourceBuffers.length, 0, "activeSourceBuffers is empty"); |
assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'"); |
+ assert_true(Number.isNaN(mediaSource.duration), "duration is NaN"); |
assert_throws("NotFoundError", |
function() { mediaSource.removeSourceBuffer(sourceBuffer); }, |
"removeSourceBuffer() throws an exception when closed."); |
@@ -54,6 +55,22 @@ |
"endOfStream() throws an exception when closed."); |
}, "Test endOfStream() while closed."); |
+ test(function () |
+ { |
+ var mediaSource = new MediaSource(); |
+ assert_throws("InvalidStateError", |
+ function() { mediaSource.endOfStream("decode"); }, |
+ "endOfStream(decode) throws an exception when closed."); |
+ }, "Test endOfStream(decode) while closed."); |
+ |
+ test(function () |
+ { |
+ var mediaSource = new MediaSource(); |
+ assert_throws("InvalidStateError", |
+ function() { mediaSource.endOfStream("network"); }, |
+ "endOfStream(network) throws an exception when closed."); |
+ }, "Test endOfStream(network) while closed."); |
+ |
test(function () |
{ |
@@ -63,6 +80,41 @@ |
"Setting duration throws an exception when closed."); |
}, "Test setting duration while closed."); |
+ mediasource_test(function(test, mediaElement, mediaSource) |
+ { |
+ var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE); |
+ |
+ assert_equals(mediaSource.readyState, "open", "readyState is 'open'"); |
+ // Setup a handler to run when the MediaSource closes. |
+ mediaSource.addEventListener('sourceclose', test.step_func(function (event) |
+ { |
+ assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'"); |
+ assert_throws("InvalidStateError", |
+ function() { mediaSource.duration = 10; }, |
+ "Setting duration when closed throws an exception"); |
+ test.done(); |
+ })); |
+ |
+ // Trigger the MediaSource to close. |
+ mediaElement.src = ""; |
+ }, "Test setting duration while open->closed."); |
+ |
+ mediasource_test(function(test, mediaElement, mediaSource) |
+ { |
+ var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE); |
+ |
+ assert_equals(mediaSource.readyState, "open", "readyState is 'open'"); |
+ // Setup a handler to run when the MediaSource closes. |
+ mediaSource.addEventListener('sourceclose', test.step_func(function (event) |
+ { |
+ assert_equals(mediaSource.readyState, "closed", "readyState is 'closed'"); |
+ assert_true(Number.isNaN(mediaSource.duration), "duration is NaN"); |
+ test.done(); |
+ })); |
+ |
+ // Trigger the MediaSource to close. |
+ mediaElement.src = ""; |
+ }, "Test getting duration while open->closed."); |
</script> |
</body> |
</html> |