Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: LayoutTests/http/tests/media/media-source/mediasource-removesourcebuffer.html

Issue 245893002: Improve unprefixed MediaSource test coverage. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/media/media-source/mediasource-removesourcebuffer.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-removesourcebuffer.html b/LayoutTests/http/tests/media/media-source/mediasource-removesourcebuffer.html
new file mode 100644
index 0000000000000000000000000000000000000000..09b41e61000a84b8a99fb0254a83a9e909f67cdb
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-removesourcebuffer.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>
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE);
+ assert_true(sourceBuffer != null, "New SourceBuffer returned");
+
+ mediaSource.removeSourceBuffer(sourceBuffer);
+
+ var sourceBuffer2 = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE);
+ assert_true(sourceBuffer2 != null, "New SourceBuffer returned");
+ assert_true(sourceBuffer != sourceBuffer2, "SourceBuffers are different instances.");
+ assert_equals(mediaSource.sourceBuffers.length, 1, "sourceBuffers.length == 1");
+
+ test.done();
+ }, "Test addSourceBuffer(), removeSourceBuffer(), addSourceBuffer() sequence.");
+
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ assert_throws("InvalidAccessError",
+ function() { mediaSource.removeSourceBuffer(null); },
+ "removeSourceBuffer() threw an exception when passed null.");
+ test.done();
+ }, "Test removeSourceBuffer() with null");
+
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE);
+ assert_true(sourceBuffer != null, "New SourceBuffer returned");
+
+ mediaSource.removeSourceBuffer(sourceBuffer);
+
+ assert_throws("NotFoundError",
+ function() { mediaSource.removeSourceBuffer(sourceBuffer); },
+ "removeSourceBuffer() threw an exception when a SourceBuffer that was already removed.");
+
+ test.done();
+ }, "Test calling removeSourceBuffer() twice with the same object.");
+
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698