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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-initsegmentreceived-alg.html

Issue 1678523003: Implement InitSegmentReceived algorithm in blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-sb-audiotrack
Patch Set: rebase Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediasource/SourceBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-initsegmentreceived-alg.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-initsegmentreceived-alg.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-initsegmentreceived-alg.html
new file mode 100644
index 0000000000000000000000000000000000000000..f958c92e1a01f28866c43ebf82f09c270f60ed18
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-initsegmentreceived-alg.html
@@ -0,0 +1,61 @@
+<!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">
wolenetz 2016/05/12 20:42:04 nit: drop this link -- it's auto-included already
servolk 2016/06/21 17:44:52 Done.
+ </head>
+ <body>
+ <div id="log"></div>
wolenetz 2016/05/12 20:42:04 nit: drop this div. unnecessary legacy cruft copy-
servolk 2016/06/21 17:44:52 Done.
+ <script>
+
+ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+ {
+ var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
wolenetz 2016/05/12 20:42:04 nit: 4-space script indent here and below.
servolk 2016/06/21 17:44:52 Done.
+ test.expectEvent(sourceBuffer.audioTracks, 'addtrack', 'sourceBuffer.videoTracks addtrack event');
wolenetz 2016/05/12 20:42:04 nit: use ' or " consistently within the script bod
servolk 2016/06/21 17:44:52 Done.
+ test.expectEvent(sourceBuffer.videoTracks, 'addtrack', 'sourceBuffer.videoTracks addtrack event');
+ test.expectEvent(mediaElement.audioTracks, 'addtrack', 'mediaElement.videoTracks addtrack event');
+ test.expectEvent(mediaElement.videoTracks, 'addtrack', 'mediaElement.videoTracks addtrack event');
+ test.expectEvent(mediaElement, 'durationchange', 'mediaElement got duration');
+ test.expectEvent(sourceBuffer, 'updateend', 'InitSegment append ended.');
+ test.expectEvent(mediaElement, 'loadedmetadata', 'loadedmetadata event received.');
+ sourceBuffer.appendBuffer(initSegment);
+ test.waitForExpectedEvents(function()
+ {
+ assert_equals(mediaElement.readyState, mediaElement.HAVE_METADATA);
+ assert_equals(mediaElement.duration, 6.042);
wolenetz 2016/05/12 20:42:04 nit: use the field from segmentInfo, not hardcodin
servolk 2016/06/21 17:44:52 Done.
+ assert_equals(mediaElement.audioTracks.length, 1, "mediaElement.audioTracks.length");
+ assert_equals(mediaElement.videoTracks.length, 1, "mediaElement.videoTracks.length");
+ assert_equals(sourceBuffer.audioTracks.length, 1, "sourceBuffer.audioTracks.length");
+ assert_equals(sourceBuffer.videoTracks.length, 1, "sourceBuffer.videoTracks.length");
+ assert_equals(mediaElement.audioTracks[0], sourceBuffer.audioTracks[0], "mediaElement.audioTrack == sourceBuffer.audioTrack");
+ assert_equals(mediaElement.videoTracks[0], sourceBuffer.videoTracks[0], "mediaElement.videoTrack == sourceBuffer.videoTrack");
+ // The first audio track is enabled by default.
+ assert_true(sourceBuffer.audioTracks[0].enabled, "sourceBuffer.audioTracks[0].enabled");
+ // The first video track is selected by default.
+ assert_true(sourceBuffer.videoTracks[0].selected, "sourceBuffer.videoTracks[0].selected");
+
+ // Now append the same exact init segment again. This should succeed, but no new tracks should
+ // be added to the SourceBuffer or MediaElement.
+ test.failOnEvent(sourceBuffer.audioTracks, 'addtrack', 'Unexpected addtrack event on sourceBuffer.audioTracks for second init segment');
+ test.failOnEvent(sourceBuffer.videoTracks, 'addtrack', 'Unexpected addtrack event on sourceBuffer.videoTracks for second init segment');
+ test.failOnEvent(mediaElement.audioTracks, 'addtrack', 'Unexpected addtrack event on mediaElement.audioTracks for second init segment');
+ test.failOnEvent(mediaElement.videoTracks, 'addtrack', 'Unexpected addtrack event on mediaElement.videoTracks for second init segment');
+
+ test.expectEvent(sourceBuffer, 'updateend', 'InitSegment append ended.');
+ sourceBuffer.appendBuffer(initSegment);
+ });
+ test.waitForExpectedEvents(function()
+ {
+ assert_equals(mediaElement.audioTracks.length, 1, "mediaElement.audioTracks.length");
+ assert_equals(mediaElement.videoTracks.length, 1, "mediaElement.videoTracks.length");
+ assert_equals(sourceBuffer.audioTracks.length, 1, "sourceBuffer.audioTracks.length");
+ assert_equals(sourceBuffer.videoTracks.length, 1, "sourceBuffer.videoTracks.length");
+ test.done();
+ });
+ }, 'Init segment received algorithm');
+
wolenetz 2016/05/12 20:42:04 Please add testing of the application of TrackDefa
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediasource/SourceBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698