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

Unified Diff: chrome/browser/media/webrtc/webrtc_rtp_browsertest.cc

Issue 2951713002: RTCPeerConnection.addTrack and removeTrack added (behind flag) (Closed)
Patch Set: Addressed guidou's comments Created 3 years, 5 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: chrome/browser/media/webrtc/webrtc_rtp_browsertest.cc
diff --git a/chrome/browser/media/webrtc/webrtc_rtp_browsertest.cc b/chrome/browser/media/webrtc/webrtc_rtp_browsertest.cc
index bd591a994707151759292c68c2c31ff09259b054..9b5045c04c8b77469cb1832c4b6a18277a5ea383 100644
--- a/chrome/browser/media/webrtc/webrtc_rtp_browsertest.cc
+++ b/chrome/browser/media/webrtc/webrtc_rtp_browsertest.cc
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <string>
+#include <vector>
+
#include "base/command_line.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_base.h"
#include "content/public/common/content_switches.h"
@@ -63,3 +66,106 @@ IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, GetReceivers) {
VerifyRtpReceivers(left_tab_, 2);
VerifyRtpReceivers(right_tab_, 6);
}
+
+IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, AddAndRemoveTracksWithoutStream) {
+ StartServerAndOpenTabs();
+
+ SetupPeerconnectionWithoutLocalStream(left_tab_);
+ SetupPeerconnectionWithoutLocalStream(right_tab_);
+
+ std::vector<std::string> ids =
+ CreateAndAddAudioAndVideoTrack(left_tab_, StreamArgumentType::NO_STREAM);
+ std::string audio_stream_id = ids[0];
+ std::string audio_track_id = ids[1];
+ std::string video_stream_id = ids[2];
+ std::string video_track_id = ids[3];
+ EXPECT_NE("null", audio_stream_id);
Taylor_Brandstetter 2017/07/06 22:45:14 I think we should fix this before we ship the feat
hbos_chromium 2017/07/07 12:07:47 SGTM. Will fix before unflagging. Added a TODO. T
+ EXPECT_NE("null", audio_track_id);
+ EXPECT_NE("null", video_stream_id);
+ EXPECT_NE("null", video_track_id);
+ EXPECT_NE(audio_stream_id, video_stream_id);
+
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 2);
+ VerifyRtpReceivers(right_tab_, 2);
+
+ RemoveTrack(left_tab_, audio_track_id);
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 1);
+ VerifyRtpReceivers(right_tab_, 1);
+
+ RemoveTrack(left_tab_, video_track_id);
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 0);
+ VerifyRtpReceivers(right_tab_, 0);
+}
+
+IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest,
+ AddAndRemoveTracksWithSharedStream) {
+ StartServerAndOpenTabs();
+
+ SetupPeerconnectionWithoutLocalStream(left_tab_);
+ SetupPeerconnectionWithoutLocalStream(right_tab_);
+
+ std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack(
+ left_tab_, StreamArgumentType::SHARED_STREAM);
+ std::string audio_stream_id = ids[0];
+ std::string audio_track_id = ids[1];
+ std::string video_stream_id = ids[2];
+ std::string video_track_id = ids[3];
+ EXPECT_NE("null", audio_stream_id);
+ EXPECT_EQ(audio_stream_id, video_stream_id);
+ EXPECT_NE("null", audio_track_id);
+ EXPECT_NE("null", video_track_id);
+
+ NegotiateCall(left_tab_, right_tab_);
+ // TODO(hbos): Here and in other "AddAndRemoveTracks" tests: when ontrack and
+ // ended events are supported, verify that these are fired on the remote side
+ // when tracks are added and removed. https://crbug.com/webrtc/7933
+ VerifyRtpSenders(left_tab_, 2);
+ VerifyRtpReceivers(right_tab_, 2);
+
+ RemoveTrack(left_tab_, audio_track_id);
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 1);
+ VerifyRtpReceivers(right_tab_, 1);
+
+ RemoveTrack(left_tab_, video_track_id);
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 0);
+ VerifyRtpReceivers(right_tab_, 0);
+}
+
+IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest,
+ AddAndRemoveTracksWithIndividualStreams) {
+ StartServerAndOpenTabs();
+
+ SetupPeerconnectionWithoutLocalStream(left_tab_);
+ SetupPeerconnectionWithoutLocalStream(right_tab_);
+
+ std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack(
+ left_tab_, StreamArgumentType::INDIVIDUAL_STREAMS);
+ std::string audio_stream_id = ids[0];
+ std::string audio_track_id = ids[1];
+ std::string video_stream_id = ids[2];
+ std::string video_track_id = ids[3];
+ EXPECT_NE("null", audio_stream_id);
+ EXPECT_NE("null", audio_track_id);
+ EXPECT_NE("null", video_stream_id);
+ EXPECT_NE("null", video_track_id);
+ EXPECT_NE(audio_stream_id, video_stream_id);
+
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 2);
+ VerifyRtpReceivers(right_tab_, 2);
+
+ RemoveTrack(left_tab_, audio_track_id);
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 1);
+ VerifyRtpReceivers(right_tab_, 1);
+
+ RemoveTrack(left_tab_, video_track_id);
+ NegotiateCall(left_tab_, right_tab_);
+ VerifyRtpSenders(left_tab_, 0);
+ VerifyRtpReceivers(right_tab_, 0);
+}

Powered by Google App Engine
This is Rietveld 408576698