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

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

Issue 136523004: Add PARSING_MEDIA_SEGMENT layout test for SourceBuffer mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html b/LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html
index 33e01574039dc101565da98d0e49edd4eaa63250..e4127fe6c5d1ff537f80be7174ba3c944c164b29 100644
--- a/LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html
+++ b/LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode.html
@@ -79,8 +79,53 @@
});
}, 'Test setting SourceBuffer.mode triggers parent MediaSource \'ended\' to \'open\' transition.');
- // FIXME: Once enough Chromium implementation lands, add tests for at least confirming exception if append
- // state is PARSING_MEDIA_SEGMENT (per 3.1 setting mode steps 6-7). See http://crbug.com/249422.
+ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+ {
+ var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+ var fullMediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
+ var truncateAt = Math.floor(segmentInfo.media[0].size * 0.95); // e.g. first 11238 bytes of 11830
acolwell GONE FROM CHROMIUM 2014/01/14 18:20:27 nit: Change the comment to something like 95% of t
wolenetz 2014/01/14 19:30:44 Done.
+ var partialMediaSegment = fullMediaSegment.subarray(0, truncateAt);
+ var mediaSegmentRemainder = fullMediaSegment.subarray(truncateAt);
+
+ // Append init segment.
+ test.expectEvent(sourceBuffer, 'updateend', 'Init segment append ended.');
+ sourceBuffer.appendBuffer(initSegment);
+
+ test.waitForExpectedEvents(function()
+ {
+ assert_false(sourceBuffer.updating, 'updating attribute is false');
+ assert_true(sourceBuffer.mode == 'segments');
acolwell GONE FROM CHROMIUM 2014/01/14 18:20:27 nit: use assert_equals here and in similar checks
wolenetz 2014/01/14 19:30:44 Done.
+ sourceBuffer.mode = 'segments'; // No exception should occur.
+
+ // Append first part of media segment.
+ test.expectEvent(sourceBuffer, 'updateend', 'Partial media segment append ended.');
+ sourceBuffer.appendBuffer(partialMediaSegment);
+ });
+
+ test.waitForExpectedEvents(function()
+ {
+ assert_false(sourceBuffer.updating, 'updating attribute is false');
+ assert_true(sourceBuffer.mode == 'segments');
+ assert_throws('InvalidStateError',
+ function() { sourceBuffer.mode = 'segments'; },
+ 'Setting valid sourceBuffer.mode while still parsing media segment threw InvalidStateError.');
+ test.done();
acolwell GONE FROM CHROMIUM 2014/01/14 18:20:27 nit: remove since it doesn't appear the test is ac
wolenetz 2014/01/14 19:30:44 Oh wow! This was a test debugging item I forgot to
+
+ // Append remainder of media segment.
+ test.expectEvent(sourceBuffer, 'updateend', 'Append ended of remainder of media segment.');
+ sourceBuffer.appendBuffer(mediaSegmentRemainder);
+ });
+
+ test.waitForExpectedEvents(function()
+ {
+ assert_false(sourceBuffer.updating, 'updating attribute is false');
+ assert_true(sourceBuffer.mode == 'segments');
+ sourceBuffer.mode = 'segments'; // No exception should occur.
+ test.done();
+ });
+ }, 'Test setting SourceBuffer.mode while parsing media segment.');
+
+ // FIXME: Once 'sequence' mode implemented, add verification. See http://crbug.com/249422.
</script>
</body>
</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-sourcebuffer-mode-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698