mirror of
https://github.com/servo/servo.git
synced 2025-08-30 09:38:19 +01:00
Update web-platform-tests to revision 4052654d786236b493d2df3cb80b9d3d1d0a8354
This commit is contained in:
parent
eab848df3e
commit
3b6ddd885a
116 changed files with 4255 additions and 821 deletions
|
@ -207,28 +207,67 @@
|
|||
{
|
||||
assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
|
||||
|
||||
// Fail if the append error algorithm occurs, since the network
|
||||
// error will be provided by us directly via endOfStream().
|
||||
mediaElement.addEventListener("loadedmetadata", test.unreached_func("'loadedmetadata' should not be fired on mediaElement"));
|
||||
|
||||
var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
|
||||
var index = segmentInfo.init.size + (mediaSegment.length - 1) / 2;
|
||||
// Corrupt the media data from index of mediaData, so it can signal 'decode' error.
|
||||
// Here use mediaSegment to replace the original mediaData[index, index + mediaSegment.length]
|
||||
mediaData.set(mediaSegment, index);
|
||||
|
||||
// Depending on implementation, mediaElement transition to
|
||||
// HAVE_METADATA and dispatching 'loadedmetadata' may occur, since the
|
||||
// initialization segment is uncorrupted and forms the initial part of
|
||||
// the appended bytes. The segment parser loop continues and
|
||||
// eventually should observe decode error. Other implementations may
|
||||
// delay such transition until some larger portion of the append's
|
||||
// parsing is completed or until the media element is configured to
|
||||
// handle the playback of media with the associated metadata (which may
|
||||
// not occur in this case before the MSE append error algorithm executes.)
|
||||
// So we cannot reliably expect the lack or presence of
|
||||
// 'loadedmetadata' before the MSE append error algortihm executes in
|
||||
// this case; similarly, mediaElement's resulting readyState may be
|
||||
// either HAVE_NOTHING or HAVE_METADATA after the append error
|
||||
// algorithm executes, and the resulting MediaError code would
|
||||
// respectively be MEDIA_ERR_SRC_NOT_SUPPORTED or MEDIA_ERR_DECODE.
|
||||
let loaded = false;
|
||||
mediaElement.addEventListener("loadedmetadata", test.step_func(() => { loaded = true; }));
|
||||
let errored = false;
|
||||
mediaElement.addEventListener("error", test.step_func(() => { errored = true; }));
|
||||
|
||||
test.expectEvent(sourceBuffer, "error", "sourceBuffer error.");
|
||||
test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended.");
|
||||
test.expectEvent(mediaElement, "error", "mediaElement error.");
|
||||
test.expectEvent(mediaSource, "sourceended", "mediaSource ended.");
|
||||
sourceBuffer.appendBuffer(mediaData);
|
||||
|
||||
let verifyFinalState = test.step_func(function() {
|
||||
if (loaded) {
|
||||
assert_greater_than(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
|
||||
assert_true(mediaElement.error != null);
|
||||
assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_DECODE);
|
||||
test.done();
|
||||
} else {
|
||||
assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
|
||||
assert_true(mediaElement.error != null);
|
||||
assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
|
||||
test.done();
|
||||
}
|
||||
});
|
||||
|
||||
let awaitMediaElementError = test.step_func(function() {
|
||||
if (!errored) {
|
||||
test.step_timeout(awaitMediaElementError, 100);
|
||||
} else {
|
||||
verifyFinalState();
|
||||
}
|
||||
});
|
||||
|
||||
test.waitForExpectedEvents(function()
|
||||
{
|
||||
assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
|
||||
assert_true(mediaElement.error != null);
|
||||
assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
|
||||
test.done();
|
||||
// Not all implementations will reliably fire a "loadedmetadata"
|
||||
// event, so we use custom logic to verify mediaElement state based
|
||||
// on whether or not "loadedmetadata" was ever fired. But first
|
||||
// we must ensure "error" was fired on the mediaElement.
|
||||
awaitMediaElementError();
|
||||
});
|
||||
}, "Signaling 'decode' error via segment parser loop algorithm.");
|
||||
|
||||
}, "Signaling 'decode' error via segment parser loop algorithm of append containing init plus corrupted media segment.");
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue