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 assert_equals(segmentInfo.duration, 6.042, 'Expected test me dia duration'); | |
acolwell GONE FROM CHROMIUM
2013/08/05 21:06:06
nit: Why do you need to verify this specific value
anandc
2013/08/06 18:03:30
Done.
| |
21 test.failOnEvent(mediaElement, 'error'); | |
22 | |
23 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.t ype); | |
24 MediaSourceUtil.loadBinaryData(test, segmentInfo.url, functi on(mediaData) | |
25 { | |
26 testFunction(test, mediaElement, mediaSource, segmentInf o, sourceBuffer, mediaData); | |
27 }); | |
28 }, description, options); | |
29 } | |
30 | |
31 seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, s egmentInfo, sourceBuffer, mediaData) | |
32 { | |
33 | |
34 mediaElement.play(); | |
35 // Append all the segments | |
36 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); | |
37 test.expectEvent(mediaElement, 'playing', 'Playing triggered'); | |
38 sourceBuffer.appendBuffer(mediaData); | |
39 | |
40 var confirmPlayThenEnd = test.step_func(function() | |
acolwell GONE FROM CHROMIUM
2013/08/05 21:06:06
nit: I don't think you should need test.step_func(
anandc
2013/08/06 18:03:30
Done.
| |
41 { | |
42 var delayedPlayHandlerThatEnds = test.step_func(function() | |
acolwell GONE FROM CHROMIUM
2013/08/05 21:06:06
nit: I don't think you should use test.step_func()
anandc
2013/08/06 18:03:30
Done.
| |
43 { | |
44 assert_greater_than(mediaElement.currentTime, 0.0, 'Play back has started after seek.'); | |
45 test.done(); | |
46 }); | |
47 test.expectDelayedCallback(delayedPlayHandlerThatEnds, 300); | |
acolwell GONE FROM CHROMIUM
2013/08/05 21:06:06
nit: 300ms seems arbitrary. Should this just be ba
anandc
2013/08/06 18:03:30
Moved delay to expectDelayCallback, defaulting to
| |
48 }); | |
49 | |
50 var finishSeekThenPlay = test.step_func(function() | |
acolwell GONE FROM CHROMIUM
2013/08/05 21:06:06
nit: I don't think step_func() is needed here.
anandc
2013/08/06 18:03:30
Done.
| |
51 { | |
52 assert_true(mediaElement.seeking, 'mediaElement is seeking') ; | |
53 assert_equals(mediaElement.currentTime, 0.0, 'Current time i s 0.0'); | |
54 test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fir ed.'); | |
55 test.expectEvent(mediaElement, 'seeked', 'mediaElement finis hed seek'); | |
56 | |
57 test.waitForExpectedEvents(function() | |
58 { | |
59 confirmPlayThenEnd(); | |
60 }); | |
61 }); | |
62 | |
63 var delayedPlayHandler = test.step_func(function() | |
acolwell GONE FROM CHROMIUM
2013/08/05 21:06:06
ditto and the "function delayedPlayHandler()" form
anandc
2013/08/06 18:03:30
Done.
| |
64 { | |
65 assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.'); | |
66 test.expectEvent(mediaElement, 'seeking', 'mediaElement'); | |
67 mediaElement.currentTime = 0.0; | |
68 | |
69 test.waitForExpectedEvents(function() | |
70 { | |
71 finishSeekThenPlay(); | |
72 }); | |
73 }); | |
74 | |
75 test.waitForExpectedEvents(function() | |
76 { | |
77 test.expectDelayedCallback(delayedPlayHandler, 300); | |
78 }); | |
79 | |
80 }, 'Test playing then seeking back.'); | |
81 </script> | |
82 </body> | |
83 </html> | |
OLD | NEW |