Bug 1293613: don't assume playback won't be finished by the time the seeked event is fired. r?gerald
The data added in the sourcebuffer is very short (less than one second); it is possible that playback has completed prior the event being fired.
MozReview-Commit-ID: INHAFmEhSut
--- a/testing/web-platform/tests/media-source/mediasource-seek-during-pending-seek.html
+++ b/testing/web-platform/tests/media-source/mediasource-seek-during-pending-seek.html
@@ -68,17 +68,26 @@
{
test.expectEvent(mediaSource, 'sourceended', 'mediaSource ended');
mediaSource.endOfStream();
}
});
test.waitForExpectedEvents(function()
{
- assert_greater_than(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA, 'Greater than HAVE_CURRENT_DATA');
+ // Note: we just completed the seek. However, we only have less than a second worth of data to play. It is possible that
+ // playback has reached the end since the seek completed.
+ if (!mediaElement.paused)
+ {
+ assert_greater_than_equal(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA, 'Greater or equal than HAVE_CURRENT_DATA');
+ }
+ else
+ {
+ assert_true(mediaElement.ended);
+ }
test.done();
});
}, 'Test seeking to a new location before transitioning beyond HAVE_METADATA.');
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
mediaElement.play();
@@ -156,15 +165,24 @@
{
test.expectEvent(mediaSource, 'sourceended', 'mediaSource ended');
mediaSource.endOfStream();
}
});
test.waitForExpectedEvents(function()
{
- assert_greater_than(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA, 'Greater than HAVE_CURRENT_DATA');
+ // Note: we just completed the seek. However, we only have less than a second worth of data to play. It is possible that
+ // playback has reached the end since the seek completed.
+ if (!mediaElement.paused)
+ {
+ assert_greater_than_equal(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA, 'Greater or equal than HAVE_CURRENT_DATA');
+ }
+ else
+ {
+ assert_true(mediaElement.ended);
+ }
test.done();
});
}, 'Test seeking to a new location during a pending seek.');
</script>
</body>
</html>