| 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);
|
| + 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);
|
| +}
|
|
|