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

Side by Side 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: Code cleanup and reorganisation. 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script>
6 <script src="mediasource-util.js"></script>
7 <script src="/media/resources/media-source/webm/segment-info.js"></scrip t>
8 <link rel="stylesheet" href="/w3c/resources/testharness.css">
9 </head>
10 <body>
11 <div id='log'></div>
12
13 <script>
14
15 function seekBackAfterPlayingTest(testFunction, description, options )
16 {
17 mediasource_test(function(test, mediaElement, mediaSource)
18 {
19 var segmentInfo = WebMSegmentInfo.testWebM;
20 test.failOnEvent(mediaElement, 'error');
21
22 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.t ype);
23 MediaSourceUtil.loadBinaryData(test, segmentInfo.url, functi on(mediaData)
24 {
25 testFunction(test, mediaElement, mediaSource, segmentInf o, sourceBuffer, mediaData);
26 });
27 }, description, options);
28 }
29
30 seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, s egmentInfo, sourceBuffer, mediaData)
31 {
32
33 mediaElement.play();
34 // Append all the segments
35 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
36 test.expectEvent(mediaElement, 'playing', 'Playing triggered');
37 sourceBuffer.appendBuffer(mediaData);
38
39 function confirmPlayThenEnd()
40 {
41 function delayedPlayHandlerThatEnds()
42 {
43 assert_greater_than(mediaElement.currentTime, 0.0, 'Play back has started after seek.');
44 test.done();
45 }
46 test.expectDelayedCallback(delayedPlayHandlerThatEnds);
47 }
48
49 function finishSeekThenPlay()
50 {
51 assert_true(mediaElement.seeking, 'mediaElement is seeking') ;
52 assert_equals(mediaElement.currentTime, 0.0, 'Current time i s 0.0');
53 test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fir ed.');
54 test.expectEvent(mediaElement, 'seeked', 'mediaElement finis hed seek');
55
56 test.waitForExpectedEvents(function()
57 {
58 confirmPlayThenEnd();
59 });
60 }
61
62 function delayedPlayHandler()
63 {
64 assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.');
65 test.expectEvent(mediaElement, 'seeking', 'mediaElement');
66 mediaElement.currentTime = 0.0;
67
68 test.waitForExpectedEvents(function()
69 {
70 finishSeekThenPlay();
71 });
72 }
73
74 test.waitForExpectedEvents(function()
75 {
76 test.expectDelayedCallback(delayedPlayHandler);
acolwell GONE FROM CHROMIUM 2013/08/06 18:42:37 After looking at this some more, it seems line wha
wolenetz 2013/08/06 21:28:58 If going this route, please use a separate mechani
anandc 2013/08/06 21:30:51 This is a good idea, thanks. PTAL at the new waitF
77 });
78
79 }, 'Test playing then seeking back.');
80 </script>
81 </body>
82 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698