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

Unified Diff: third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-MediaStream-modifications-events.html

Issue 1570263002: MediaRecorder: make EventListener and stop if receiving on{add,remove}track from WebMediaStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-MediaStream-modifications-events.html
diff --git a/third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-MediaStream-modifications-events.html b/third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-MediaStream-modifications-events.html
new file mode 100644
index 0000000000000000000000000000000000000000..1dd01eee439a51b0962a7b6d192aa62f2ecbf1f9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-MediaStream-modifications-events.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<script src=../../resources/testharness.js></script>
+<script src=../../resources/testharnessreport.js></script>
+<script>
+
+// These tests add or remove a Track from the MediaStream associated to a
+// MediaRecorder, expecting an Error Event in that case.
+var makeAsyncTest = function(value, expected) {
+ async_test(function() {
+ var recorder;
+
+ const onUnexpectedError = this.step_func(function() {
+ assert_unreached('Error creating MediaStream.');
+ });
+
+ const recorderOnExpectedErrorEvent = this.step_func_done(function(event) {
+ assert_equals("inactive", recorder.state);
+ });
+
+ const gotStreamAndStartMediaRecorder = this.step_func(function(stream) {
+ assert_equals(stream.getTracks().length, 2);
+
+ try {
+ recorder = new MediaRecorder(stream);
+ } catch (e) {
+ assert_unreached('Exception while creating MediaRecorder: ' + e);
+ }
+ recorder.start()
+ assert_equals("recording", recorder.state);
+
+ recorder.onerror = recorderOnExpectedErrorEvent;
+ });
+
+ const getStreamAndAddTrack = this.step_func(function(stream) {
+ gotStreamAndStartMediaRecorder(stream);
+ stream.addTrack(stream.getTracks()[1].clone());
+ });
+
+ const getStreamAndRemoveTrack = this.step_func(function(stream) {
+ gotStreamAndStartMediaRecorder(stream);
+ stream.removeTrack(stream.getTracks()[1]);
+ });
+
+ try {
+ if (value['action'] === "add") {
+ navigator.webkitGetUserMedia({video:true, audio:true}, getStreamAndAddTrack, onUnexpectedError);
+ } else if (value['action'] === "remove") {
+ navigator.webkitGetUserMedia({video:true, audio:true}, getStreamAndRemoveTrack, onUnexpectedError);
+ } else {
+ assert_unreached('Unknown action ' + value['action']);
+ }
+ } catch(e) {
+ assert_unreached('Exception launching getUserMedia(): ' + e);
+ }
+
+ });
+};
+
+
+generate_tests(makeAsyncTest, [["add-track", {action : "add"}],
+ ["remove-track", {action : "remove"}]]);
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698