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

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: Reduce test flakiness. 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 assert_equals(segmentInfo.duration, 6.042, 'Expected test medi a duration');
21 test.failOnEvent(mediaElement, 'error');
22
23 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.typ e);
24 MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function (mediaData)
25 {
26 testFunction(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData);
27 });
28 }, description, options);
29 }
30
31 function getSegment(mediaData, info)
32 {
33 var start = info.offset;
34 var end = start + info.size;
35 return mediaData.subarray(start, end);
36 }
37
38 seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, s egmentInfo, sourceBuffer, mediaData)
39 {
40
41 mediaElement.play();
42 // Append all the segments
43 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
44 test.expectEvent(mediaElement, 'playing', 'Playing triggered');
45 sourceBuffer.appendBuffer(mediaData);
46
47 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
48 {
49 assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.');
50 mediaElement.currentTime = 0.0;
51
52 test.waitForExpectedEvents(function()
53 {
54 assert_true(mediaElement.seeking, 'mediaElement is seeki ng');
55 assert_equals(mediaElement.currentTime, 0.0, 'Current ti me is 0.0');
56 test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fired.');
57 test.expectEvent(mediaElement, 'seeked', 'mediaElement f inished seek');
58 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.
59 {
60 assert_greater_than(mediaElement.currentTime, 0.0, 'Pl ayback has started after seek.');
61 test.done();
62 }
63 setTimeout(function() {confirmPlaying(test, mediaElement )}, 300);
64 });
65
66 }
67
68 test.waitForExpectedEvents(function()
69 {
70 setTimeout(function() {playAndSeek(test, mediaElement)}, 300 );
71 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.
72 });
73
74 }, 'Test playing then seeking back.');
75 </script>
76 </body>
77 </html>
OLDNEW
« 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