Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-errors.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-errors.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-errors.html |
index 3effd166371540b6754353a361fb78dab55cce43..377946ea418eea1c3ac1fb7d13d0b6d4a38577b3 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-errors.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-errors.html |
@@ -32,8 +32,10 @@ |
{ |
var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]); |
+ 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."); |
test.expectEvent(mediaSource, "sourceclose", "mediaSource closed."); |
sourceBuffer.appendBuffer(mediaSegment); |
@@ -52,6 +54,10 @@ |
{ |
assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING); |
+ // Fail if the append error algorithm occurs, since the decode |
+ // error will be provided by us directly via endOfStream(). |
+ sourceBuffer.addEventListener("error", test.unreached_func("'error' should not be fired on sourceBuffer")); |
+ |
test.expectEvent(mediaElement, "error", "mediaElement error."); |
test.expectEvent(mediaSource, "sourceended", "mediaSource ended."); |
test.expectEvent(mediaSource, "sourceclose", "mediaSource closed."); |
@@ -65,7 +71,10 @@ |
assert_equals(mediaSource.sourceBuffers.length, 0); |
assert_equals(mediaSource.readyState, "closed"); |
- test.done(); |
+ |
+ // Give a short time for a broken implementation to errantly fire |
+ // "error" on sourceBuffer. |
+ test.step_timeout(test.step_func_done(), 0); |
}); |
}, "Signaling 'decode' error via endOfStream() before initialization segment has been appended."); |
@@ -73,6 +82,10 @@ |
{ |
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(). |
+ sourceBuffer.addEventListener("error", test.unreached_func("'error' should not be fired on sourceBuffer")); |
+ |
test.expectEvent(mediaElement, "error", "mediaElement error."); |
test.expectEvent(mediaSource, "sourceended", "mediaSource ended."); |
test.expectEvent(mediaSource, "sourceclose", "mediaSource closed."); |
@@ -86,7 +99,10 @@ |
assert_equals(mediaSource.sourceBuffers.length, 0); |
assert_equals(mediaSource.readyState, "closed"); |
- test.done(); |
+ |
+ // Give a short time for a broken implementation to errantly fire |
+ // "error" on sourceBuffer. |
+ test.step_timeout(test.step_func_done(), 0); |
}); |
}, "Signaling 'network' error via endOfStream() before initialization segment has been appended."); |
@@ -95,6 +111,10 @@ |
var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init); |
assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING); |
+ // Fail if the append error algorithm occurs, since the decode |
+ // error will be provided by us directly via endOfStream(). |
+ sourceBuffer.addEventListener("error", test.unreached_func("'error' should not be fired on sourceBuffer")); |
+ |
test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended."); |
test.expectEvent(mediaElement, "loadedmetadata", "mediaElement metadata."); |
sourceBuffer.appendBuffer(initSegment); |
@@ -113,8 +133,12 @@ |
assert_true(mediaElement.error != null); |
assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_DECODE); |
assert_equals(mediaSource.readyState, "ended"); |
- test.done(); |
+ |
+ // Give a short time for a broken implementation to errantly fire |
+ // "error" on sourceBuffer. |
+ test.step_timeout(test.step_func_done(), 0); |
}); |
+ |
}, "Signaling 'decode' error via endOfStream() after initialization segment has been appended and the HTMLMediaElement has reached HAVE_METADATA."); |
ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
@@ -122,6 +146,10 @@ |
var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init); |
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(). |
+ sourceBuffer.addEventListener("error", test.unreached_func("'error' should not be fired on sourceBuffer")); |
+ |
test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended."); |
test.expectEvent(mediaElement, "loadedmetadata", "mediaElement metadata."); |
sourceBuffer.appendBuffer(initSegment); |
@@ -129,7 +157,6 @@ |
test.waitForExpectedEvents(function() |
{ |
assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_METADATA); |
- |
test.expectEvent(mediaElement, "error", "mediaElement error."); |
test.expectEvent(mediaSource, "sourceended", "mediaSource ended."); |
mediaSource.endOfStream("network"); |
@@ -140,7 +167,10 @@ |
assert_true(mediaElement.error != null); |
assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_NETWORK); |
assert_equals(mediaSource.readyState, "ended"); |
- test.done(); |
+ |
+ // Give a short time for a broken implementation to errantly fire |
+ // "error" on sourceBuffer. |
+ test.step_timeout(test.step_func_done(), 0); |
}); |
}, "Signaling 'network' error via endOfStream() after initialization segment has been appended and the HTMLMediaElement has reached HAVE_METADATA."); |
@@ -154,7 +184,11 @@ |
// Here use mediaSegment to replace the original mediaData[index, index + mediaSegment.length] |
mediaData.set(mediaSegment, index); |
+ test.expectEvent(mediaElement, "loadedmetadata", "mediaElement metadata."); |
+ 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); |
test.waitForExpectedEvents(function() |