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

Side by Side Diff: talk/app/webrtc/peerconnectioninterface_unittest.cc

Issue 1507973003: Restoring behavior where PeerConnection tracks changes to MediaStreams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing merge conflicts. Created 5 years 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 unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/peerconnection.cc ('k') | talk/libjingle.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 ASSERT_TRUE(DoCreateAnswer(answer.use(), nullptr)); 1149 ASSERT_TRUE(DoCreateAnswer(answer.use(), nullptr));
1150 audio_ssrc = 0; 1150 audio_ssrc = 0;
1151 video_ssrc = 0; 1151 video_ssrc = 0;
1152 EXPECT_TRUE(GetFirstSsrc(GetFirstAudioContent(answer->description()), 1152 EXPECT_TRUE(GetFirstSsrc(GetFirstAudioContent(answer->description()),
1153 &audio_ssrc)); 1153 &audio_ssrc));
1154 EXPECT_TRUE(GetFirstSsrc(GetFirstVideoContent(answer->description()), 1154 EXPECT_TRUE(GetFirstSsrc(GetFirstVideoContent(answer->description()),
1155 &video_ssrc)); 1155 &video_ssrc));
1156 EXPECT_NE(audio_ssrc, video_ssrc); 1156 EXPECT_NE(audio_ssrc, video_ssrc);
1157 } 1157 }
1158 1158
1159 // Test that it's possible to call AddTrack on a MediaStream after adding
1160 // the stream to a PeerConnection.
1161 // TODO(deadbeef): Remove this test once this behavior is no longer supported.
1162 TEST_F(PeerConnectionInterfaceTest, AddTrackAfterAddStream) {
1163 CreatePeerConnection();
1164 // Create audio stream and add to PeerConnection.
1165 AddVoiceStream(kStreamLabel1);
1166 MediaStreamInterface* stream = pc_->local_streams()->at(0);
1167
1168 // Add video track to the audio-only stream.
1169 scoped_refptr<VideoTrackInterface> video_track(
1170 pc_factory_->CreateVideoTrack("video_label", nullptr));
1171 stream->AddTrack(video_track.get());
1172
1173 scoped_ptr<SessionDescriptionInterface> offer;
1174 ASSERT_TRUE(DoCreateOffer(offer.use(), nullptr));
1175
1176 const cricket::MediaContentDescription* video_desc =
1177 cricket::GetFirstVideoContentDescription(offer->description());
1178 EXPECT_TRUE(video_desc != nullptr);
1179 }
1180
1181 // Test that it's possible to call RemoveTrack on a MediaStream after adding
1182 // the stream to a PeerConnection.
1183 // TODO(deadbeef): Remove this test once this behavior is no longer supported.
1184 TEST_F(PeerConnectionInterfaceTest, RemoveTrackAfterAddStream) {
1185 CreatePeerConnection();
1186 // Create audio/video stream and add to PeerConnection.
1187 AddAudioVideoStream(kStreamLabel1, "audio_label", "video_label");
1188 MediaStreamInterface* stream = pc_->local_streams()->at(0);
1189
1190 // Remove the video track.
1191 stream->RemoveTrack(stream->GetVideoTracks()[0]);
1192
1193 scoped_ptr<SessionDescriptionInterface> offer;
1194 ASSERT_TRUE(DoCreateOffer(offer.use(), nullptr));
1195
1196 const cricket::MediaContentDescription* video_desc =
1197 cricket::GetFirstVideoContentDescription(offer->description());
1198 EXPECT_TRUE(video_desc == nullptr);
1199 }
1200
1159 // Test that we can specify a certain track that we want statistics about. 1201 // Test that we can specify a certain track that we want statistics about.
1160 TEST_F(PeerConnectionInterfaceTest, GetStatsForSpecificTrack) { 1202 TEST_F(PeerConnectionInterfaceTest, GetStatsForSpecificTrack) {
1161 InitiateCall(); 1203 InitiateCall();
1162 ASSERT_LT(0u, pc_->remote_streams()->count()); 1204 ASSERT_LT(0u, pc_->remote_streams()->count());
1163 ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetAudioTracks().size()); 1205 ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetAudioTracks().size());
1164 scoped_refptr<MediaStreamTrackInterface> remote_audio = 1206 scoped_refptr<MediaStreamTrackInterface> remote_audio =
1165 pc_->remote_streams()->at(0)->GetAudioTracks()[0]; 1207 pc_->remote_streams()->at(0)->GetAudioTracks()[0];
1166 EXPECT_TRUE(DoGetStats(remote_audio)); 1208 EXPECT_TRUE(DoGetStats(remote_audio));
1167 1209
1168 // Remove the stream. Since we are sending to our selves the local 1210 // Remove the stream. Since we are sending to our selves the local
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 FakeConstraints updated_answer_c; 2391 FakeConstraints updated_answer_c;
2350 answer_c.SetMandatoryReceiveAudio(false); 2392 answer_c.SetMandatoryReceiveAudio(false);
2351 answer_c.SetMandatoryReceiveVideo(false); 2393 answer_c.SetMandatoryReceiveVideo(false);
2352 2394
2353 cricket::MediaSessionOptions updated_answer_options; 2395 cricket::MediaSessionOptions updated_answer_options;
2354 EXPECT_TRUE( 2396 EXPECT_TRUE(
2355 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); 2397 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options));
2356 EXPECT_TRUE(updated_answer_options.has_audio()); 2398 EXPECT_TRUE(updated_answer_options.has_audio());
2357 EXPECT_TRUE(updated_answer_options.has_video()); 2399 EXPECT_TRUE(updated_answer_options.has_video());
2358 } 2400 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnection.cc ('k') | talk/libjingle.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698