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

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

Issue 742653002: MSE: Add layout test for 'decode' error via an algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use (length - 1)/2 to get the harf index Created 6 years, 1 month 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: LayoutTests/http/tests/media/media-source/mediasource-errors.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-errors.html b/LayoutTests/http/tests/media/media-source/mediasource-errors.html
index bb839522155b8a2d222ba16f977886464d8a5c76..b9908ad8aebaa389f5875b4049992086ad2369df 100644
--- a/LayoutTests/http/tests/media/media-source/mediasource-errors.html
+++ b/LayoutTests/http/tests/media/media-source/mediasource-errors.html
@@ -143,6 +143,28 @@
test.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)
+ {
+ assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
+
+ 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);
+
+ test.expectEvent(mediaElement, "error", "mediaElement error.");
+ sourceBuffer.appendBuffer(mediaData);
+
+ test.waitForExpectedEvents(function()
+ {
+ assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_METADATA);
+ assert_true(mediaElement.error != null);
+ assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_DECODE);
+ test.done();
+ });
+ }, "Signaling 'decode' error via segment parser loop algorithm after initialization segment and partial media segment has been appended.");
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698