Chromium Code Reviews| 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 <script> | |
| 13 var segmentInfo = WebMSegmentInfo.testWebM; | |
| 14 | |
| 15 function seekBackAfterPlayingTest(callback, description) | |
| 16 { | |
| 17 mediasource_test(function(test, mediaElement, mediaSource) | |
| 18 { | |
| 19 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.typ e); | |
| 20 MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function (mediaData) | |
| 21 { | |
| 22 callback(test, mediaElement, mediaSource, sourceBuffer, me diaData); | |
| 23 }); | |
| 24 }, description, {timeout: 10000} ); | |
| 25 } | |
| 26 | |
| 27 seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, sou rceBuffer, mediaData) | |
| 28 { | |
| 29 test.failOnEvent(mediaElement, 'error'); | |
| 30 | |
| 31 mediaElement.play(); | |
| 32 | |
| 33 // Append all media segments. | |
| 34 // Expect playing and timeupdate events. | |
| 35 test.expectEvent(mediaElement, "playing", "Playing triggered"); | |
|
wolenetz
2013/07/24 23:16:43
style nit: prefer ' over " in js (multiple places
anandc
2013/07/25 22:48:00
Done.
| |
| 36 test.expectEvent(mediaElement, "timeupdate", "timeupdate fired."); | |
| 37 sourceBuffer.appendBuffer(mediaData); | |
| 38 | |
| 39 test.waitForExpectedEvents(function() | |
| 40 { | |
| 41 if (mediaElement.currentTime > 0.5 ) { | |
|
wolenetz
2013/07/24 23:16:43
style nit: 4-space indent (multiple places in this
anandc
2013/07/25 22:48:00
Done.
| |
| 42 assert_greater_than(mediaElement.currentTime, 0.1); | |
|
wolenetz
2013/07/24 23:16:43
Why are we asserting within a conditional that alr
anandc
2013/07/25 22:48:00
Yes, that was pretty stupid. :-) Gone.
| |
| 43 assert_true(mediaElement.playing, "mediaElement is playing"); | |
| 44 // Seek back to 0.0 | |
| 45 test.expectEvent(mediaElement, "seeking", "mediaElement"); | |
| 46 test.expectEvent(mediaElement, "seeked", "mediaElement finishe d seek"); | |
|
wolenetz
2013/07/24 23:16:43
You'll need a 'timeupdate' expectation between 'se
anandc
2013/07/25 22:48:00
Based on all your comments, adding an explicit wai
| |
| 47 test.expectEvent(mediaElement, "playing", "Playing triggered") ; | |
|
wolenetz
2013/07/24 23:16:43
I don't think 'playing' is expected here, unless t
anandc
2013/07/26 18:49:22
Correct, rearranged the flow now.
| |
| 48 test.expectEvent(mediaElement, "timeupdate", "timeupdate fired ."); | |
|
wolenetz
2013/07/24 23:16:43
Note for future: you'll actually get lots and lots
anandc
2013/07/26 18:49:22
ok
| |
| 49 mediaElement.currentTime = 0.0; | |
| 50 } | |
| 51 }); | |
| 52 | |
| 53 test.waitForExpectedEvents(function() | |
|
wolenetz
2013/07/24 23:16:43
It's highly likely that the previous currentTime >
anandc
2013/07/26 18:49:22
Done.
| |
| 54 { | |
| 55 assert_greater_than(mediaElement.readyState, | |
| 56 mediaElement.HAVE_FUTURE_DATA, "Greater than HAVE_FUTURE_DATA" ); | |
|
wolenetz
2013/07/24 23:16:43
I'm not sure all implementations can guarantee the
anandc
2013/07/26 18:49:22
Removed.
| |
| 57 test.done(); | |
| 58 }); | |
| 59 | |
| 60 }, "Test playing then seeking back."); | |
| 61 </script> | |
| 62 </body> | |
| 63 </html> | |
| OLD | NEW |