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

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: Fix nits 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..80516eb1ec822ef379380d9d3329cb6423617b79 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,52 @@
});
}, '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); // Pick first 95% of segment bytes.
+ 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_equals(sourceBuffer.mode, 'segments');
+ 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_equals(sourceBuffer.mode, 'segments');
+ assert_throws('InvalidStateError',
+ function() { sourceBuffer.mode = 'segments'; },
+ 'Setting valid sourceBuffer.mode while still parsing media segment threw InvalidStateError.');
+
+ // 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_equals(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