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

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: Fix indentation. Created 7 years, 4 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-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..74512678cc8ccdb823c6cdb62e5288d33d818c42
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html
@@ -0,0 +1,83 @@
+<!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>
+
+ function seekBackAfterPlayingTest(testFunction, description, options)
+ {
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var segmentInfo = WebMSegmentInfo.testWebM;
+ assert_equals(segmentInfo.duration, 6.042, 'Expected test media duration');
acolwell GONE FROM CHROMIUM 2013/08/05 21:06:06 nit: Why do you need to verify this specific value
anandc 2013/08/06 18:03:30 Done.
+ test.failOnEvent(mediaElement, 'error');
+
+ var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type);
+ MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(mediaData)
+ {
+ testFunction(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData);
+ });
+ }, description, options);
+ }
+
+ seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+ {
+
+ mediaElement.play();
+ // Append all the segments
+ test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+ test.expectEvent(mediaElement, 'playing', 'Playing triggered');
+ sourceBuffer.appendBuffer(mediaData);
+
+ var confirmPlayThenEnd = test.step_func(function()
acolwell GONE FROM CHROMIUM 2013/08/05 21:06:06 nit: I don't think you should need test.step_func(
anandc 2013/08/06 18:03:30 Done.
+ {
+ var delayedPlayHandlerThatEnds = test.step_func(function()
acolwell GONE FROM CHROMIUM 2013/08/05 21:06:06 nit: I don't think you should use test.step_func()
anandc 2013/08/06 18:03:30 Done.
+ {
+ assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started after seek.');
+ test.done();
+ });
+ test.expectDelayedCallback(delayedPlayHandlerThatEnds, 300);
acolwell GONE FROM CHROMIUM 2013/08/05 21:06:06 nit: 300ms seems arbitrary. Should this just be ba
anandc 2013/08/06 18:03:30 Moved delay to expectDelayCallback, defaulting to
+ });
+
+ var finishSeekThenPlay = test.step_func(function()
acolwell GONE FROM CHROMIUM 2013/08/05 21:06:06 nit: I don't think step_func() is needed here.
anandc 2013/08/06 18:03:30 Done.
+ {
+ assert_true(mediaElement.seeking, 'mediaElement is seeking');
+ assert_equals(mediaElement.currentTime, 0.0, 'Current time is 0.0');
+ test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fired.');
+ test.expectEvent(mediaElement, 'seeked', 'mediaElement finished seek');
+
+ test.waitForExpectedEvents(function()
+ {
+ confirmPlayThenEnd();
+ });
+ });
+
+ var delayedPlayHandler = test.step_func(function()
acolwell GONE FROM CHROMIUM 2013/08/05 21:06:06 ditto and the "function delayedPlayHandler()" form
anandc 2013/08/06 18:03:30 Done.
+ {
+ assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.');
+ test.expectEvent(mediaElement, 'seeking', 'mediaElement');
+ mediaElement.currentTime = 0.0;
+
+ test.waitForExpectedEvents(function()
+ {
+ finishSeekThenPlay();
+ });
+ });
+
+ test.waitForExpectedEvents(function()
+ {
+ test.expectDelayedCallback(delayedPlayHandler, 300);
+ });
+
+ }, 'Test playing then seeking back.');
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698