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

Unified Diff: LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html

Issue 20114005: Layout Test for basic MSE seek scenario. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-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-play-then-seek-back.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html b/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html
new file mode 100644
index 0000000000000000000000000000000000000000..6a8fdb6d2ea06147cf772ebe3f65ec192d84b81f
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="/w3c/resources/testharness.js"></script>
+ <script src="/w3c/resources/testharnessreport.js"></script>
+ <script src="mediasource-util.js"></script>
+ <script src="/media/resources/media-source/webm/segment-info.js"></script>
+ <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var segmentInfo = WebMSegmentInfo.testWebM;
+
+ function seekBackAfterPlayingTest(callback, description)
+ {
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type);
+ MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(mediaData)
+ {
+ callback(test, mediaElement, mediaSource, sourceBuffer, mediaData);
+ });
+ }, description, {timeout: 10000} );
+ }
+
+ seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+ {
+ test.failOnEvent(mediaElement, 'error');
+
+ mediaElement.play();
+
+ // Append all media segments.
+ // Expect playing and timeupdate events.
+ test.expectEvent(mediaElement, "playing", "Playing triggered");
wolenetz 2013/07/24 23:16:43 style nit: prefer ' over " in js (multiple places
anandc 2013/07/25 22:48:00 Done.
+ test.expectEvent(mediaElement, "timeupdate", "timeupdate fired.");
+ sourceBuffer.appendBuffer(mediaData);
+
+ test.waitForExpectedEvents(function()
+ {
+ if (mediaElement.currentTime > 0.5 ) {
wolenetz 2013/07/24 23:16:43 style nit: 4-space indent (multiple places in this
anandc 2013/07/25 22:48:00 Done.
+ assert_greater_than(mediaElement.currentTime, 0.1);
wolenetz 2013/07/24 23:16:43 Why are we asserting within a conditional that alr
anandc 2013/07/25 22:48:00 Yes, that was pretty stupid. :-) Gone.
+ assert_true(mediaElement.playing, "mediaElement is playing");
+ // Seek back to 0.0
+ test.expectEvent(mediaElement, "seeking", "mediaElement");
+ test.expectEvent(mediaElement, "seeked", "mediaElement finished seek");
wolenetz 2013/07/24 23:16:43 You'll need a 'timeupdate' expectation between 'se
anandc 2013/07/25 22:48:00 Based on all your comments, adding an explicit wai
+ test.expectEvent(mediaElement, "playing", "Playing triggered");
wolenetz 2013/07/24 23:16:43 I don't think 'playing' is expected here, unless t
anandc 2013/07/26 18:49:22 Correct, rearranged the flow now.
+ test.expectEvent(mediaElement, "timeupdate", "timeupdate fired.");
wolenetz 2013/07/24 23:16:43 Note for future: you'll actually get lots and lots
anandc 2013/07/26 18:49:22 ok
+ mediaElement.currentTime = 0.0;
+ }
+ });
+
+ test.waitForExpectedEvents(function()
wolenetz 2013/07/24 23:16:43 It's highly likely that the previous currentTime >
anandc 2013/07/26 18:49:22 Done.
+ {
+ assert_greater_than(mediaElement.readyState,
+ mediaElement.HAVE_FUTURE_DATA, "Greater than HAVE_FUTURE_DATA");
wolenetz 2013/07/24 23:16:43 I'm not sure all implementations can guarantee the
anandc 2013/07/26 18:49:22 Removed.
+ test.done();
+ });
+
+ }, "Test playing then seeking back.");
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698