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

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

Issue 1246913005: TransportController refactoring (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Set media engine on voice channel Created 5 years, 4 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 unified diff | Download patch
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,
11 * this list of conditions and the following disclaimer in the documentation 11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution. 12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products 13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include <vector>
29
28 #include "talk/app/webrtc/audiotrack.h" 30 #include "talk/app/webrtc/audiotrack.h"
29 #include "talk/app/webrtc/fakemetricsobserver.h" 31 #include "talk/app/webrtc/fakemetricsobserver.h"
30 #include "talk/app/webrtc/jsepicecandidate.h" 32 #include "talk/app/webrtc/jsepicecandidate.h"
31 #include "talk/app/webrtc/jsepsessiondescription.h" 33 #include "talk/app/webrtc/jsepsessiondescription.h"
32 #include "talk/app/webrtc/mediastreamsignaling.h" 34 #include "talk/app/webrtc/mediastreamsignaling.h"
33 #include "talk/app/webrtc/streamcollection.h" 35 #include "talk/app/webrtc/streamcollection.h"
34 #include "talk/app/webrtc/test/fakeconstraints.h" 36 #include "talk/app/webrtc/test/fakeconstraints.h"
35 #include "talk/app/webrtc/test/fakedtlsidentityservice.h" 37 #include "talk/app/webrtc/test/fakedtlsidentityservice.h"
36 #include "talk/app/webrtc/test/fakemediastreamsignaling.h" 38 #include "talk/app/webrtc/test/fakemediastreamsignaling.h"
37 #include "talk/app/webrtc/videotrack.h" 39 #include "talk/app/webrtc/videotrack.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 rtc::Thread* worker_thread, 239 rtc::Thread* worker_thread,
238 cricket::PortAllocator* port_allocator, 240 cricket::PortAllocator* port_allocator,
239 webrtc::IceObserver* ice_observer, 241 webrtc::IceObserver* ice_observer,
240 webrtc::MediaStreamSignaling* mediastream_signaling) 242 webrtc::MediaStreamSignaling* mediastream_signaling)
241 : WebRtcSession(cmgr, signaling_thread, worker_thread, port_allocator, 243 : WebRtcSession(cmgr, signaling_thread, worker_thread, port_allocator,
242 mediastream_signaling) { 244 mediastream_signaling) {
243 RegisterIceObserver(ice_observer); 245 RegisterIceObserver(ice_observer);
244 } 246 }
245 virtual ~WebRtcSessionForTest() {} 247 virtual ~WebRtcSessionForTest() {}
246 248
247 using cricket::BaseSession::GetTransportProxy; 249 // Note that these methods are only safe to use if the signaling thread
250 // is the same as the worker thread
251 cricket::TransportChannel* voice_rtp_transport_channel() {
252 return rtp_transport_channel(voice_channel());
253 }
254
255 cricket::TransportChannel* voice_rtcp_transport_channel() {
256 return rtcp_transport_channel(voice_channel());
257 }
258
259 cricket::TransportChannel* video_rtp_transport_channel() {
260 return rtp_transport_channel(video_channel());
261 }
262
263 cricket::TransportChannel* video_rtcp_transport_channel() {
264 return rtcp_transport_channel(video_channel());
265 }
266
267 cricket::TransportChannel* data_rtp_transport_channel() {
268 return rtp_transport_channel(data_channel());
269 }
270
271 cricket::TransportChannel* data_rtcp_transport_channel() {
272 return rtcp_transport_channel(data_channel());
273 }
274
248 using webrtc::WebRtcSession::SetAudioPlayout; 275 using webrtc::WebRtcSession::SetAudioPlayout;
249 using webrtc::WebRtcSession::SetAudioSend; 276 using webrtc::WebRtcSession::SetAudioSend;
250 using webrtc::WebRtcSession::SetCaptureDevice; 277 using webrtc::WebRtcSession::SetCaptureDevice;
251 using webrtc::WebRtcSession::SetVideoPlayout; 278 using webrtc::WebRtcSession::SetVideoPlayout;
252 using webrtc::WebRtcSession::SetVideoSend; 279 using webrtc::WebRtcSession::SetVideoSend;
280
281 private:
282 cricket::TransportChannel* rtp_transport_channel(cricket::BaseChannel* ch) {
283 if (!ch) {
284 return nullptr;
285 }
286 return ch->transport_channel();
287 }
288
289 cricket::TransportChannel* rtcp_transport_channel(cricket::BaseChannel* ch) {
290 if (!ch) {
291 return nullptr;
292 }
293 return ch->rtcp_transport_channel();
294 }
253 }; 295 };
254 296
255 class WebRtcSessionCreateSDPObserverForTest 297 class WebRtcSessionCreateSDPObserverForTest
256 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> { 298 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> {
257 public: 299 public:
258 enum State { 300 enum State {
259 kInit, 301 kInit,
260 kFailed, 302 kFailed,
261 kSucceeded, 303 kSucceeded,
262 }; 304 };
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 metrics_observer_(new rtc::RefCountedObject<FakeMetricsObserver>()) { 381 metrics_observer_(new rtc::RefCountedObject<FakeMetricsObserver>()) {
340 tdesc_factory_->set_protocol(cricket::ICEPROTO_HYBRID); 382 tdesc_factory_->set_protocol(cricket::ICEPROTO_HYBRID);
341 383
342 cricket::ServerAddresses stun_servers; 384 cricket::ServerAddresses stun_servers;
343 stun_servers.insert(stun_socket_addr_); 385 stun_servers.insert(stun_socket_addr_);
344 allocator_.reset(new cricket::BasicPortAllocator( 386 allocator_.reset(new cricket::BasicPortAllocator(
345 &network_manager_, 387 &network_manager_,
346 stun_servers, 388 stun_servers,
347 SocketAddress(), SocketAddress(), SocketAddress())); 389 SocketAddress(), SocketAddress(), SocketAddress()));
348 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | 390 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP |
349 cricket::PORTALLOCATOR_DISABLE_RELAY | 391 cricket::PORTALLOCATOR_DISABLE_RELAY |
350 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); 392 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
351 EXPECT_TRUE(channel_manager_->Init()); 393 EXPECT_TRUE(channel_manager_->Init());
352 desc_factory_->set_add_legacy_streams(false); 394 desc_factory_->set_add_legacy_streams(false);
353 allocator_->set_step_delay(cricket::kMinimumStepDelay); 395 allocator_->set_step_delay(cricket::kMinimumStepDelay);
354 } 396 }
355 397
356 void AddInterface(const SocketAddress& addr) { 398 void AddInterface(const SocketAddress& addr) {
357 network_manager_.AddInterface(addr); 399 network_manager_.AddInterface(addr);
358 } 400 }
359 401
360 void Init( 402 void Init(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit, 502 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit,
461 2000); 503 2000);
462 return observer->ReleaseDescription(); 504 return observer->ReleaseDescription();
463 } 505 }
464 506
465 bool ChannelsExist() const { 507 bool ChannelsExist() const {
466 return (session_->voice_channel() != NULL && 508 return (session_->voice_channel() != NULL &&
467 session_->video_channel() != NULL); 509 session_->video_channel() != NULL);
468 } 510 }
469 511
470 void CheckTransportChannels() const {
471 EXPECT_TRUE(session_->GetChannel(cricket::CN_AUDIO, 1) != NULL);
472 EXPECT_TRUE(session_->GetChannel(cricket::CN_AUDIO, 2) != NULL);
473 EXPECT_TRUE(session_->GetChannel(cricket::CN_VIDEO, 1) != NULL);
474 EXPECT_TRUE(session_->GetChannel(cricket::CN_VIDEO, 2) != NULL);
475 }
476
477 void VerifyCryptoParams(const cricket::SessionDescription* sdp) { 512 void VerifyCryptoParams(const cricket::SessionDescription* sdp) {
478 ASSERT_TRUE(session_.get() != NULL); 513 ASSERT_TRUE(session_.get() != NULL);
479 const cricket::ContentInfo* content = cricket::GetFirstAudioContent(sdp); 514 const cricket::ContentInfo* content = cricket::GetFirstAudioContent(sdp);
480 ASSERT_TRUE(content != NULL); 515 ASSERT_TRUE(content != NULL);
481 const cricket::AudioContentDescription* audio_content = 516 const cricket::AudioContentDescription* audio_content =
482 static_cast<const cricket::AudioContentDescription*>( 517 static_cast<const cricket::AudioContentDescription*>(
483 content->description); 518 content->description);
484 ASSERT_TRUE(audio_content != NULL); 519 ASSERT_TRUE(audio_content != NULL);
485 ASSERT_EQ(1U, audio_content->cryptos().size()); 520 ASSERT_EQ(1U, audio_content->cryptos().size());
486 ASSERT_EQ(47U, audio_content->cryptos()[0].key_params.size()); 521 ASSERT_EQ(47U, audio_content->cryptos()[0].key_params.size());
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 &sdp); 972 &sdp);
938 } 973 }
939 974
940 SessionDescriptionInterface* new_answer = CreateSessionDescription( 975 SessionDescriptionInterface* new_answer = CreateSessionDescription(
941 JsepSessionDescription::kAnswer, sdp, NULL); 976 JsepSessionDescription::kAnswer, sdp, NULL);
942 977
943 // SetRemoteDescription to enable rtcp mux. 978 // SetRemoteDescription to enable rtcp mux.
944 SetRemoteDescriptionWithoutError(new_answer); 979 SetRemoteDescriptionWithoutError(new_answer);
945 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); 980 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
946 EXPECT_EQ(expected_candidate_num, observer_.mline_0_candidates_.size()); 981 EXPECT_EQ(expected_candidate_num, observer_.mline_0_candidates_.size());
947 EXPECT_EQ(expected_candidate_num, observer_.mline_1_candidates_.size()); 982 if (bundle) {
948 for (size_t i = 0; i < observer_.mline_0_candidates_.size(); ++i) { 983 EXPECT_EQ(0, observer_.mline_1_candidates_.size());
949 cricket::Candidate c0 = observer_.mline_0_candidates_[i]; 984 } else {
950 cricket::Candidate c1 = observer_.mline_1_candidates_[i]; 985 EXPECT_EQ(expected_candidate_num, observer_.mline_1_candidates_.size());
951 if (bundle) {
952 EXPECT_TRUE(c0.IsEquivalent(c1));
953 } else {
954 EXPECT_FALSE(c0.IsEquivalent(c1));
955 }
956 } 986 }
957 } 987 }
958 // Tests that we can only send DTMF when the dtmf codec is supported. 988 // Tests that we can only send DTMF when the dtmf codec is supported.
959 void TestCanInsertDtmf(bool can) { 989 void TestCanInsertDtmf(bool can) {
960 if (can) { 990 if (can) {
961 InitWithDtmfCodec(); 991 InitWithDtmfCodec();
962 } else { 992 } else {
963 Init(); 993 Init();
964 } 994 }
965 mediastream_signaling_.SendAudioVideoStream1(); 995 mediastream_signaling_.SendAudioVideoStream1();
966 CreateAndSetRemoteOfferAndLocalAnswer(); 996 CreateAndSetRemoteOfferAndLocalAnswer();
967 EXPECT_FALSE(session_->CanInsertDtmf("")); 997 EXPECT_FALSE(session_->CanInsertDtmf(""));
968 EXPECT_EQ(can, session_->CanInsertDtmf(kAudioTrack1)); 998 EXPECT_EQ(can, session_->CanInsertDtmf(kAudioTrack1));
969 } 999 }
970 1000
971 // Helper class to configure loopback network and verify Best 1001 // Helper class to configure loopback network and verify Best
972 // Connection using right IP protocol for TestLoopbackCall 1002 // Connection using right IP protocol for TestLoopbackCall
973 // method. LoopbackNetworkManager applies firewall rules to block 1003 // method. LoopbackNetworkManager applies firewall rules to block
974 // all ping traffic once ICE completed, and remove them to observe 1004 // all ping traffic once ICE completed, and remove them to observe
975 // ICE reconnected again. This LoopbackNetworkConfiguration struct 1005 // ICE reconnected again. This LoopbackNetworkConfiguration struct
976 // verifies the best connection is using the right IP protocol after 1006 // verifies the best connection is using the right IP protocol after
977 // initial ICE convergences. 1007 // initial ICE convergences.
978 1008
979 class LoopbackNetworkConfiguration { 1009 class LoopbackNetworkConfiguration {
980 public: 1010 public:
981 LoopbackNetworkConfiguration() 1011 LoopbackNetworkConfiguration()
982 : test_ipv6_network_(false), 1012 : test_ipv6_network_(false),
983 test_extra_ipv4_network_(false), 1013 test_extra_ipv4_network_(false),
984 best_connection_after_initial_ice_converged_(1, 0) {} 1014 best_connection_after_initial_ice_converged_(1, 0) {}
985 1015
986 // Used to track the expected best connection count in each IP protocol. 1016 // Used to track the expected best connection count in each IP protocol.
987 struct ExpectedBestConnection { 1017 struct ExpectedBestConnection {
988 ExpectedBestConnection(int ipv4_count, int ipv6_count) 1018 ExpectedBestConnection(int ipv4_count, int ipv6_count)
989 : ipv4_count_(ipv4_count), 1019 : ipv4_count_(ipv4_count),
990 ipv6_count_(ipv6_count) {} 1020 ipv6_count_(ipv6_count) {}
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1137
1108 LOG(LS_INFO) << "Firewall Rules applied"; 1138 LOG(LS_INFO) << "Firewall Rules applied";
1109 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionDisconnected, 1139 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionDisconnected,
1110 observer_.ice_connection_state_, 1140 observer_.ice_connection_state_,
1111 kIceCandidatesTimeout); 1141 kIceCandidatesTimeout);
1112 1142
1113 metrics_observer_->Reset(); 1143 metrics_observer_->Reset();
1114 1144
1115 // Clearing the rules, session should move back to completed state. 1145 // Clearing the rules, session should move back to completed state.
1116 loopback_network_manager.ClearRules(fss_.get()); 1146 loopback_network_manager.ClearRules(fss_.get());
1117 // Session is automatically calling OnSignalingReady after creation of
1118 // new portallocator session which will allocate new set of candidates.
1119 1147
1120 LOG(LS_INFO) << "Firewall Rules cleared"; 1148 LOG(LS_INFO) << "Firewall Rules cleared";
1121
1122 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted, 1149 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
1123 observer_.ice_connection_state_, 1150 observer_.ice_connection_state_,
1124 kIceCandidatesTimeout); 1151 kIceCandidatesTimeout);
1125 1152
1126 // Now we block ping requests and wait until the ICE connection transitions 1153 // Now we block ping requests and wait until the ICE connection transitions
1127 // to the Failed state. This will take at least 30 seconds because it must 1154 // to the Failed state. This will take at least 30 seconds because it must
1128 // wait for the Port to timeout. 1155 // wait for the Port to timeout.
1129 int port_timeout = 30000; 1156 int port_timeout = 30000;
1130 1157
1131 loopback_network_manager.ApplyFirewallRules(fss_.get()); 1158 loopback_network_manager.ApplyFirewallRules(fss_.get());
1132 LOG(LS_INFO) << "Firewall Rules applied again"; 1159 LOG(LS_INFO) << "Firewall Rules applied again";
1133 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionDisconnected, 1160 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionDisconnected,
1134 observer_.ice_connection_state_, 1161 observer_.ice_connection_state_,
1135 kIceCandidatesTimeout + port_timeout); 1162 kIceCandidatesTimeout + port_timeout);
1136 } 1163 }
1137 1164
1138 void TestLoopbackCall() { 1165 void TestLoopbackCall() {
1139 LoopbackNetworkConfiguration config; 1166 LoopbackNetworkConfiguration config;
1140 TestLoopbackCall(config); 1167 TestLoopbackCall(config);
1141 } 1168 }
1142 1169
1143 void VerifyTransportType(const std::string& content_name, 1170 void VerifyTransportType(const std::string& content_name,
1144 cricket::TransportProtocol protocol) { 1171 cricket::TransportProtocol protocol) {
1145 const cricket::Transport* transport = session_->GetTransport(content_name); 1172 // TODO(deadbeef): this gets deleted with Peter's CL
1146 ASSERT_TRUE(transport != NULL); 1173 // const cricket::Transport* transport =
1147 EXPECT_EQ(protocol, transport->protocol()); 1174 // session_->GetTransport(content_name);
1175 // ASSERT_TRUE(transport != NULL);
1176 // EXPECT_EQ(protocol, transport->protocol());
1148 } 1177 }
1149 1178
1150 // Adds CN codecs to FakeMediaEngine and MediaDescriptionFactory. 1179 // Adds CN codecs to FakeMediaEngine and MediaDescriptionFactory.
1151 void AddCNCodecs() { 1180 void AddCNCodecs() {
1152 const cricket::AudioCodec kCNCodec1(102, "CN", 8000, 0, 1, 0); 1181 const cricket::AudioCodec kCNCodec1(102, "CN", 8000, 0, 1, 0);
1153 const cricket::AudioCodec kCNCodec2(103, "CN", 16000, 0, 1, 0); 1182 const cricket::AudioCodec kCNCodec2(103, "CN", 16000, 0, 1, 0);
1154 1183
1155 // Add kCNCodec for dtmf test. 1184 // Add kCNCodec for dtmf test.
1156 std::vector<cricket::AudioCodec> codecs = media_engine_->audio_codecs();; 1185 std::vector<cricket::AudioCodec> codecs = media_engine_->audio_codecs();;
1157 codecs.push_back(kCNCodec1); 1186 codecs.push_back(kCNCodec1);
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 // the offer and answer. 1689 // the offer and answer.
1661 SetRemoteDescriptionWithoutError(offer); 1690 SetRemoteDescriptionWithoutError(offer);
1662 SetLocalDescriptionAnswerExpectError( 1691 SetLocalDescriptionAnswerExpectError(
1663 kSdpWithoutDtlsFingerprint, answer); 1692 kSdpWithoutDtlsFingerprint, answer);
1664 } 1693 }
1665 1694
1666 // Test that we return a failure when applying a remote answer that doesn't have 1695 // Test that we return a failure when applying a remote answer that doesn't have
1667 // a DTLS fingerprint when DTLS is required. 1696 // a DTLS fingerprint when DTLS is required.
1668 TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) { 1697 TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) {
1669 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); 1698 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1670 // Enable both SDES and DTLS, so that offer won't be outright rejected as a
1671 // result of using the "UDP/TLS/RTP/SAVPF" profile.
1672 InitWithDtls(); 1699 InitWithDtls();
1673 session_->SetSdesPolicy(cricket::SEC_ENABLED);
1674 SessionDescriptionInterface* offer = CreateOffer(); 1700 SessionDescriptionInterface* offer = CreateOffer();
1675 cricket::MediaSessionOptions options; 1701 cricket::MediaSessionOptions options;
1676 options.recv_video = true; 1702 options.recv_video = true;
1703 rtc::scoped_ptr<SessionDescriptionInterface> temp_offer(
1704 CreateRemoteOffer(options, cricket::SEC_ENABLED));
1677 JsepSessionDescription* answer = 1705 JsepSessionDescription* answer =
1678 CreateRemoteAnswer(offer, options, cricket::SEC_ENABLED); 1706 CreateRemoteAnswer(temp_offer.get(), options, cricket::SEC_ENABLED);
1679 1707
1680 // SetRemoteDescription and SetLocalDescription will take the ownership of 1708 // SetRemoteDescription and SetLocalDescription will take the ownership of
1681 // the offer and answer. 1709 // the offer and answer.
1682 SetLocalDescriptionWithoutError(offer); 1710 SetLocalDescriptionWithoutError(offer);
1683 SetRemoteDescriptionAnswerExpectError( 1711 SetRemoteDescriptionAnswerExpectError(
1684 kSdpWithoutDtlsFingerprint, answer); 1712 kSdpWithoutDtlsFingerprint, answer);
1685 } 1713 }
1686 1714
1687 // Test that we create a local offer without SDES or DTLS and accept a remote 1715 // Test that we create a local offer without SDES or DTLS and accept a remote
1688 // answer without SDES or DTLS when encryption is disabled. 1716 // answer without SDES or DTLS when encryption is disabled.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 EXPECT_EQ(0u, candidates->count()); 1998 EXPECT_EQ(0u, candidates->count());
1971 1999
1972 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); 2000 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
1973 2001
1974 local_desc = session_->local_description(); 2002 local_desc = session_->local_description();
1975 candidates = local_desc->candidates(kMediaContentIndex0); 2003 candidates = local_desc->candidates(kMediaContentIndex0);
1976 ASSERT_TRUE(candidates != NULL); 2004 ASSERT_TRUE(candidates != NULL);
1977 EXPECT_LT(0u, candidates->count()); 2005 EXPECT_LT(0u, candidates->count());
1978 candidates = local_desc->candidates(1); 2006 candidates = local_desc->candidates(1);
1979 ASSERT_TRUE(candidates != NULL); 2007 ASSERT_TRUE(candidates != NULL);
1980 EXPECT_LT(0u, candidates->count()); 2008 EXPECT_EQ(0u, candidates->count());
1981 2009
1982 // Update the session descriptions. 2010 // Update the session descriptions.
1983 mediastream_signaling_.SendAudioVideoStream1(); 2011 mediastream_signaling_.SendAudioVideoStream1();
1984 CreateAndSetRemoteOfferAndLocalAnswer(); 2012 CreateAndSetRemoteOfferAndLocalAnswer();
1985 2013
1986 local_desc = session_->local_description(); 2014 local_desc = session_->local_description();
1987 candidates = local_desc->candidates(kMediaContentIndex0); 2015 candidates = local_desc->candidates(kMediaContentIndex0);
1988 ASSERT_TRUE(candidates != NULL); 2016 ASSERT_TRUE(candidates != NULL);
1989 EXPECT_LT(0u, candidates->count()); 2017 EXPECT_LT(0u, candidates->count());
1990 candidates = local_desc->candidates(1); 2018 candidates = local_desc->candidates(1);
1991 ASSERT_TRUE(candidates != NULL); 2019 ASSERT_TRUE(candidates != NULL);
1992 EXPECT_LT(0u, candidates->count()); 2020 EXPECT_EQ(0u, candidates->count());
1993 } 2021 }
1994 2022
1995 // Test that we can set a remote session description with remote candidates. 2023 // Test that we can set a remote session description with remote candidates.
1996 TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) { 2024 TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) {
1997 Init(); 2025 Init();
1998 2026
1999 cricket::Candidate candidate1; 2027 cricket::Candidate candidate1;
2000 candidate1.set_component(1); 2028 candidate1.set_component(1);
2001 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0, 2029 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0,
2002 candidate1); 2030 candidate1);
(...skipping 23 matching lines...) Expand all
2026 Init(); 2054 Init();
2027 mediastream_signaling_.SendAudioVideoStream1(); 2055 mediastream_signaling_.SendAudioVideoStream1();
2028 // Ice is started but candidates are not provided until SetLocalDescription 2056 // Ice is started but candidates are not provided until SetLocalDescription
2029 // is called. 2057 // is called.
2030 EXPECT_EQ(0u, observer_.mline_0_candidates_.size()); 2058 EXPECT_EQ(0u, observer_.mline_0_candidates_.size());
2031 EXPECT_EQ(0u, observer_.mline_1_candidates_.size()); 2059 EXPECT_EQ(0u, observer_.mline_1_candidates_.size());
2032 CreateAndSetRemoteOfferAndLocalAnswer(); 2060 CreateAndSetRemoteOfferAndLocalAnswer();
2033 // Wait until at least one local candidate has been collected. 2061 // Wait until at least one local candidate has been collected.
2034 EXPECT_TRUE_WAIT(0u < observer_.mline_0_candidates_.size(), 2062 EXPECT_TRUE_WAIT(0u < observer_.mline_0_candidates_.size(),
2035 kIceCandidatesTimeout); 2063 kIceCandidatesTimeout);
2036 EXPECT_TRUE_WAIT(0u < observer_.mline_1_candidates_.size(),
2037 kIceCandidatesTimeout);
2038 2064
2039 rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer()); 2065 rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer());
2040 2066
2041 ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL); 2067 ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL);
2042 EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count()); 2068 EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count());
2043 ASSERT_TRUE(local_offer->candidates(kMediaContentIndex1) != NULL);
2044 EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex1)->count());
2045 2069
2046 SessionDescriptionInterface* remote_offer(CreateRemoteOffer()); 2070 SessionDescriptionInterface* remote_offer(CreateRemoteOffer());
2047 SetRemoteDescriptionWithoutError(remote_offer); 2071 SetRemoteDescriptionWithoutError(remote_offer);
2048 SessionDescriptionInterface* answer = CreateAnswer(NULL); 2072 SessionDescriptionInterface* answer = CreateAnswer(NULL);
2049 ASSERT_TRUE(answer->candidates(kMediaContentIndex0) != NULL); 2073 ASSERT_TRUE(answer->candidates(kMediaContentIndex0) != NULL);
2050 EXPECT_LT(0u, answer->candidates(kMediaContentIndex0)->count()); 2074 EXPECT_LT(0u, answer->candidates(kMediaContentIndex0)->count());
2051 ASSERT_TRUE(answer->candidates(kMediaContentIndex1) != NULL);
2052 EXPECT_LT(0u, answer->candidates(kMediaContentIndex1)->count());
2053 SetLocalDescriptionWithoutError(answer); 2075 SetLocalDescriptionWithoutError(answer);
2054 } 2076 }
2055 2077
2056 // Verifies TransportProxy and media channels are created with content names 2078 // Verifies TransportProxy and media channels are created with content names
2057 // present in the SessionDescription. 2079 // present in the SessionDescription.
2058 TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) { 2080 TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
2059 Init(); 2081 Init();
2060 mediastream_signaling_.SendAudioVideoStream1(); 2082 mediastream_signaling_.SendAudioVideoStream1();
2061 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); 2083 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
2062 2084
(...skipping 21 matching lines...) Expand all
2084 2106
2085 SessionDescriptionInterface* modified_offer = 2107 SessionDescriptionInterface* modified_offer =
2086 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); 2108 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL);
2087 2109
2088 SetRemoteDescriptionWithoutError(modified_offer); 2110 SetRemoteDescriptionWithoutError(modified_offer);
2089 2111
2090 SessionDescriptionInterface* answer = 2112 SessionDescriptionInterface* answer =
2091 CreateAnswer(NULL); 2113 CreateAnswer(NULL);
2092 SetLocalDescriptionWithoutError(answer); 2114 SetLocalDescriptionWithoutError(answer);
2093 2115
2094 EXPECT_TRUE(session_->GetTransportProxy("audio_content_name") != NULL); 2116 cricket::TransportChannel* voice_transport_channel =
2095 EXPECT_TRUE(session_->GetTransportProxy("video_content_name") != NULL); 2117 session_->voice_rtp_transport_channel();
2118 EXPECT_TRUE(voice_transport_channel != NULL);
2119 EXPECT_EQ(voice_transport_channel->content_name(), "audio_content_name");
2120 cricket::TransportChannel* video_transport_channel =
2121 session_->video_rtp_transport_channel();
2122 EXPECT_TRUE(video_transport_channel != NULL);
2123 EXPECT_EQ(video_transport_channel->content_name(), "video_content_name");
2096 EXPECT_TRUE((video_channel_ = media_engine_->GetVideoChannel(0)) != NULL); 2124 EXPECT_TRUE((video_channel_ = media_engine_->GetVideoChannel(0)) != NULL);
2097 EXPECT_TRUE((voice_channel_ = media_engine_->GetVoiceChannel(0)) != NULL); 2125 EXPECT_TRUE((voice_channel_ = media_engine_->GetVoiceChannel(0)) != NULL);
2098 } 2126 }
2099 2127
2100 // Test that an offer contains the correct media content descriptions based on 2128 // Test that an offer contains the correct media content descriptions based on
2101 // the send streams when no constraints have been set. 2129 // the send streams when no constraints have been set.
2102 TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) { 2130 TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
2103 Init(); 2131 Init();
2104 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); 2132 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
2105 2133
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 2675
2648 PeerConnectionInterface::RTCOfferAnswerOptions options; 2676 PeerConnectionInterface::RTCOfferAnswerOptions options;
2649 options.use_rtp_mux = true; 2677 options.use_rtp_mux = true;
2650 2678
2651 SessionDescriptionInterface* offer = CreateRemoteOffer(); 2679 SessionDescriptionInterface* offer = CreateRemoteOffer();
2652 SetRemoteDescriptionWithoutError(offer); 2680 SetRemoteDescriptionWithoutError(offer);
2653 2681
2654 SessionDescriptionInterface* answer = CreateAnswer(NULL); 2682 SessionDescriptionInterface* answer = CreateAnswer(NULL);
2655 SetLocalDescriptionWithoutError(answer); 2683 SetLocalDescriptionWithoutError(answer);
2656 2684
2657 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2685 EXPECT_EQ(session_->voice_rtp_transport_channel(),
2658 session_->GetTransportProxy("video")->impl()); 2686 session_->video_rtp_transport_channel());
2659 2687
2660 cricket::Transport* t = session_->GetTransport("audio"); 2688 cricket::BaseChannel* voice_channel = session_->voice_channel();
2689 ASSERT(voice_channel != NULL);
2661 2690
2662 // Checks if one of the transport channels contains a connection using a given 2691 // Checks if one of the transport channels contains a connection using a given
2663 // port. 2692 // port.
2664 auto connection_with_remote_port = [t](int port) { 2693 auto connection_with_remote_port = [this, voice_channel](int port) {
2665 cricket::TransportStats stats; 2694 cricket::SessionStats stats;
2666 t->GetStats(&stats); 2695 session_->GetChannelTransportStats(voice_channel, &stats);
2667 for (auto& chan_stat : stats.channel_stats) { 2696 for (auto& kv : stats.transport_stats) {
2668 for (auto& conn_info : chan_stat.connection_infos) { 2697 for (auto& chan_stat : kv.second.channel_stats) {
2669 if (conn_info.remote_candidate.address().port() == port) { 2698 for (auto& conn_info : chan_stat.connection_infos) {
2670 return true; 2699 if (conn_info.remote_candidate.address().port() == port) {
2700 return true;
2701 }
2671 } 2702 }
2672 } 2703 }
2673 } 2704 }
2674 return false; 2705 return false;
2675 }; 2706 };
2676 2707
2677 EXPECT_FALSE(connection_with_remote_port(5000)); 2708 EXPECT_FALSE(connection_with_remote_port(5000));
2678 EXPECT_FALSE(connection_with_remote_port(5001)); 2709 EXPECT_FALSE(connection_with_remote_port(5001));
2679 EXPECT_FALSE(connection_with_remote_port(6000)); 2710 EXPECT_FALSE(connection_with_remote_port(6000));
2680 2711
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 2744
2714 EXPECT_TRUE_WAIT(connection_with_remote_port(5000), 1000); 2745 EXPECT_TRUE_WAIT(connection_with_remote_port(5000), 1000);
2715 EXPECT_TRUE_WAIT(connection_with_remote_port(5001), 1000); 2746 EXPECT_TRUE_WAIT(connection_with_remote_port(5001), 1000);
2716 2747
2717 // No need here for a _WAIT check since we are checking that state hasn't 2748 // No need here for a _WAIT check since we are checking that state hasn't
2718 // changed: if this is false we would be doing waits for nothing and if this 2749 // changed: if this is false we would be doing waits for nothing and if this
2719 // is true then there will be no messages processed anyways. 2750 // is true then there will be no messages processed anyways.
2720 EXPECT_FALSE(connection_with_remote_port(6000)); 2751 EXPECT_FALSE(connection_with_remote_port(6000));
2721 } 2752 }
2722 2753
2723 // kBundlePolicyBalanced bundle policy and answer contains BUNDLE. 2754 // kBundlePolicyBalanced BUNDLE policy and answer contains BUNDLE.
2724 TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) { 2755 TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) {
2725 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); 2756 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced);
2726 mediastream_signaling_.SendAudioVideoStream1(); 2757 mediastream_signaling_.SendAudioVideoStream1();
2727 2758
2728 PeerConnectionInterface::RTCOfferAnswerOptions options; 2759 PeerConnectionInterface::RTCOfferAnswerOptions options;
2729 options.use_rtp_mux = true; 2760 options.use_rtp_mux = true;
2730 2761
2731 SessionDescriptionInterface* offer = CreateOffer(options); 2762 SessionDescriptionInterface* offer = CreateOffer(options);
2732 SetLocalDescriptionWithoutError(offer); 2763 SetLocalDescriptionWithoutError(offer);
2733 2764
2734 EXPECT_NE(session_->GetTransportProxy("audio")->impl(), 2765 EXPECT_NE(session_->voice_channel()->transport_channel(),
2735 session_->GetTransportProxy("video")->impl()); 2766 session_->video_channel()->transport_channel());
2736 2767
2737 mediastream_signaling_.SendAudioVideoStream2(); 2768 mediastream_signaling_.SendAudioVideoStream2();
2738 SessionDescriptionInterface* answer = 2769 SessionDescriptionInterface* answer =
2739 CreateRemoteAnswer(session_->local_description()); 2770 CreateRemoteAnswer(session_->local_description());
2740 SetRemoteDescriptionWithoutError(answer); 2771 SetRemoteDescriptionWithoutError(answer);
2741 2772
2742 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2773 EXPECT_EQ(session_->voice_channel()->transport_channel(),
2743 session_->GetTransportProxy("video")->impl()); 2774 session_->video_channel()->transport_channel());
2744 } 2775 }
2745 2776
2746 // kBundlePolicyBalanced bundle policy but no BUNDLE in the answer. 2777 // kBundlePolicyBalanced BUNDLE policy but no BUNDLE in the answer.
2747 TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) { 2778 TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) {
2748 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); 2779 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced);
2749 mediastream_signaling_.SendAudioVideoStream1(); 2780 mediastream_signaling_.SendAudioVideoStream1();
2750 2781
2751 PeerConnectionInterface::RTCOfferAnswerOptions options; 2782 PeerConnectionInterface::RTCOfferAnswerOptions options;
2752 options.use_rtp_mux = true; 2783 options.use_rtp_mux = true;
2753 2784
2754 SessionDescriptionInterface* offer = CreateOffer(options); 2785 SessionDescriptionInterface* offer = CreateOffer(options);
2755 SetLocalDescriptionWithoutError(offer); 2786 SetLocalDescriptionWithoutError(offer);
2756 2787
2757 EXPECT_NE(session_->GetTransportProxy("audio")->impl(), 2788 EXPECT_NE(session_->voice_channel()->transport_channel(),
2758 session_->GetTransportProxy("video")->impl()); 2789 session_->video_channel()->transport_channel());
2759 2790
2760 mediastream_signaling_.SendAudioVideoStream2(); 2791 mediastream_signaling_.SendAudioVideoStream2();
2761 2792
2762 // Remove BUNDLE from the answer. 2793 // Remove BUNDLE from the answer.
2763 rtc::scoped_ptr<SessionDescriptionInterface> answer( 2794 rtc::scoped_ptr<SessionDescriptionInterface> answer(
2764 CreateRemoteAnswer(session_->local_description())); 2795 CreateRemoteAnswer(session_->local_description()));
2765 cricket::SessionDescription* answer_copy = answer->description()->Copy(); 2796 cricket::SessionDescription* answer_copy = answer->description()->Copy();
2766 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); 2797 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
2767 JsepSessionDescription* modified_answer = 2798 JsepSessionDescription* modified_answer =
2768 new JsepSessionDescription(JsepSessionDescription::kAnswer); 2799 new JsepSessionDescription(JsepSessionDescription::kAnswer);
2769 modified_answer->Initialize(answer_copy, "1", "1"); 2800 modified_answer->Initialize(answer_copy, "1", "1");
2770 SetRemoteDescriptionWithoutError(modified_answer); // 2801 SetRemoteDescriptionWithoutError(modified_answer); //
2771 2802
2772 EXPECT_NE(session_->GetTransportProxy("audio")->impl(), 2803 EXPECT_NE(session_->voice_channel()->transport_channel(),
2773 session_->GetTransportProxy("video")->impl()); 2804 session_->video_channel()->transport_channel());
2774 } 2805 }
2775 2806
2776 // kBundlePolicyMaxBundle policy with BUNDLE in the answer. 2807 // kBundlePolicyMaxBundle policy with BUNDLE in the answer.
2777 TEST_F(WebRtcSessionTest, TestMaxBundleBundleInAnswer) { 2808 TEST_F(WebRtcSessionTest, TestMaxBundleBundleInAnswer) {
2778 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); 2809 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle);
2779 mediastream_signaling_.SendAudioVideoStream1(); 2810 mediastream_signaling_.SendAudioVideoStream1();
2780 2811
2781 PeerConnectionInterface::RTCOfferAnswerOptions options; 2812 PeerConnectionInterface::RTCOfferAnswerOptions options;
2782 options.use_rtp_mux = true; 2813 options.use_rtp_mux = true;
2783 2814
2784 SessionDescriptionInterface* offer = CreateOffer(options); 2815 SessionDescriptionInterface* offer = CreateOffer(options);
2785 SetLocalDescriptionWithoutError(offer); 2816 SetLocalDescriptionWithoutError(offer);
2786 2817
2787 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2818 EXPECT_EQ(session_->voice_channel()->transport_channel(),
2788 session_->GetTransportProxy("video")->impl()); 2819 session_->video_channel()->transport_channel());
2789 2820
2790 mediastream_signaling_.SendAudioVideoStream2(); 2821 mediastream_signaling_.SendAudioVideoStream2();
2791 SessionDescriptionInterface* answer = 2822 SessionDescriptionInterface* answer =
2792 CreateRemoteAnswer(session_->local_description()); 2823 CreateRemoteAnswer(session_->local_description());
2793 SetRemoteDescriptionWithoutError(answer); 2824 SetRemoteDescriptionWithoutError(answer);
2794 2825
2795 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2826 EXPECT_EQ(session_->voice_rtp_transport_channel(),
2796 session_->GetTransportProxy("video")->impl()); 2827 session_->video_rtp_transport_channel());
2828 }
2829
2830 // kBundlePolicyMaxBundle policy with BUNDLE in the answer, but no
2831 // audio content in the answer.
2832 TEST_F(WebRtcSessionTest, TestMaxBundleRejectAudio) {
2833 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle);
2834 mediastream_signaling_.SendAudioVideoStream1();
2835
2836 PeerConnectionInterface::RTCOfferAnswerOptions options;
2837 options.use_rtp_mux = true;
2838
2839 SessionDescriptionInterface* offer = CreateOffer(options);
2840 SetLocalDescriptionWithoutError(offer);
2841
2842 std::string voice_content_name = session_->voice_channel()->content_name();
2843 std::string video_content_name = session_->video_channel()->content_name();
2844 EXPECT_EQ(session_->voice_channel()->transport_channel(),
2845 session_->video_channel()->transport_channel());
2846
2847 mediastream_signaling_.SendAudioVideoStream2();
2848 cricket::MediaSessionOptions recv_options;
2849 recv_options.recv_audio = false;
2850 recv_options.recv_video = true;
2851 SessionDescriptionInterface* answer =
2852 CreateRemoteAnswer(session_->local_description(), recv_options);
2853 SetRemoteDescriptionWithoutError(answer);
2854
2855 EXPECT_TRUE(NULL == session_->voice_channel());
2856 EXPECT_TRUE(NULL != session_->video_channel()->transport_channel());
2857
2858 session_->Terminate();
2859 EXPECT_TRUE(NULL == session_->voice_rtp_transport_channel());
2860 EXPECT_TRUE(NULL == session_->voice_rtcp_transport_channel());
2861 EXPECT_TRUE(NULL == session_->video_rtp_transport_channel());
2862 EXPECT_TRUE(NULL == session_->video_rtcp_transport_channel());
2797 } 2863 }
2798 2864
2799 // kBundlePolicyMaxBundle policy but no BUNDLE in the answer. 2865 // kBundlePolicyMaxBundle policy but no BUNDLE in the answer.
2800 TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) { 2866 TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) {
2801 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); 2867 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle);
2802 mediastream_signaling_.SendAudioVideoStream1(); 2868 mediastream_signaling_.SendAudioVideoStream1();
2803 2869
2804 PeerConnectionInterface::RTCOfferAnswerOptions options; 2870 PeerConnectionInterface::RTCOfferAnswerOptions options;
2805 options.use_rtp_mux = true; 2871 options.use_rtp_mux = true;
2806 2872
2807 SessionDescriptionInterface* offer = CreateOffer(options); 2873 SessionDescriptionInterface* offer = CreateOffer(options);
2808 SetLocalDescriptionWithoutError(offer); 2874 SetLocalDescriptionWithoutError(offer);
2809 2875
2810 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2876 EXPECT_EQ(session_->voice_channel()->transport_channel(),
2811 session_->GetTransportProxy("video")->impl()); 2877 session_->video_channel()->transport_channel());
2812 2878
2813 mediastream_signaling_.SendAudioVideoStream2(); 2879 mediastream_signaling_.SendAudioVideoStream2();
2814 2880
2815 // Remove BUNDLE from the answer. 2881 // Remove BUNDLE from the answer.
2816 rtc::scoped_ptr<SessionDescriptionInterface> answer( 2882 rtc::scoped_ptr<SessionDescriptionInterface> answer(
2817 CreateRemoteAnswer(session_->local_description())); 2883 CreateRemoteAnswer(session_->local_description()));
2818 cricket::SessionDescription* answer_copy = answer->description()->Copy(); 2884 cricket::SessionDescription* answer_copy = answer->description()->Copy();
2819 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); 2885 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
2820 JsepSessionDescription* modified_answer = 2886 JsepSessionDescription* modified_answer =
2821 new JsepSessionDescription(JsepSessionDescription::kAnswer); 2887 new JsepSessionDescription(JsepSessionDescription::kAnswer);
2822 modified_answer->Initialize(answer_copy, "1", "1"); 2888 modified_answer->Initialize(answer_copy, "1", "1");
2823 SetRemoteDescriptionWithoutError(modified_answer); 2889 SetRemoteDescriptionWithoutError(modified_answer);
2824 2890
2825 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2891 EXPECT_EQ(session_->voice_channel()->transport_channel(),
2826 session_->GetTransportProxy("video")->impl()); 2892 session_->video_channel()->transport_channel());
2827 } 2893 }
2828 2894
2829 // kBundlePolicyMaxCompat bundle policy and answer contains BUNDLE. 2895 // kBundlePolicyMaxCompat bundle policy and answer contains BUNDLE.
2830 TEST_F(WebRtcSessionTest, TestMaxCompatBundleInAnswer) { 2896 TEST_F(WebRtcSessionTest, TestMaxCompatBundleInAnswer) {
2831 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat); 2897 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat);
2832 mediastream_signaling_.SendAudioVideoStream1(); 2898 mediastream_signaling_.SendAudioVideoStream1();
2833 2899
2834 PeerConnectionInterface::RTCOfferAnswerOptions options; 2900 PeerConnectionInterface::RTCOfferAnswerOptions options;
2835 options.use_rtp_mux = true; 2901 options.use_rtp_mux = true;
2836 2902
2837 SessionDescriptionInterface* offer = CreateOffer(options); 2903 SessionDescriptionInterface* offer = CreateOffer(options);
2838 SetLocalDescriptionWithoutError(offer); 2904 SetLocalDescriptionWithoutError(offer);
2839 2905
2840 EXPECT_NE(session_->GetTransportProxy("audio")->impl(), 2906 EXPECT_NE(session_->voice_channel()->transport_channel(),
2841 session_->GetTransportProxy("video")->impl()); 2907 session_->video_channel()->transport_channel());
2842 2908
2843 mediastream_signaling_.SendAudioVideoStream2(); 2909 mediastream_signaling_.SendAudioVideoStream2();
2844 SessionDescriptionInterface* answer = 2910 SessionDescriptionInterface* answer =
2845 CreateRemoteAnswer(session_->local_description()); 2911 CreateRemoteAnswer(session_->local_description());
2846 SetRemoteDescriptionWithoutError(answer); 2912 SetRemoteDescriptionWithoutError(answer);
2847 2913
2848 // This should lead to an audio-only call but isn't implemented 2914 // This should lead to an audio-only call but isn't implemented
2849 // correctly yet. 2915 // correctly yet.
2850 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2916 EXPECT_EQ(session_->voice_channel()->transport_channel(),
2851 session_->GetTransportProxy("video")->impl()); 2917 session_->video_channel()->transport_channel());
2852 } 2918 }
2853 2919
2854 // kBundlePolicyMaxCompat bundle policy but no BUNDLE in the answer. 2920 // kBundlePolicyMaxCompat BUNDLE policy but no BUNDLE in the answer.
2855 TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) { 2921 TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) {
2856 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat); 2922 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat);
2857 mediastream_signaling_.SendAudioVideoStream1(); 2923 mediastream_signaling_.SendAudioVideoStream1();
2858 PeerConnectionInterface::RTCOfferAnswerOptions options; 2924 PeerConnectionInterface::RTCOfferAnswerOptions options;
2859 options.use_rtp_mux = true; 2925 options.use_rtp_mux = true;
2860 2926
2861 SessionDescriptionInterface* offer = CreateOffer(options); 2927 SessionDescriptionInterface* offer = CreateOffer(options);
2862 SetLocalDescriptionWithoutError(offer); 2928 SetLocalDescriptionWithoutError(offer);
2863 2929
2864 EXPECT_NE(session_->GetTransportProxy("audio")->impl(), 2930 EXPECT_NE(session_->voice_channel()->transport_channel(),
2865 session_->GetTransportProxy("video")->impl()); 2931 session_->video_channel()->transport_channel());
2866 2932
2867 mediastream_signaling_.SendAudioVideoStream2(); 2933 mediastream_signaling_.SendAudioVideoStream2();
2868 2934
2869 // Remove BUNDLE from the answer. 2935 // Remove BUNDLE from the answer.
2870 rtc::scoped_ptr<SessionDescriptionInterface> answer( 2936 rtc::scoped_ptr<SessionDescriptionInterface> answer(
2871 CreateRemoteAnswer(session_->local_description())); 2937 CreateRemoteAnswer(session_->local_description()));
2872 cricket::SessionDescription* answer_copy = answer->description()->Copy(); 2938 cricket::SessionDescription* answer_copy = answer->description()->Copy();
2873 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); 2939 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
2874 JsepSessionDescription* modified_answer = 2940 JsepSessionDescription* modified_answer =
2875 new JsepSessionDescription(JsepSessionDescription::kAnswer); 2941 new JsepSessionDescription(JsepSessionDescription::kAnswer);
2876 modified_answer->Initialize(answer_copy, "1", "1"); 2942 modified_answer->Initialize(answer_copy, "1", "1");
2877 SetRemoteDescriptionWithoutError(modified_answer); // 2943 SetRemoteDescriptionWithoutError(modified_answer); //
2878 2944
2879 EXPECT_NE(session_->GetTransportProxy("audio")->impl(), 2945 EXPECT_NE(session_->voice_channel()->transport_channel(),
2880 session_->GetTransportProxy("video")->impl()); 2946 session_->video_channel()->transport_channel());
2881 } 2947 }
2882 2948
2883 // kBundlePolicyMaxbundle and then we call SetRemoteDescription first. 2949 // kBundlePolicyMaxbundle and then we call SetRemoteDescription first.
2884 TEST_F(WebRtcSessionTest, TestMaxBundleWithSetRemoteDescriptionFirst) { 2950 TEST_F(WebRtcSessionTest, TestMaxBundleWithSetRemoteDescriptionFirst) {
2885 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); 2951 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle);
2886 mediastream_signaling_.SendAudioVideoStream1(); 2952 mediastream_signaling_.SendAudioVideoStream1();
2887 2953
2888 PeerConnectionInterface::RTCOfferAnswerOptions options; 2954 PeerConnectionInterface::RTCOfferAnswerOptions options;
2889 options.use_rtp_mux = true; 2955 options.use_rtp_mux = true;
2890 2956
2891 SessionDescriptionInterface* offer = CreateOffer(options); 2957 SessionDescriptionInterface* offer = CreateOffer(options);
2892 SetRemoteDescriptionWithoutError(offer); 2958 SetRemoteDescriptionWithoutError(offer);
2893 2959
2894 EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), 2960 EXPECT_EQ(session_->voice_rtp_transport_channel(),
2895 session_->GetTransportProxy("video")->impl()); 2961 session_->video_rtp_transport_channel());
2896 } 2962 }
2897 2963
2898 TEST_F(WebRtcSessionTest, TestRequireRtcpMux) { 2964 TEST_F(WebRtcSessionTest, TestRequireRtcpMux) {
2899 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyRequire); 2965 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyRequire);
2900 mediastream_signaling_.SendAudioVideoStream1(); 2966 mediastream_signaling_.SendAudioVideoStream1();
2901 2967
2902 PeerConnectionInterface::RTCOfferAnswerOptions options; 2968 PeerConnectionInterface::RTCOfferAnswerOptions options;
2903 SessionDescriptionInterface* offer = CreateOffer(options); 2969 SessionDescriptionInterface* offer = CreateOffer(options);
2904 SetLocalDescriptionWithoutError(offer); 2970 SetLocalDescriptionWithoutError(offer);
2905 2971
2906 EXPECT_FALSE(session_->GetTransportProxy("audio")->impl()->HasChannel(2)); 2972 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL);
2907 EXPECT_FALSE(session_->GetTransportProxy("video")->impl()->HasChannel(2)); 2973 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL);
2908 2974
2909 mediastream_signaling_.SendAudioVideoStream2(); 2975 mediastream_signaling_.SendAudioVideoStream2();
2910 SessionDescriptionInterface* answer = 2976 SessionDescriptionInterface* answer =
2911 CreateRemoteAnswer(session_->local_description()); 2977 CreateRemoteAnswer(session_->local_description());
2912 SetRemoteDescriptionWithoutError(answer); 2978 SetRemoteDescriptionWithoutError(answer);
2913 2979
2914 EXPECT_FALSE(session_->GetTransportProxy("audio")->impl()->HasChannel(2)); 2980 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL);
2915 EXPECT_FALSE(session_->GetTransportProxy("video")->impl()->HasChannel(2)); 2981 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL);
2916 } 2982 }
2917 2983
2918 TEST_F(WebRtcSessionTest, TestNegotiateRtcpMux) { 2984 TEST_F(WebRtcSessionTest, TestNegotiateRtcpMux) {
2919 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyNegotiate); 2985 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyNegotiate);
2920 mediastream_signaling_.SendAudioVideoStream1(); 2986 mediastream_signaling_.SendAudioVideoStream1();
2921 2987
2922 PeerConnectionInterface::RTCOfferAnswerOptions options; 2988 PeerConnectionInterface::RTCOfferAnswerOptions options;
2923 SessionDescriptionInterface* offer = CreateOffer(options); 2989 SessionDescriptionInterface* offer = CreateOffer(options);
2924 SetLocalDescriptionWithoutError(offer); 2990 SetLocalDescriptionWithoutError(offer);
2925 2991
2926 EXPECT_TRUE(session_->GetTransportProxy("audio")->impl()->HasChannel(2)); 2992 EXPECT_TRUE(session_->voice_rtcp_transport_channel() != NULL);
2927 EXPECT_TRUE(session_->GetTransportProxy("video")->impl()->HasChannel(2)); 2993 EXPECT_TRUE(session_->video_rtcp_transport_channel() != NULL);
2928 2994
2929 mediastream_signaling_.SendAudioVideoStream2(); 2995 mediastream_signaling_.SendAudioVideoStream2();
2930 SessionDescriptionInterface* answer = 2996 SessionDescriptionInterface* answer =
2931 CreateRemoteAnswer(session_->local_description()); 2997 CreateRemoteAnswer(session_->local_description());
2932 SetRemoteDescriptionWithoutError(answer); 2998 SetRemoteDescriptionWithoutError(answer);
2933 2999
2934 EXPECT_FALSE(session_->GetTransportProxy("audio")->impl()->HasChannel(2)); 3000 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL);
2935 EXPECT_FALSE(session_->GetTransportProxy("video")->impl()->HasChannel(2)); 3001 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL);
2936 } 3002 }
2937 3003
2938 // This test verifies that SetLocalDescription and SetRemoteDescription fails 3004 // This test verifies that SetLocalDescription and SetRemoteDescription fails
2939 // if BUNDLE is enabled but rtcp-mux is disabled in m-lines. 3005 // if BUNDLE is enabled but rtcp-mux is disabled in m-lines.
2940 TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) { 3006 TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) {
2941 Init(); 3007 Init();
2942 mediastream_signaling_.SendAudioVideoStream1(); 3008 mediastream_signaling_.SendAudioVideoStream1();
2943 3009
2944 PeerConnectionInterface::RTCOfferAnswerOptions options; 3010 PeerConnectionInterface::RTCOfferAnswerOptions options;
2945 options.use_rtp_mux = true; 3011 options.use_rtp_mux = true;
2946 3012
2947 SessionDescriptionInterface* offer = CreateOffer(options); 3013 SessionDescriptionInterface* offer = CreateOffer(options);
2948 std::string offer_str; 3014 std::string offer_str;
2949 offer->ToString(&offer_str); 3015 offer->ToString(&offer_str);
2950 // Disable rtcp-mux 3016 // Disable rtcp-mux
2951 const std::string rtcp_mux = "rtcp-mux"; 3017 const std::string rtcp_mux = "rtcp-mux";
2952 const std::string xrtcp_mux = "xrtcp-mux"; 3018 const std::string xrtcp_mux = "xrtcp-mux";
2953 rtc::replace_substrs(rtcp_mux.c_str(), rtcp_mux.length(), 3019 rtc::replace_substrs(rtcp_mux.c_str(), rtcp_mux.length(),
2954 xrtcp_mux.c_str(), xrtcp_mux.length(), 3020 xrtcp_mux.c_str(), xrtcp_mux.length(),
2955 &offer_str); 3021 &offer_str);
2956 JsepSessionDescription *local_offer = 3022 JsepSessionDescription* local_offer =
2957 new JsepSessionDescription(JsepSessionDescription::kOffer); 3023 new JsepSessionDescription(JsepSessionDescription::kOffer);
2958 EXPECT_TRUE((local_offer)->Initialize(offer_str, NULL)); 3024 EXPECT_TRUE((local_offer)->Initialize(offer_str, NULL));
2959 SetLocalDescriptionOfferExpectError(kBundleWithoutRtcpMux, local_offer); 3025 SetLocalDescriptionOfferExpectError(kBundleWithoutRtcpMux, local_offer);
2960 JsepSessionDescription *remote_offer = 3026 JsepSessionDescription* remote_offer =
2961 new JsepSessionDescription(JsepSessionDescription::kOffer); 3027 new JsepSessionDescription(JsepSessionDescription::kOffer);
2962 EXPECT_TRUE((remote_offer)->Initialize(offer_str, NULL)); 3028 EXPECT_TRUE((remote_offer)->Initialize(offer_str, NULL));
2963 SetRemoteDescriptionOfferExpectError(kBundleWithoutRtcpMux, remote_offer); 3029 SetRemoteDescriptionOfferExpectError(kBundleWithoutRtcpMux, remote_offer);
2964 // Trying unmodified SDP. 3030 // Trying unmodified SDP.
2965 SetLocalDescriptionWithoutError(offer); 3031 SetLocalDescriptionWithoutError(offer);
2966 } 3032 }
2967 3033
2968 TEST_F(WebRtcSessionTest, SetAudioPlayout) { 3034 TEST_F(WebRtcSessionTest, SetAudioPlayout) {
2969 Init(); 3035 Init();
2970 mediastream_signaling_.SendAudioVideoStream1(); 3036 mediastream_signaling_.SendAudioVideoStream1();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 // if ICE RFC5245 is supported in answer. 3227 // if ICE RFC5245 is supported in answer.
3162 TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) { 3228 TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
3163 Init(); 3229 Init();
3164 mediastream_signaling_.SendAudioVideoStream1(); 3230 mediastream_signaling_.SendAudioVideoStream1();
3165 SessionDescriptionInterface* offer = CreateOffer(); 3231 SessionDescriptionInterface* offer = CreateOffer();
3166 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); 3232 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
3167 SetLocalDescriptionWithoutError(offer); 3233 SetLocalDescriptionWithoutError(offer);
3168 3234
3169 SetRemoteDescriptionWithoutError(answer); 3235 SetRemoteDescriptionWithoutError(answer);
3170 VerifyTransportType("audio", cricket::ICEPROTO_RFC5245); 3236 VerifyTransportType("audio", cricket::ICEPROTO_RFC5245);
3171 VerifyTransportType("video", cricket::ICEPROTO_RFC5245);
3172 } 3237 }
3173 3238
3174 // This test verifies the ice protocol type at receiver side of the call if 3239 // This test verifies the ice protocol type at receiver side of the call if
3175 // receiver decides to use ice RFC 5245. 3240 // receiver decides to use ice RFC 5245.
3176 TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) { 3241 TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
3177 Init(); 3242 Init();
3178 mediastream_signaling_.SendAudioVideoStream1(); 3243 mediastream_signaling_.SendAudioVideoStream1();
3179 SessionDescriptionInterface* offer = CreateOffer(); 3244 SessionDescriptionInterface* offer = CreateOffer();
3180 SetRemoteDescriptionWithoutError(offer); 3245 SetRemoteDescriptionWithoutError(offer);
3181 SessionDescriptionInterface* answer = CreateAnswer(NULL); 3246 SessionDescriptionInterface* answer = CreateAnswer(NULL);
3182 SetLocalDescriptionWithoutError(answer); 3247 SetLocalDescriptionWithoutError(answer);
3183 VerifyTransportType("audio", cricket::ICEPROTO_RFC5245); 3248 VerifyTransportType("audio", cricket::ICEPROTO_RFC5245);
3184 VerifyTransportType("video", cricket::ICEPROTO_RFC5245);
3185 } 3249 }
3186 3250
3187 // Verifing local offer and remote answer have matching m-lines as per RFC 3264. 3251 // Verifing local offer and remote answer have matching m-lines as per RFC 3264.
3188 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) { 3252 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) {
3189 Init(); 3253 Init();
3190 mediastream_signaling_.SendAudioVideoStream1(); 3254 mediastream_signaling_.SendAudioVideoStream1();
3191 SessionDescriptionInterface* offer = CreateOffer(); 3255 SessionDescriptionInterface* offer = CreateOffer();
3192 SetLocalDescriptionWithoutError(offer); 3256 SetLocalDescriptionWithoutError(offer);
3193 rtc::scoped_ptr<SessionDescriptionInterface> answer( 3257 rtc::scoped_ptr<SessionDescriptionInterface> answer(
3194 CreateRemoteAnswer(session_->local_description())); 3258 CreateRemoteAnswer(session_->local_description()));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3262 candidate.set_component(1); 3326 candidate.set_component(1);
3263 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0, 3327 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0,
3264 candidate); 3328 candidate);
3265 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); 3329 EXPECT_TRUE(offer->AddCandidate(&ice_candidate));
3266 cricket::Candidate candidate1; 3330 cricket::Candidate candidate1;
3267 candidate1.set_component(1); 3331 candidate1.set_component(1);
3268 JsepIceCandidate ice_candidate1(kMediaContentName1, kMediaContentIndex1, 3332 JsepIceCandidate ice_candidate1(kMediaContentName1, kMediaContentIndex1,
3269 candidate1); 3333 candidate1);
3270 EXPECT_TRUE(offer->AddCandidate(&ice_candidate1)); 3334 EXPECT_TRUE(offer->AddCandidate(&ice_candidate1));
3271 SetRemoteDescriptionWithoutError(offer); 3335 SetRemoteDescriptionWithoutError(offer);
3272 ASSERT_TRUE(session_->GetTransportProxy("audio") != NULL); 3336 ASSERT_TRUE(session_->voice_rtp_transport_channel() != NULL);
3273 ASSERT_TRUE(session_->GetTransportProxy("video") != NULL); 3337 ASSERT_TRUE(session_->video_rtp_transport_channel() != NULL);
3274 3338
3275 // Pump for 1 second and verify that no candidates are generated. 3339 // Pump for 1 second and verify that no candidates are generated.
3276 rtc::Thread::Current()->ProcessMessages(1000); 3340 rtc::Thread::Current()->ProcessMessages(1000);
3277 EXPECT_TRUE(observer_.mline_0_candidates_.empty()); 3341 EXPECT_TRUE(observer_.mline_0_candidates_.empty());
3278 EXPECT_TRUE(observer_.mline_1_candidates_.empty()); 3342 EXPECT_TRUE(observer_.mline_1_candidates_.empty());
3279 3343
3280 SessionDescriptionInterface* answer = CreateAnswer(NULL); 3344 SessionDescriptionInterface* answer = CreateAnswer(NULL);
3281 SetLocalDescriptionWithoutError(answer); 3345 SetLocalDescriptionWithoutError(answer);
3282 EXPECT_TRUE(session_->GetTransportProxy("audio")->negotiated());
3283 EXPECT_TRUE(session_->GetTransportProxy("video")->negotiated());
3284 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); 3346 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
3285 } 3347 }
3286 3348
3287 // This test verifies that crypto parameter is updated in local session 3349 // This test verifies that crypto parameter is updated in local session
3288 // description as per security policy set in MediaSessionDescriptionFactory. 3350 // description as per security policy set in MediaSessionDescriptionFactory.
3289 TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) { 3351 TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) {
3290 Init(); 3352 Init();
3291 mediastream_signaling_.SendAudioVideoStream1(); 3353 mediastream_signaling_.SendAudioVideoStream1();
3292 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); 3354 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
3293 3355
(...skipping 14 matching lines...) Expand all
3308 options_.disable_encryption = true; 3370 options_.disable_encryption = true;
3309 Init(); 3371 Init();
3310 mediastream_signaling_.SendAudioVideoStream1(); 3372 mediastream_signaling_.SendAudioVideoStream1();
3311 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); 3373 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
3312 3374
3313 // Making sure SetLocalDescription correctly sets crypto value in 3375 // Making sure SetLocalDescription correctly sets crypto value in
3314 // SessionDescription object after de-serialization of sdp string. The value 3376 // SessionDescription object after de-serialization of sdp string. The value
3315 // will be set as per MediaSessionDescriptionFactory. 3377 // will be set as per MediaSessionDescriptionFactory.
3316 std::string offer_str; 3378 std::string offer_str;
3317 offer->ToString(&offer_str); 3379 offer->ToString(&offer_str);
3318 SessionDescriptionInterface *jsep_offer_str = 3380 SessionDescriptionInterface* jsep_offer_str =
3319 CreateSessionDescription(JsepSessionDescription::kOffer, offer_str, NULL); 3381 CreateSessionDescription(JsepSessionDescription::kOffer, offer_str, NULL);
3320 SetLocalDescriptionWithoutError(jsep_offer_str); 3382 SetLocalDescriptionWithoutError(jsep_offer_str);
3321 EXPECT_FALSE(session_->voice_channel()->secure_required()); 3383 EXPECT_FALSE(session_->voice_channel()->secure_required());
3322 EXPECT_FALSE(session_->video_channel()->secure_required()); 3384 EXPECT_FALSE(session_->video_channel()->secure_required());
3323 } 3385 }
3324 3386
3325 // This test verifies that an answer contains new ufrag and password if an offer 3387 // This test verifies that an answer contains new ufrag and password if an offer
3326 // with new ufrag and password is received. 3388 // with new ufrag and password is received.
3327 TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) { 3389 TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) {
3328 Init(); 3390 Init();
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3941 // terminated. The offer creation may or may not have succeeded, but we 4003 // terminated. The offer creation may or may not have succeeded, but we
3942 // must have received a notification which, so the only invalid state 4004 // must have received a notification which, so the only invalid state
3943 // is kInit. 4005 // is kInit.
3944 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); 4006 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state());
3945 } 4007 }
3946 } 4008 }
3947 4009
3948 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4010 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
3949 // currently fails because upon disconnection and reconnection OnIceComplete is 4011 // currently fails because upon disconnection and reconnection OnIceComplete is
3950 // called more than once without returning to IceGatheringGathering. 4012 // called more than once without returning to IceGatheringGathering.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698