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 | |
| 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'); | |
| 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 confirmPlayAfterSeek = test.step_func(function(){ | |
|
wolenetz
2013/08/02 23:06:45
nit: { on next line.
anandc
2013/08/02 23:46:43
Done.
| |
| 41 test.waitForExpectedEvents(function() | |
| 42 { | |
| 43 var delayedPlayAfterSeekHandler = test.step_func(functio n() | |
| 44 { | |
| 45 assert_greater_than(mediaElement.currentTime, 0.0, 'Pl ayback has started after seek.'); | |
|
wolenetz
2013/08/02 23:06:45
nit: indent 4. hmm. I missed this one earlier, too
anandc
2013/08/02 23:46:43
Done.
| |
| 46 test.done(); | |
| 47 }); | |
| 48 test.expectDelayedCallback(delayedPlayAfterSeekHandler, 300); | |
| 49 }); | |
| 50 }); | |
| 51 | |
| 52 var seekAndPlayAgain = test.step_func(function(){ | |
| 53 test.waitForExpectedEvents(function() | |
| 54 { | |
| 55 assert_true(mediaElement.seeking, 'mediaElement is seeki ng'); | |
| 56 assert_equals(mediaElement.currentTime, 0.0, 'Current ti me is 0.0'); | |
| 57 test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fired.'); | |
| 58 test.expectEvent(mediaElement, 'seeked', 'mediaElement f inished seek'); | |
| 59 | |
| 60 confirmPlayAfterSeek(); | |
|
wolenetz
2013/08/02 23:06:45
low-pri nit: (like below; read the next comment fi
anandc
2013/08/02 23:46:43
Done.
| |
| 61 }); | |
| 62 }); | |
| 63 | |
| 64 var delayedPlayHandler = test.step_func(function() | |
| 65 { | |
| 66 assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.'); | |
| 67 test.expectEvent(mediaElement, 'seeking', 'mediaElement'); | |
| 68 mediaElement.currentTime = 0.0; | |
| 69 | |
| 70 seekAndPlayAgain(); | |
|
wolenetz
2013/08/02 23:06:45
low-pri nit: Wrap this call inside test.waitForExp
anandc
2013/08/02 23:46:43
Done.
anandc
2013/08/02 23:49:11
Done the first part. Didn't chain calls. Maybe for
wolenetz
2013/08/03 00:06:28
looks good. chaining was just an idea for readabil
| |
| 71 }); | |
| 72 | |
| 73 test.waitForExpectedEvents(function() | |
| 74 { | |
| 75 test.expectDelayedCallback(delayedPlayHandler, 300); | |
| 76 }); | |
| 77 | |
| 78 }, 'Test playing then seeking back.'); | |
| 79 </script> | |
| 80 </body> | |
| 81 </html> | |
| OLD | NEW |