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

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

Issue 14876007: Add Blink side support for SourceBuffer.appendWindowStart & SourceBuffer.appendWindowEnd. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: throw DOMException for set appendwindow error Created 7 years, 5 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-appendwindow.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-appendwindow.html b/LayoutTests/http/tests/media/media-source/mediasource-appendwindow.html
new file mode 100644
index 0000000000000000000000000000000000000000..f54be248b32e6efb5393248ba77a854706e09c57
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-appendwindow.html
@@ -0,0 +1,120 @@
+<!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_loaddata_test = function(callback, description)
+ {
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var mediaType = 'video/webm;codecs="vp8,vorbis"';
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: Move this to a higher scope and reused the va
+ var mediaURL = '/media/resources/media-source/webm/test.webm';
+ var sourceBuffer = mediaSource.addSourceBuffer(mediaType);
+ MediaSourceUtil.loadBinaryData(test, mediaURL, function(mediaData)
+ {
+ callback(test, mediaElement, mediaSource, sourceBuffer, mediaData);
+
+ });
+ }, description);
+ };
+
+ mediasource_test(function(test, mediaElement, mediaSource)
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: add a space to fix indent.
+ {
+ var mimetype = 'video/webm;codecs="vp8,vorbis"';
+ var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
+ assert_true(sourceBuffer != null, "New SourceBuffer returned");
+
+ sourceBuffer.appendWindowStart = 100.0;
+ sourceBuffer.appendWindowEnd = 500.0;
+ assert_equals(sourceBuffer.appendWindowStart, 100.0, "appendWindowStart is correctly set'");
+ assert_equals(sourceBuffer.appendWindowEnd, 500.0, "appendWindowEnd is correctly set'");
+
+ sourceBuffer.appendWindowStart = 200.0;
+ sourceBuffer.appendWindowEnd = 400.0;
+ assert_equals(sourceBuffer.appendWindowStart, 200.0, "appendWindowStart is correctly reset'");
+ assert_equals(sourceBuffer.appendWindowEnd, 400.0, "appendWindowEnd is correctly reset'");
+ test.done();
+ }, "Test correctly reset appendWindowStart and appendWindowEnd values");
+
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var mimetype = 'video/webm;codecs="vp8,vorbis"';
+ var sourceBuffer = mediaSource.addSourceBuffer(mimetype);
+ assert_true(sourceBuffer != null, "New SourceBuffer returned");
+ sourceBuffer.appendWindowEnd = 500.0;
+
+ assert_throws("InvalidAccessError",
+ function() { sourceBuffer.appendWindowStart = 600.0; },
+ "set appendWindowStart throws an exception when greater than appendWindowEnd.");
+
+ assert_throws("InvalidAccessError",
+ function() { sourceBuffer.appendWindowStart = -100.0; },
+ "set appendWindowStart throws an exception when less than 0.");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: Test appendWindowStart with Number.NEGATIVE_I
+
+ assert_throws("InvalidAccessError",
+ function() { sourceBuffer.appendWindowEnd = "string"; },
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/"string"/Number.NaN/ since the description e
+ "set appendWindowEnd throws an exception if NaN.");
+ test.done();
+ }, "Test set wrong values to appendWindowStart and appendWindowEnd.");
+
+ mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+ {
+ sourceBuffer.appendBuffer(mediaData);
+
+ mediaSource.removeSourceBuffer(sourceBuffer);
+ assert_throws("InvalidStateError",
+ function() { sourceBuffer.appendWindowStart = 100.0; },
+ "set appendWindowStart throws an exception when mediasource object is not associated with an buffer.");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: s/an buffer/a buffer/
+
+ assert_throws("InvalidStateError",
+ function() { sourceBuffer.appendWindowEnd = 500.0; },
+ "set appendWindowEnd throws an exception when mediasource object is not associated with an buffer.");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit: s/an buffer/a buffer/
+ test.done();
+
+ }, "Test appendwindow throw error when mediasource object is not associated with an sourebuffer.");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/an sourebuffer/a sourcebuffer/
+
+ mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+ {
+ sourceBuffer.appendBuffer(mediaData);
+ assert_true(sourceBuffer.updating, "updating attribute is true");
+
+ assert_throws("InvalidStateError",
+ function() { sourceBuffer.appendWindowStart = 100.0; },
+ "set appendWindowStart throws an exception when there is a pending append.");
+
+ assert_throws("InvalidStateError",
+ function() { sourceBuffer.appendWindowEnd = 500.0; },
+ "set appendWindowEnd throws an exception when there is a pending append.");
+
+ test.waitForExpectedEvents(function()
+ {
+ assert_false(sourceBuffer.updating, "updating attribute is false");
+ test.done();
+ });
+ }, "Test set appendWindowStart and appendWindowEnd when source buffer updating.");
+
+ mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+ {
+ sourceBuffer.appendBuffer(mediaData);
+ assert_true(sourceBuffer.updating, "updating attribute is true");
+
+ sourceBuffer.abort();
+ assert_equals(sourceBuffer.appendWindowStart, 0, "appendWindowStart is 0 when abort'");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/when/after an/
+ assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY,
+ "appendWindowStart is POSITIVE_INFINITY when abort");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/when/after an/
+ test.waitForExpectedEvents(function()
+ {
+ assert_false(sourceBuffer.updating, "updating attribute is false");
+ test.done();
+ });
+ }, "Test appendWindowStart and appendWindowEnd value if sourceBuffer.abort().");
acolwell GONE FROM CHROMIUM 2013/08/06 18:10:33 nit:s/if/after a/
+
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698