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

Unified Diff: content/test/data/media/mediarecorder_test.html

Issue 1543673002: MediaRecorder: make MediaRecorderHandler a MediaStreamObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added content_browsertests for Error Event firing when Track added/removed to MS Created 4 years, 11 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
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/mediarecorder_test.html
diff --git a/content/test/data/media/mediarecorder_test.html b/content/test/data/media/mediarecorder_test.html
index c5d4cc13dbf88845e3a8c6a98f8f0953b484e7da..ea6f2c758c84a8ef14b974022292ae443db53f08 100644
--- a/content/test/data/media/mediarecorder_test.html
+++ b/content/test/data/media/mediarecorder_test.html
@@ -484,6 +484,73 @@ function testIllegalRequestDataThrowsDOMError() {
});
}
+// Tests that MediaRecorder fires an Error Event when the associated MediaStream
+// gets a Track added.
+function testAddingTrackToMediaStreamFiresErrorEvent() {
+ var theStream;
+ var theRecorder;
+ var errorEventReceived = false;
+ navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
+ .then(function(stream) {
+ theStream = stream;
+ return createAndStartMediaRecorder(stream);
+ })
+ .then(function(recorder) {
+ theRecorder = recorder;
+ theRecorder.onerror = function(event) {
+ errorEventReceived = true;
+ assertEquals('inactive', theRecorder.state);
+ };
+ // Add a new track, copy of an existing one for simplicity.
+ theStream.addTrack(theStream.getTracks()[1].clone());
+ })
+ .then(function() {
+ return waitFor('Waiting for the Error Event',
+ function() {
+ return errorEventReceived;
+ });
+ })
+ .catch(function(err) {
+ return failTest(err.toString());
+ })
+ .then(function() {
+ reportTestSuccess();
+ });
+}
+
+// Tests that MediaRecorder fires an Error Event when the associated MediaStream
+// gets a Track removed.
+function testRemovingTrackFromMediaStreamFiresErrorEvent() {
+ var theStream;
+ var theRecorder;
+ var errorEventReceived = false;
+ navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
+ .then(function(stream) {
+ theStream = stream;
+ return createAndStartMediaRecorder(stream);
+ })
+ .then(function(recorder) {
+ theRecorder = recorder;
+ theRecorder.onerror = function(event) {
+ errorEventReceived = true;
+ assertEquals('inactive', theRecorder.state);
+ };
+ theStream.removeTrack(theStream.getTracks()[1]);
+ })
+ .then(function() {
+ return waitFor('Waiting for the Error Event',
+ function() {
+ return errorEventReceived;
+ });
+ })
+ .catch(function(err) {
+ return failTest(err.toString());
+ })
+ .then(function() {
+ reportTestSuccess();
+ });
+}
+
</script>
</body>
</html>
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698