OLD | NEW |
---|---|
(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.waitForTimeUpdate(mediaElement, delayedPlayHandlerThatE nds); | |
acolwell GONE FROM CHROMIUM
2013/08/06 23:05:09
nit: Just inline the function here. I think it wou
anandc
2013/08/06 23:27:22
Done.
| |
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, 'seeked', 'mediaElement finis hed seek'); | |
54 | |
55 test.waitForExpectedEvents(function() | |
acolwell GONE FROM CHROMIUM
2013/08/06 23:05:09
nit: You can just do test.waitForExpectedEvents(co
anandc
2013/08/06 23:27:22
Done.
| |
56 { | |
57 confirmPlayThenEnd(); | |
58 }); | |
59 } | |
60 | |
61 function delayedPlayHandler() | |
62 { | |
63 assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.'); | |
64 test.expectEvent(mediaElement, 'seeking', 'mediaElement'); | |
65 mediaElement.currentTime = 0.0; | |
66 | |
67 test.waitForExpectedEvents(function() | |
acolwell GONE FROM CHROMIUM
2013/08/06 23:05:09
nit: You can just do test.waitForExpectedEvents(fi
anandc
2013/08/06 23:27:22
Done.
| |
68 { | |
69 finishSeekThenPlay(); | |
70 }); | |
71 } | |
72 | |
73 test.waitForExpectedEvents(function() | |
74 { | |
75 test.waitForTimeUpdate(mediaElement, delayedPlayHandler); | |
76 }); | |
77 | |
78 }, 'Test playing then seeking back.'); | |
79 </script> | |
80 </body> | |
81 </html> | |
OLD | NEW |