Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(812)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-errors.html

Issue 2076673005: MSE: Plumb ChunkDemuxer appendData failures into append Error algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the layout test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5468cd38a33183ef75c43a137a77430cd2271d7c 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.");
wolenetz 2016/06/18 00:27:55 Note to reviewers: This was the critically missing
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,14 +71,21 @@
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.waitForExpectedEvents(test.step_func_done());
}, "Signaling 'decode' error via endOfStream() before initialization segment has been appended.");
ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
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,8 +99,11 @@
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.waitForExpectedEvents(test.step_func_done());
}, "Signaling 'network' error via endOfStream() before initialization segment has been appended.");
ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
@@ -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,11 @@
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.waitForExpectedEvents(test.step_func_done());
}, "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 +145,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);
@@ -140,8 +167,11 @@
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.waitForExpectedEvents(test.step_func_done());
}, "Signaling 'network' error via endOfStream() after initialization segment has been appended and the HTMLMediaElement has reached HAVE_METADATA.");
ErrorTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
@@ -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.");
wolenetz 2016/06/18 00:27:55 ditto note to reviewers
+ 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()

Powered by Google App Engine
This is Rietveld 408576698