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

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: Reduce test flakiness. 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..95bef19874655b9058dcea8f8dc8dfc3d05d3ce5
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html
@@ -0,0 +1,77 @@
+<!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');
+ 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);
+ }
+
+ function getSegment(mediaData, info)
+ {
+ var start = info.offset;
+ var end = start + info.size;
+ return mediaData.subarray(start, end);
+ }
+
+ 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);
+
+ function playAndSeek(test, mediaElement)
wolenetz 2013/07/30 18:44:21 nit: prefer 'var someTimeoutHandlerVariable = test
anandc 2013/07/31 00:41:44 The 1st part is done. The 2nd part: PS5 now calls
+ {
+ assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.');
+ mediaElement.currentTime = 0.0;
+
+ test.waitForExpectedEvents(function()
+ {
+ 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');
+ function confirmPlaying(test, mediaElement)
wolenetz 2013/07/30 18:44:21 nit: ditto of my playAndSeek() comment, above.
anandc 2013/07/31 00:41:44 Done.
+ {
+ assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started after seek.');
+ test.done();
+ }
+ setTimeout(function() {confirmPlaying(test, mediaElement)}, 300);
+ });
+
+ }
+
+ test.waitForExpectedEvents(function()
+ {
+ setTimeout(function() {playAndSeek(test, mediaElement)}, 300);
+ test.expectEvent(mediaElement, 'seeking', 'mediaElement');
wolenetz 2013/07/30 18:44:21 nit: This makes more sense just prior to setting t
anandc 2013/07/31 00:41:44 Agreed. 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