OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="/w3c/resources/testharness.js"></script> | 4 <script src="/w3c/resources/testharness.js"></script> |
5 <script src="/w3c/resources/testharnessreport.js"></script> | 5 <script src="/w3c/resources/testharnessreport.js"></script> |
6 <script src="mediasource-util.js"></script> | 6 <script src="mediasource-util.js"></script> |
7 <link rel="stylesheet" href="/w3c/resources/testharness.css"> | 7 <link rel="stylesheet" href="/w3c/resources/testharness.css"> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <div id="log"></div> | 10 <div id="log"></div> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 test.expectEvent(mediaElement, 'playing', 'Playing media.'); | 57 test.expectEvent(mediaElement, 'playing', 'Playing media.'); |
58 sourceBuffer.appendBuffer(playbackData); | 58 sourceBuffer.appendBuffer(playbackData); |
59 }); | 59 }); |
60 | 60 |
61 test.waitForExpectedEvents(function() | 61 test.waitForExpectedEvents(function() |
62 { | 62 { |
63 assert_equals(mediaElement.duration, segmentInfo.durationInI
nitSegment); | 63 assert_equals(mediaElement.duration, segmentInfo.durationInI
nitSegment); |
64 assert_greater_than_equal(mediaElement.duration, 2.0, 'Durat
ion is >2.0s.'); | 64 assert_greater_than_equal(mediaElement.duration, 2.0, 'Durat
ion is >2.0s.'); |
65 test.waitForCurrentTimeChange(mediaElement, function() | 65 test.waitForCurrentTimeChange(mediaElement, function() |
66 { | 66 { |
67 // Update duration. | 67 // Reduce duration after removing media beyond the new d
uration. |
68 mediaSource.duration = 1.5; | 68 test.expectEvent(sourceBuffer, 'updateend', 'remove end'
); |
69 seekToSpecifiedTimeSetEOSAndVerifyDone(test, mediaElemen
t, mediaSource, 1.8); | 69 sourceBuffer.remove(1.5, +Infinity); |
| 70 test.waitForExpectedEvents(function() |
| 71 { |
| 72 mediaSource.duration = 1.5; |
| 73 seekToSpecifiedTimeSetEOSAndVerifyDone(test, mediaEl
ement, mediaSource, 1.8); |
| 74 }); |
70 }); | 75 }); |
| 76 |
71 }); | 77 }); |
72 }, 'Test seeking beyond updated media duration.'); | 78 }, 'Test seeking beyond updated media duration.'); |
73 | 79 |
74 mediasource_testafterdataloaded(function(test, mediaElement, mediaSo
urce, segmentInfo, sourceBuffer, mediaData) | 80 mediasource_testafterdataloaded(function(test, mediaElement, mediaSo
urce, segmentInfo, sourceBuffer, mediaData) |
75 { | 81 { |
76 mediaElement.play(); | 82 mediaElement.play(); |
77 | 83 |
78 // Append all media data for complete playback. | 84 // Append all media data for complete playback. |
79 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer end up
date.'); | 85 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer end up
date.'); |
80 test.expectEvent(mediaElement, 'loadedmetadata', 'Reached HAVE_M
ETADATA'); | 86 test.expectEvent(mediaElement, 'loadedmetadata', 'Reached HAVE_M
ETADATA'); |
81 test.expectEvent(mediaElement, 'playing', 'Playing media.'); | 87 test.expectEvent(mediaElement, 'playing', 'Playing media.'); |
82 sourceBuffer.appendBuffer(mediaData); | 88 sourceBuffer.appendBuffer(mediaData); |
83 | 89 |
84 test.waitForExpectedEvents(function() | 90 test.waitForExpectedEvents(function() |
85 { | 91 { |
86 test.waitForCurrentTimeChange(mediaElement, function() | 92 test.waitForCurrentTimeChange(mediaElement, function() |
87 { | 93 { |
88 seekToSpecifiedTimeSetEOSAndVerifyDone(test, mediaElemen
t, mediaSource, mediaSource.duration, mediaSource.duration + 0.1); | 94 seekToSpecifiedTimeSetEOSAndVerifyDone(test, mediaElemen
t, mediaSource, mediaSource.duration + 0.1); |
89 }); | 95 }); |
90 }); | 96 }); |
91 | 97 |
92 }, 'Test seeking beyond media duration.'); | 98 }, 'Test seeking beyond media duration.'); |
93 </script> | 99 </script> |
94 </body> | 100 </body> |
95 </html> | 101 </html> |
OLD | NEW |