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

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: Fix call to function specified for setTimeout. 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 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>
wolenetz 2013/07/29 21:23:40 consistency/interoperability nit: Our other tests
anandc 2013/07/29 22:55:51 Thanks. Done.
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)
48 {
49 test.waitForExpectedEvents(function()
50 {
51 assert_greater_than(mediaElement.currentTime, 0.0, 'Play back has started.');
wolenetz 2013/07/29 21:23:40 This assert could be flaky because playback may ha
anandc 2013/07/29 22:55:51 Not sure if PS#4 captures what you are recommendin
wolenetz 2013/07/30 18:44:21 Yes, you've captured my recommendation well :). Re
52 test.expectEvent(mediaElement, 'seeking', 'mediaElement' );
53 mediaElement.currentTime = 0.0;
54 assert_true(mediaElement.seeking, 'mediaElement is seeki ng');
55 });
56
57 test.waitForExpectedEvents(function()
58 {
59 assert_equals(mediaElement.currentTime, 0.0, 'Current ti me is 0.0');
60 test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fired.');
61 test.expectEvent(mediaElement, 'seeked', 'mediaElement f inished seek');
62 function confirmPlaying(test, mediaElement)
63 {
64 assert_greater_than(mediaElement.currentTime, 0.0, 'Pl ayback has started after seek.');
65 test.done();
66 }
67 setTimeout(function() {confirmPlaying(test, mediaElement )}, 300);
68 });
69
70 }
71
72 setTimeout(function() {playAndSeek(test, mediaElement)}, 300);
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