OLD | NEW |
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 13 matching lines...) Expand all Loading... |
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> | 28 #include <vector> |
29 | 29 |
30 #include "talk/app/webrtc/audiotrack.h" | 30 #include "talk/app/webrtc/audiotrack.h" |
31 #include "talk/app/webrtc/fakemetricsobserver.h" | 31 #include "talk/app/webrtc/fakemetricsobserver.h" |
32 #include "talk/app/webrtc/jsepicecandidate.h" | 32 #include "talk/app/webrtc/jsepicecandidate.h" |
33 #include "talk/app/webrtc/jsepsessiondescription.h" | 33 #include "talk/app/webrtc/jsepsessiondescription.h" |
| 34 #include "talk/app/webrtc/peerconnection.h" |
34 #include "talk/app/webrtc/mediastreamsignaling.h" | 35 #include "talk/app/webrtc/mediastreamsignaling.h" |
| 36 #include "talk/app/webrtc/sctputils.h" |
| 37 #include "talk/app/webrtc/streamcollection.h" |
35 #include "talk/app/webrtc/streamcollection.h" | 38 #include "talk/app/webrtc/streamcollection.h" |
36 #include "talk/app/webrtc/test/fakeconstraints.h" | 39 #include "talk/app/webrtc/test/fakeconstraints.h" |
37 #include "talk/app/webrtc/test/fakedtlsidentitystore.h" | 40 #include "talk/app/webrtc/test/fakedtlsidentitystore.h" |
38 #include "talk/app/webrtc/test/fakemediastreamsignaling.h" | |
39 #include "talk/app/webrtc/videotrack.h" | 41 #include "talk/app/webrtc/videotrack.h" |
40 #include "talk/app/webrtc/webrtcsession.h" | 42 #include "talk/app/webrtc/webrtcsession.h" |
41 #include "talk/app/webrtc/webrtcsessiondescriptionfactory.h" | 43 #include "talk/app/webrtc/webrtcsessiondescriptionfactory.h" |
42 #include "talk/media/base/fakemediaengine.h" | 44 #include "talk/media/base/fakemediaengine.h" |
43 #include "talk/media/base/fakevideorenderer.h" | 45 #include "talk/media/base/fakevideorenderer.h" |
44 #include "talk/media/base/mediachannel.h" | 46 #include "talk/media/base/mediachannel.h" |
45 #include "webrtc/p2p/base/stunserver.h" | 47 #include "webrtc/p2p/base/stunserver.h" |
46 #include "webrtc/p2p/base/teststunserver.h" | 48 #include "webrtc/p2p/base/teststunserver.h" |
47 #include "webrtc/p2p/base/testturnserver.h" | 49 #include "webrtc/p2p/base/testturnserver.h" |
48 #include "webrtc/p2p/base/transportchannel.h" | 50 #include "webrtc/p2p/base/transportchannel.h" |
(...skipping 23 matching lines...) Expand all Loading... |
72 using cricket::DF_PLAY; | 74 using cricket::DF_PLAY; |
73 using cricket::DF_SEND; | 75 using cricket::DF_SEND; |
74 using cricket::FakeVoiceMediaChannel; | 76 using cricket::FakeVoiceMediaChannel; |
75 using cricket::TransportInfo; | 77 using cricket::TransportInfo; |
76 using rtc::SocketAddress; | 78 using rtc::SocketAddress; |
77 using rtc::scoped_ptr; | 79 using rtc::scoped_ptr; |
78 using rtc::Thread; | 80 using rtc::Thread; |
79 using webrtc::CreateSessionDescription; | 81 using webrtc::CreateSessionDescription; |
80 using webrtc::CreateSessionDescriptionObserver; | 82 using webrtc::CreateSessionDescriptionObserver; |
81 using webrtc::CreateSessionDescriptionRequest; | 83 using webrtc::CreateSessionDescriptionRequest; |
| 84 using webrtc::DataChannel; |
82 using webrtc::DtlsIdentityStoreInterface; | 85 using webrtc::DtlsIdentityStoreInterface; |
83 using webrtc::FakeConstraints; | 86 using webrtc::FakeConstraints; |
84 using webrtc::FakeMetricsObserver; | 87 using webrtc::FakeMetricsObserver; |
85 using webrtc::IceCandidateCollection; | 88 using webrtc::IceCandidateCollection; |
| 89 using webrtc::InternalDataChannelInit; |
86 using webrtc::JsepIceCandidate; | 90 using webrtc::JsepIceCandidate; |
87 using webrtc::JsepSessionDescription; | 91 using webrtc::JsepSessionDescription; |
88 using webrtc::PeerConnectionFactoryInterface; | 92 using webrtc::PeerConnectionFactoryInterface; |
89 using webrtc::PeerConnectionInterface; | 93 using webrtc::PeerConnectionInterface; |
90 using webrtc::SessionDescriptionInterface; | 94 using webrtc::SessionDescriptionInterface; |
91 using webrtc::StreamCollection; | 95 using webrtc::StreamCollection; |
92 using webrtc::WebRtcSession; | 96 using webrtc::WebRtcSession; |
93 using webrtc::kBundleWithoutRtcpMux; | 97 using webrtc::kBundleWithoutRtcpMux; |
94 using webrtc::kCreateChannelFailed; | 98 using webrtc::kCreateChannelFailed; |
95 using webrtc::kInvalidSdp; | 99 using webrtc::kInvalidSdp; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 "a=ice-pwd:cMvOlFvQ6ochez1ZOoC2uBEC\r\n" | 154 "a=ice-pwd:cMvOlFvQ6ochez1ZOoC2uBEC\r\n" |
151 "a=mid:video\r\n" | 155 "a=mid:video\r\n" |
152 "a=sendrecv\r\n" | 156 "a=sendrecv\r\n" |
153 "a=rtcp-mux\r\n" | 157 "a=rtcp-mux\r\n" |
154 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | 158 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " |
155 "inline:5/4N5CDvMiyDArHtBByUM71VIkguH17ZNoX60GrA\r\n" | 159 "inline:5/4N5CDvMiyDArHtBByUM71VIkguH17ZNoX60GrA\r\n" |
156 "a=rtpmap:0 fake_video_codec/90000\r\n" | 160 "a=rtpmap:0 fake_video_codec/90000\r\n" |
157 "a=rtpmap:96 rtx/90000\r\n" | 161 "a=rtpmap:96 rtx/90000\r\n" |
158 "a=fmtp:96 apt=0\r\n"; | 162 "a=fmtp:96 apt=0\r\n"; |
159 | 163 |
| 164 static const char kStream1[] = "stream1"; |
| 165 static const char kVideoTrack1[] = "video1"; |
| 166 static const char kAudioTrack1[] = "audio1"; |
| 167 |
| 168 static const char kStream2[] = "stream2"; |
| 169 static const char kVideoTrack2[] = "video2"; |
| 170 static const char kAudioTrack2[] = "audio2"; |
| 171 |
160 enum RTCCertificateGenerationMethod { ALREADY_GENERATED, DTLS_IDENTITY_STORE }; | 172 enum RTCCertificateGenerationMethod { ALREADY_GENERATED, DTLS_IDENTITY_STORE }; |
161 | 173 |
162 // Add some extra |newlines| to the |message| after |line|. | 174 // Add some extra |newlines| to the |message| after |line|. |
163 static void InjectAfter(const std::string& line, | 175 static void InjectAfter(const std::string& line, |
164 const std::string& newlines, | 176 const std::string& newlines, |
165 std::string* message) { | 177 std::string* message) { |
166 const std::string tmp = line + newlines; | 178 const std::string tmp = line + newlines; |
167 rtc::replace_substrs(line.c_str(), line.length(), tmp.c_str(), tmp.length(), | 179 rtc::replace_substrs(line.c_str(), line.length(), tmp.c_str(), tmp.length(), |
168 message); | 180 message); |
169 } | 181 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 PeerConnectionInterface::IceConnectionState ice_connection_state_; | 242 PeerConnectionInterface::IceConnectionState ice_connection_state_; |
231 PeerConnectionInterface::IceGatheringState ice_gathering_state_; | 243 PeerConnectionInterface::IceGatheringState ice_gathering_state_; |
232 }; | 244 }; |
233 | 245 |
234 class WebRtcSessionForTest : public webrtc::WebRtcSession { | 246 class WebRtcSessionForTest : public webrtc::WebRtcSession { |
235 public: | 247 public: |
236 WebRtcSessionForTest(cricket::ChannelManager* cmgr, | 248 WebRtcSessionForTest(cricket::ChannelManager* cmgr, |
237 rtc::Thread* signaling_thread, | 249 rtc::Thread* signaling_thread, |
238 rtc::Thread* worker_thread, | 250 rtc::Thread* worker_thread, |
239 cricket::PortAllocator* port_allocator, | 251 cricket::PortAllocator* port_allocator, |
240 webrtc::IceObserver* ice_observer, | 252 webrtc::IceObserver* ice_observer) |
241 webrtc::MediaStreamSignaling* mediastream_signaling) | 253 : WebRtcSession(cmgr, signaling_thread, worker_thread, port_allocator) { |
242 : WebRtcSession(cmgr, signaling_thread, worker_thread, port_allocator, | |
243 mediastream_signaling) { | |
244 RegisterIceObserver(ice_observer); | 254 RegisterIceObserver(ice_observer); |
245 } | 255 } |
246 virtual ~WebRtcSessionForTest() {} | 256 virtual ~WebRtcSessionForTest() {} |
247 | 257 |
248 // Note that these methods are only safe to use if the signaling thread | 258 // Note that these methods are only safe to use if the signaling thread |
249 // is the same as the worker thread | 259 // is the same as the worker thread |
250 cricket::TransportChannel* voice_rtp_transport_channel() { | 260 cricket::TransportChannel* voice_rtp_transport_channel() { |
251 return rtp_transport_channel(voice_channel()); | 261 return rtp_transport_channel(voice_channel()); |
252 } | 262 } |
253 | 263 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 347 } |
338 | 348 |
339 void SetSink(Sink* sink) override { sink_ = sink; } | 349 void SetSink(Sink* sink) override { sink_ = sink; } |
340 | 350 |
341 cricket::AudioRenderer::Sink* sink() const { return sink_; } | 351 cricket::AudioRenderer::Sink* sink() const { return sink_; } |
342 private: | 352 private: |
343 cricket::AudioRenderer::Sink* sink_; | 353 cricket::AudioRenderer::Sink* sink_; |
344 }; | 354 }; |
345 | 355 |
346 class WebRtcSessionTest | 356 class WebRtcSessionTest |
347 : public testing::TestWithParam<RTCCertificateGenerationMethod> { | 357 : public testing::TestWithParam<RTCCertificateGenerationMethod>, |
| 358 public sigslot::has_slots<> { |
348 protected: | 359 protected: |
349 // TODO Investigate why ChannelManager crashes, if it's created | 360 // TODO Investigate why ChannelManager crashes, if it's created |
350 // after stun_server. | 361 // after stun_server. |
351 WebRtcSessionTest() | 362 WebRtcSessionTest() |
352 : media_engine_(new cricket::FakeMediaEngine()), | 363 : media_engine_(new cricket::FakeMediaEngine()), |
353 data_engine_(new cricket::FakeDataEngine()), | 364 data_engine_(new cricket::FakeDataEngine()), |
354 channel_manager_(new cricket::ChannelManager( | 365 channel_manager_(new cricket::ChannelManager( |
355 media_engine_, data_engine_, new cricket::CaptureManager(), | 366 media_engine_, data_engine_, new cricket::CaptureManager(), |
356 rtc::Thread::Current())), | 367 rtc::Thread::Current())), |
357 tdesc_factory_(new cricket::TransportDescriptionFactory()), | 368 tdesc_factory_(new cricket::TransportDescriptionFactory()), |
358 desc_factory_(new cricket::MediaSessionDescriptionFactory( | 369 desc_factory_(new cricket::MediaSessionDescriptionFactory( |
359 channel_manager_.get(), tdesc_factory_.get())), | 370 channel_manager_.get(), tdesc_factory_.get())), |
360 pss_(new rtc::PhysicalSocketServer), | 371 pss_(new rtc::PhysicalSocketServer), |
361 vss_(new rtc::VirtualSocketServer(pss_.get())), | 372 vss_(new rtc::VirtualSocketServer(pss_.get())), |
362 fss_(new rtc::FirewallSocketServer(vss_.get())), | 373 fss_(new rtc::FirewallSocketServer(vss_.get())), |
363 ss_scope_(fss_.get()), | 374 ss_scope_(fss_.get()), |
364 stun_socket_addr_(rtc::SocketAddress(kStunAddrHost, | 375 stun_socket_addr_(rtc::SocketAddress(kStunAddrHost, |
365 cricket::STUN_SERVER_PORT)), | 376 cricket::STUN_SERVER_PORT)), |
366 stun_server_(cricket::TestStunServer::Create(Thread::Current(), | 377 stun_server_(cricket::TestStunServer::Create(Thread::Current(), |
367 stun_socket_addr_)), | 378 stun_socket_addr_)), |
368 turn_server_(Thread::Current(), kTurnUdpIntAddr, kTurnUdpExtAddr), | 379 turn_server_(Thread::Current(), kTurnUdpIntAddr, kTurnUdpExtAddr), |
369 mediastream_signaling_(channel_manager_.get()), | |
370 metrics_observer_(new rtc::RefCountedObject<FakeMetricsObserver>()) { | 380 metrics_observer_(new rtc::RefCountedObject<FakeMetricsObserver>()) { |
371 cricket::ServerAddresses stun_servers; | 381 cricket::ServerAddresses stun_servers; |
372 stun_servers.insert(stun_socket_addr_); | 382 stun_servers.insert(stun_socket_addr_); |
373 allocator_.reset(new cricket::BasicPortAllocator( | 383 allocator_.reset(new cricket::BasicPortAllocator( |
374 &network_manager_, | 384 &network_manager_, |
375 stun_servers, | 385 stun_servers, |
376 SocketAddress(), SocketAddress(), SocketAddress())); | 386 SocketAddress(), SocketAddress(), SocketAddress())); |
377 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | | 387 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | |
378 cricket::PORTALLOCATOR_DISABLE_RELAY); | 388 cricket::PORTALLOCATOR_DISABLE_RELAY); |
379 EXPECT_TRUE(channel_manager_->Init()); | 389 EXPECT_TRUE(channel_manager_->Init()); |
380 desc_factory_->set_add_legacy_streams(false); | 390 desc_factory_->set_add_legacy_streams(false); |
381 allocator_->set_step_delay(cricket::kMinimumStepDelay); | 391 allocator_->set_step_delay(cricket::kMinimumStepDelay); |
382 } | 392 } |
383 | 393 |
384 void AddInterface(const SocketAddress& addr) { | 394 void AddInterface(const SocketAddress& addr) { |
385 network_manager_.AddInterface(addr); | 395 network_manager_.AddInterface(addr); |
386 } | 396 } |
387 | 397 |
388 // If |dtls_identity_store| != null or |rtc_configuration| contains | 398 // If |dtls_identity_store| != null or |rtc_configuration| contains |
389 // |certificates| then DTLS will be enabled unless explicitly disabled by | 399 // |certificates| then DTLS will be enabled unless explicitly disabled by |
390 // |rtc_configuration| options. When DTLS is enabled a certificate will be | 400 // |rtc_configuration| options. When DTLS is enabled a certificate will be |
391 // used if provided, otherwise one will be generated using the | 401 // used if provided, otherwise one will be generated using the |
392 // |dtls_identity_store|. | 402 // |dtls_identity_store|. |
393 void Init( | 403 void Init( |
394 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, | 404 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, |
395 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { | 405 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { |
396 ASSERT_TRUE(session_.get() == NULL); | 406 ASSERT_TRUE(session_.get() == NULL); |
397 session_.reset(new WebRtcSessionForTest( | 407 session_.reset(new WebRtcSessionForTest( |
398 channel_manager_.get(), rtc::Thread::Current(), | 408 channel_manager_.get(), rtc::Thread::Current(), rtc::Thread::Current(), |
399 rtc::Thread::Current(), allocator_.get(), | 409 allocator_.get(), &observer_)); |
400 &observer_, | 410 session_->SignalDataChannelOpenMessage.connect( |
401 &mediastream_signaling_)); | 411 this, &WebRtcSessionTest::OnDataChannelOpenMessage); |
402 | 412 |
403 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, | 413 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, |
404 observer_.ice_connection_state_); | 414 observer_.ice_connection_state_); |
405 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, | 415 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, |
406 observer_.ice_gathering_state_); | 416 observer_.ice_gathering_state_); |
407 | 417 |
408 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), | 418 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), |
409 dtls_identity_store.Pass(), | 419 dtls_identity_store.Pass(), |
410 rtc_configuration)); | 420 rtc_configuration)); |
411 session_->set_metrics_observer(metrics_observer_); | 421 session_->set_metrics_observer(metrics_observer_); |
412 } | 422 } |
413 | 423 |
| 424 void OnDataChannelOpenMessage(const std::string& label, |
| 425 const InternalDataChannelInit& config) { |
| 426 last_data_channel_label_ = label; |
| 427 last_data_channel_config_ = config; |
| 428 } |
| 429 |
414 void Init() { | 430 void Init() { |
415 PeerConnectionInterface::RTCConfiguration configuration; | 431 PeerConnectionInterface::RTCConfiguration configuration; |
416 Init(nullptr, configuration); | 432 Init(nullptr, configuration); |
417 } | 433 } |
418 | 434 |
419 void InitWithIceTransport( | 435 void InitWithIceTransport( |
420 PeerConnectionInterface::IceTransportsType ice_transport_type) { | 436 PeerConnectionInterface::IceTransportsType ice_transport_type) { |
421 PeerConnectionInterface::RTCConfiguration configuration; | 437 PeerConnectionInterface::RTCConfiguration configuration; |
422 configuration.type = ice_transport_type; | 438 configuration.type = ice_transport_type; |
423 Init(nullptr, configuration); | 439 Init(nullptr, configuration); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // Add kTelephoneEventCodec for dtmf test. | 483 // Add kTelephoneEventCodec for dtmf test. |
468 const cricket::AudioCodec kTelephoneEventCodec( | 484 const cricket::AudioCodec kTelephoneEventCodec( |
469 106, "telephone-event", 8000, 0, 1, 0); | 485 106, "telephone-event", 8000, 0, 1, 0); |
470 std::vector<cricket::AudioCodec> codecs; | 486 std::vector<cricket::AudioCodec> codecs; |
471 codecs.push_back(kTelephoneEventCodec); | 487 codecs.push_back(kTelephoneEventCodec); |
472 media_engine_->SetAudioCodecs(codecs); | 488 media_engine_->SetAudioCodecs(codecs); |
473 desc_factory_->set_audio_codecs(codecs); | 489 desc_factory_->set_audio_codecs(codecs); |
474 Init(); | 490 Init(); |
475 } | 491 } |
476 | 492 |
477 // Creates a local offer and applies it. Starts ice. | 493 void SendAudioVideoStream1() { |
478 // Call mediastream_signaling_.UseOptionsWithStreamX() before this function | 494 send_stream_1_ = true; |
| 495 send_stream_2_ = false; |
| 496 send_audio_ = true; |
| 497 send_video_ = true; |
| 498 } |
| 499 |
| 500 void SendAudioVideoStream2() { |
| 501 send_stream_1_ = false; |
| 502 send_stream_2_ = true; |
| 503 send_audio_ = true; |
| 504 send_video_ = true; |
| 505 } |
| 506 |
| 507 void SendAudioVideoStream1And2() { |
| 508 send_stream_1_ = true; |
| 509 send_stream_2_ = true; |
| 510 send_audio_ = true; |
| 511 send_video_ = true; |
| 512 } |
| 513 |
| 514 void SendNothing() { |
| 515 send_stream_1_ = false; |
| 516 send_stream_2_ = false; |
| 517 send_audio_ = false; |
| 518 send_video_ = false; |
| 519 } |
| 520 |
| 521 void SendAudioOnlyStream2() { |
| 522 send_stream_1_ = false; |
| 523 send_stream_2_ = true; |
| 524 send_audio_ = true; |
| 525 send_video_ = false; |
| 526 } |
| 527 |
| 528 void SendVideoOnlyStream2() { |
| 529 send_stream_1_ = false; |
| 530 send_stream_2_ = true; |
| 531 send_audio_ = false; |
| 532 send_video_ = true; |
| 533 } |
| 534 |
| 535 void AddStreamsToOptions(cricket::MediaSessionOptions* session_options) { |
| 536 if (send_stream_1_ && send_audio_) { |
| 537 session_options->AddSendStream(cricket::MEDIA_TYPE_AUDIO, kAudioTrack1, |
| 538 kStream1); |
| 539 } |
| 540 if (send_stream_1_ && send_video_) { |
| 541 session_options->AddSendStream(cricket::MEDIA_TYPE_VIDEO, kVideoTrack1, |
| 542 kStream1); |
| 543 } |
| 544 if (send_stream_2_ && send_audio_) { |
| 545 session_options->AddSendStream(cricket::MEDIA_TYPE_AUDIO, kAudioTrack2, |
| 546 kStream2); |
| 547 } |
| 548 if (send_stream_2_ && send_video_) { |
| 549 session_options->AddSendStream(cricket::MEDIA_TYPE_VIDEO, kVideoTrack2, |
| 550 kStream2); |
| 551 } |
| 552 if (data_channel_ && session_->data_channel_type() == cricket::DCT_RTP) { |
| 553 session_options->AddSendStream(cricket::MEDIA_TYPE_DATA, |
| 554 data_channel_->label(), |
| 555 data_channel_->label()); |
| 556 } |
| 557 } |
| 558 |
| 559 void GetOptionsForOffer( |
| 560 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 561 cricket::MediaSessionOptions* session_options) { |
| 562 AddStreamsToOptions(session_options); |
| 563 ASSERT_TRUE(ConvertRtcOptionsForOffer(rtc_options, session_options)); |
| 564 |
| 565 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { |
| 566 session_options->data_channel_type = cricket::DCT_SCTP; |
| 567 } |
| 568 } |
| 569 |
| 570 void GetOptionsForAnswer(const webrtc::MediaConstraintsInterface* constraints, |
| 571 cricket::MediaSessionOptions* session_options) { |
| 572 AddStreamsToOptions(session_options); |
| 573 session_options->recv_audio = false; |
| 574 session_options->recv_video = false; |
| 575 ASSERT_TRUE(ParseConstraintsForAnswer(constraints, session_options)); |
| 576 |
| 577 if (session_->data_channel_type() == cricket::DCT_SCTP) { |
| 578 session_options->data_channel_type = cricket::DCT_SCTP; |
| 579 } |
| 580 } |
| 581 |
| 582 // Creates a local offer and applies it. Starts ICE. |
| 583 // Call SendAudioVideoStreamX() before this function |
479 // to decide which streams to create. | 584 // to decide which streams to create. |
480 void InitiateCall() { | 585 void InitiateCall() { |
481 SessionDescriptionInterface* offer = CreateOffer(); | 586 SessionDescriptionInterface* offer = CreateOffer(); |
482 SetLocalDescriptionWithoutError(offer); | 587 SetLocalDescriptionWithoutError(offer); |
483 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != | 588 EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew != |
484 observer_.ice_gathering_state_, | 589 observer_.ice_gathering_state_, |
485 kIceCandidatesTimeout); | 590 kIceCandidatesTimeout); |
486 } | 591 } |
487 | 592 |
488 SessionDescriptionInterface* CreateOffer() { | 593 SessionDescriptionInterface* CreateOffer() { |
489 PeerConnectionInterface::RTCOfferAnswerOptions options; | 594 PeerConnectionInterface::RTCOfferAnswerOptions options; |
490 options.offer_to_receive_audio = | 595 options.offer_to_receive_audio = |
491 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; | 596 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; |
492 | 597 |
493 return CreateOffer(options); | 598 return CreateOffer(options); |
494 } | 599 } |
495 | 600 |
496 SessionDescriptionInterface* CreateOffer( | 601 SessionDescriptionInterface* CreateOffer( |
497 const PeerConnectionInterface::RTCOfferAnswerOptions& options) { | 602 const PeerConnectionInterface::RTCOfferAnswerOptions& options) { |
498 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> | 603 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> |
499 observer = new WebRtcSessionCreateSDPObserverForTest(); | 604 observer = new WebRtcSessionCreateSDPObserverForTest(); |
500 session_->CreateOffer(observer, options); | 605 cricket::MediaSessionOptions session_options; |
| 606 GetOptionsForOffer(options, &session_options); |
| 607 session_->CreateOffer(observer, options, session_options); |
501 EXPECT_TRUE_WAIT( | 608 EXPECT_TRUE_WAIT( |
502 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit, | 609 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit, |
503 2000); | 610 2000); |
504 return observer->ReleaseDescription(); | 611 return observer->ReleaseDescription(); |
505 } | 612 } |
506 | 613 |
507 SessionDescriptionInterface* CreateAnswer( | 614 SessionDescriptionInterface* CreateAnswer( |
508 const webrtc::MediaConstraintsInterface* constraints) { | 615 const webrtc::MediaConstraintsInterface* constraints) { |
509 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observer | 616 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observer |
510 = new WebRtcSessionCreateSDPObserverForTest(); | 617 = new WebRtcSessionCreateSDPObserverForTest(); |
511 session_->CreateAnswer(observer, constraints); | 618 cricket::MediaSessionOptions session_options; |
| 619 GetOptionsForAnswer(constraints, &session_options); |
| 620 session_->CreateAnswer(observer, constraints, session_options); |
512 EXPECT_TRUE_WAIT( | 621 EXPECT_TRUE_WAIT( |
513 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit, | 622 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit, |
514 2000); | 623 2000); |
515 return observer->ReleaseDescription(); | 624 return observer->ReleaseDescription(); |
516 } | 625 } |
517 | 626 |
518 bool ChannelsExist() const { | 627 bool ChannelsExist() const { |
519 return (session_->voice_channel() != NULL && | 628 return (session_->voice_channel() != NULL && |
520 session_->video_channel() != NULL); | 629 session_->video_channel() != NULL); |
521 } | 630 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 } | 740 } |
632 | 741 |
633 void SetAndVerifyNumUnsignalledRecvStreams( | 742 void SetAndVerifyNumUnsignalledRecvStreams( |
634 int value_set, int value_expected) { | 743 int value_set, int value_expected) { |
635 constraints_.reset(new FakeConstraints()); | 744 constraints_.reset(new FakeConstraints()); |
636 constraints_->AddOptional( | 745 constraints_->AddOptional( |
637 webrtc::MediaConstraintsInterface::kNumUnsignalledRecvStreams, | 746 webrtc::MediaConstraintsInterface::kNumUnsignalledRecvStreams, |
638 value_set); | 747 value_set); |
639 session_.reset(); | 748 session_.reset(); |
640 Init(); | 749 Init(); |
641 mediastream_signaling_.SendAudioVideoStream1(); | 750 SendAudioVideoStream1(); |
642 SessionDescriptionInterface* offer = CreateOffer(); | 751 SessionDescriptionInterface* offer = CreateOffer(); |
643 | 752 |
644 SetLocalDescriptionWithoutError(offer); | 753 SetLocalDescriptionWithoutError(offer); |
645 | 754 |
646 video_channel_ = media_engine_->GetVideoChannel(0); | 755 video_channel_ = media_engine_->GetVideoChannel(0); |
647 | 756 |
648 ASSERT_TRUE(video_channel_ != NULL); | 757 ASSERT_TRUE(video_channel_ != NULL); |
649 const cricket::VideoOptions& video_options = video_channel_->options(); | 758 const cricket::VideoOptions& video_options = video_channel_->options(); |
650 EXPECT_EQ(value_expected, | 759 EXPECT_EQ(value_expected, |
651 video_options.unsignalled_recv_stream_limit.GetWithDefaultIfUnset(-1)); | 760 video_options.unsignalled_recv_stream_limit.GetWithDefaultIfUnset(-1)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 mod_ufrag.c_str(), mod_ufrag.length(), | 837 mod_ufrag.c_str(), mod_ufrag.length(), |
729 sdp); | 838 sdp); |
730 rtc::replace_substrs(pwd_line.c_str(), pwd_line.length(), | 839 rtc::replace_substrs(pwd_line.c_str(), pwd_line.length(), |
731 mod_pwd.c_str(), mod_pwd.length(), | 840 mod_pwd.c_str(), mod_pwd.length(), |
732 sdp); | 841 sdp); |
733 } | 842 } |
734 } | 843 } |
735 | 844 |
736 // Creates a remote offer and and applies it as a remote description, | 845 // Creates a remote offer and and applies it as a remote description, |
737 // creates a local answer and applies is as a local description. | 846 // creates a local answer and applies is as a local description. |
738 // Call mediastream_signaling_.UseOptionsWithStreamX() before this function | 847 // Call SendAudioVideoStreamX() before this function |
739 // to decide which local and remote streams to create. | 848 // to decide which local and remote streams to create. |
740 void CreateAndSetRemoteOfferAndLocalAnswer() { | 849 void CreateAndSetRemoteOfferAndLocalAnswer() { |
741 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 850 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
742 SetRemoteDescriptionWithoutError(offer); | 851 SetRemoteDescriptionWithoutError(offer); |
743 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 852 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
744 SetLocalDescriptionWithoutError(answer); | 853 SetLocalDescriptionWithoutError(answer); |
745 } | 854 } |
746 void SetLocalDescriptionWithoutError(SessionDescriptionInterface* desc) { | 855 void SetLocalDescriptionWithoutError(SessionDescriptionInterface* desc) { |
747 EXPECT_TRUE(session_->SetLocalDescription(desc, NULL)); | 856 EXPECT_TRUE(session_->SetLocalDescription(desc, NULL)); |
748 session_->MaybeStartGathering(); | 857 session_->MaybeStartGathering(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 rtc::replace_substrs(default_port_str, strlen(default_port_str), | 1013 rtc::replace_substrs(default_port_str, strlen(default_port_str), |
905 new_port_str, strlen(new_port_str), | 1014 new_port_str, strlen(new_port_str), |
906 &offer_str); | 1015 &offer_str); |
907 JsepSessionDescription* offer = new JsepSessionDescription( | 1016 JsepSessionDescription* offer = new JsepSessionDescription( |
908 offer_basis->type()); | 1017 offer_basis->type()); |
909 delete offer_basis; | 1018 delete offer_basis; |
910 offer->Initialize(offer_str, NULL); | 1019 offer->Initialize(offer_str, NULL); |
911 return offer; | 1020 return offer; |
912 } | 1021 } |
913 | 1022 |
914 // Create a remote offer. Call mediastream_signaling_.UseOptionsWithStreamX() | 1023 // Create a remote offer. Call SendAudioVideoStreamX() |
915 // before this function to decide which streams to create. | 1024 // before this function to decide which streams to create. |
916 JsepSessionDescription* CreateRemoteOffer() { | 1025 JsepSessionDescription* CreateRemoteOffer() { |
917 cricket::MediaSessionOptions options; | 1026 cricket::MediaSessionOptions options; |
918 mediastream_signaling_.GetOptionsForAnswer(NULL, &options); | 1027 GetOptionsForAnswer(NULL, &options); |
919 return CreateRemoteOffer(options, session_->remote_description()); | 1028 return CreateRemoteOffer(options, session_->remote_description()); |
920 } | 1029 } |
921 | 1030 |
922 JsepSessionDescription* CreateRemoteAnswer( | 1031 JsepSessionDescription* CreateRemoteAnswer( |
923 const SessionDescriptionInterface* offer, | 1032 const SessionDescriptionInterface* offer, |
924 cricket::MediaSessionOptions options, | 1033 cricket::MediaSessionOptions options, |
925 cricket::SecurePolicy policy) { | 1034 cricket::SecurePolicy policy) { |
926 desc_factory_->set_secure(policy); | 1035 desc_factory_->set_secure(policy); |
927 const std::string session_id = | 1036 const std::string session_id = |
928 rtc::ToString(rtc::CreateRandomId64()); | 1037 rtc::ToString(rtc::CreateRandomId64()); |
929 JsepSessionDescription* answer( | 1038 JsepSessionDescription* answer( |
930 new JsepSessionDescription(JsepSessionDescription::kAnswer)); | 1039 new JsepSessionDescription(JsepSessionDescription::kAnswer)); |
931 if (!answer->Initialize(desc_factory_->CreateAnswer(offer->description(), | 1040 if (!answer->Initialize(desc_factory_->CreateAnswer(offer->description(), |
932 options, NULL), | 1041 options, NULL), |
933 session_id, kSessionVersion)) { | 1042 session_id, kSessionVersion)) { |
934 delete answer; | 1043 delete answer; |
935 answer = NULL; | 1044 answer = NULL; |
936 } | 1045 } |
937 return answer; | 1046 return answer; |
938 } | 1047 } |
939 | 1048 |
940 JsepSessionDescription* CreateRemoteAnswer( | 1049 JsepSessionDescription* CreateRemoteAnswer( |
941 const SessionDescriptionInterface* offer, | 1050 const SessionDescriptionInterface* offer, |
942 cricket::MediaSessionOptions options) { | 1051 cricket::MediaSessionOptions options) { |
943 return CreateRemoteAnswer(offer, options, cricket::SEC_REQUIRED); | 1052 return CreateRemoteAnswer(offer, options, cricket::SEC_REQUIRED); |
944 } | 1053 } |
945 | 1054 |
946 // Creates an answer session description with streams based on | 1055 // Creates an answer session description. |
947 // |mediastream_signaling_|. Call | 1056 // Call SendAudioVideoStreamX() before this function |
948 // mediastream_signaling_.UseOptionsWithStreamX() before this function | |
949 // to decide which streams to create. | 1057 // to decide which streams to create. |
950 JsepSessionDescription* CreateRemoteAnswer( | 1058 JsepSessionDescription* CreateRemoteAnswer( |
951 const SessionDescriptionInterface* offer) { | 1059 const SessionDescriptionInterface* offer) { |
952 cricket::MediaSessionOptions options; | 1060 cricket::MediaSessionOptions options; |
953 mediastream_signaling_.GetOptionsForAnswer(NULL, &options); | 1061 GetOptionsForAnswer(NULL, &options); |
954 return CreateRemoteAnswer(offer, options, cricket::SEC_REQUIRED); | 1062 return CreateRemoteAnswer(offer, options, cricket::SEC_REQUIRED); |
955 } | 1063 } |
956 | 1064 |
957 void TestSessionCandidatesWithBundleRtcpMux(bool bundle, bool rtcp_mux) { | 1065 void TestSessionCandidatesWithBundleRtcpMux(bool bundle, bool rtcp_mux) { |
958 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1066 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
959 Init(); | 1067 Init(); |
960 mediastream_signaling_.SendAudioVideoStream1(); | 1068 SendAudioVideoStream1(); |
961 | 1069 |
962 PeerConnectionInterface::RTCOfferAnswerOptions options; | 1070 PeerConnectionInterface::RTCOfferAnswerOptions options; |
963 options.use_rtp_mux = bundle; | 1071 options.use_rtp_mux = bundle; |
964 | 1072 |
965 SessionDescriptionInterface* offer = CreateOffer(options); | 1073 SessionDescriptionInterface* offer = CreateOffer(options); |
966 // SetLocalDescription and SetRemoteDescriptions takes ownership of offer | 1074 // SetLocalDescription and SetRemoteDescriptions takes ownership of offer |
967 // and answer. | 1075 // and answer. |
968 SetLocalDescriptionWithoutError(offer); | 1076 SetLocalDescriptionWithoutError(offer); |
969 | 1077 |
970 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 1078 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
(...skipping 27 matching lines...) Expand all Loading... |
998 EXPECT_EQ(expected_candidate_num, observer_.mline_1_candidates_.size()); | 1106 EXPECT_EQ(expected_candidate_num, observer_.mline_1_candidates_.size()); |
999 } | 1107 } |
1000 } | 1108 } |
1001 // Tests that we can only send DTMF when the dtmf codec is supported. | 1109 // Tests that we can only send DTMF when the dtmf codec is supported. |
1002 void TestCanInsertDtmf(bool can) { | 1110 void TestCanInsertDtmf(bool can) { |
1003 if (can) { | 1111 if (can) { |
1004 InitWithDtmfCodec(); | 1112 InitWithDtmfCodec(); |
1005 } else { | 1113 } else { |
1006 Init(); | 1114 Init(); |
1007 } | 1115 } |
1008 mediastream_signaling_.SendAudioVideoStream1(); | 1116 SendAudioVideoStream1(); |
1009 CreateAndSetRemoteOfferAndLocalAnswer(); | 1117 CreateAndSetRemoteOfferAndLocalAnswer(); |
1010 EXPECT_FALSE(session_->CanInsertDtmf("")); | 1118 EXPECT_FALSE(session_->CanInsertDtmf("")); |
1011 EXPECT_EQ(can, session_->CanInsertDtmf(kAudioTrack1)); | 1119 EXPECT_EQ(can, session_->CanInsertDtmf(kAudioTrack1)); |
1012 } | 1120 } |
1013 | 1121 |
1014 // Helper class to configure loopback network and verify Best | 1122 // Helper class to configure loopback network and verify Best |
1015 // Connection using right IP protocol for TestLoopbackCall | 1123 // Connection using right IP protocol for TestLoopbackCall |
1016 // method. LoopbackNetworkManager applies firewall rules to block | 1124 // method. LoopbackNetworkManager applies firewall rules to block |
1017 // all ping traffic once ICE completed, and remove them to observe | 1125 // all ping traffic once ICE completed, and remove them to observe |
1018 // ICE reconnected again. This LoopbackNetworkConfiguration struct | 1126 // ICE reconnected again. This LoopbackNetworkConfiguration struct |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 // the correct sequence of ICE states when a connection is established, | 1222 // the correct sequence of ICE states when a connection is established, |
1115 // broken, and re-established. | 1223 // broken, and re-established. |
1116 // The Connection state should go: | 1224 // The Connection state should go: |
1117 // New -> Checking -> (Connected) -> Completed -> Disconnected -> Completed | 1225 // New -> Checking -> (Connected) -> Completed -> Disconnected -> Completed |
1118 // -> Failed. | 1226 // -> Failed. |
1119 // The Gathering state should go: New -> Gathering -> Completed. | 1227 // The Gathering state should go: New -> Gathering -> Completed. |
1120 | 1228 |
1121 void TestLoopbackCall(const LoopbackNetworkConfiguration& config) { | 1229 void TestLoopbackCall(const LoopbackNetworkConfiguration& config) { |
1122 LoopbackNetworkManager loopback_network_manager(this, config); | 1230 LoopbackNetworkManager loopback_network_manager(this, config); |
1123 Init(); | 1231 Init(); |
1124 mediastream_signaling_.SendAudioVideoStream1(); | 1232 SendAudioVideoStream1(); |
1125 SessionDescriptionInterface* offer = CreateOffer(); | 1233 SessionDescriptionInterface* offer = CreateOffer(); |
1126 | 1234 |
1127 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, | 1235 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, |
1128 observer_.ice_gathering_state_); | 1236 observer_.ice_gathering_state_); |
1129 SetLocalDescriptionWithoutError(offer); | 1237 SetLocalDescriptionWithoutError(offer); |
1130 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, | 1238 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, |
1131 observer_.ice_connection_state_); | 1239 observer_.ice_connection_state_); |
1132 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceGatheringGathering, | 1240 EXPECT_EQ_WAIT(PeerConnectionInterface::kIceGatheringGathering, |
1133 observer_.ice_gathering_state_, | 1241 observer_.ice_gathering_state_, |
1134 kIceCandidatesTimeout); | 1242 kIceCandidatesTimeout); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 const cricket::AudioContentDescription* audio_content_desc = | 1319 const cricket::AudioContentDescription* audio_content_desc = |
1212 static_cast<const cricket::AudioContentDescription*>(description); | 1320 static_cast<const cricket::AudioContentDescription*>(description); |
1213 ASSERT(audio_content_desc != NULL); | 1321 ASSERT(audio_content_desc != NULL); |
1214 for (size_t i = 0; i < audio_content_desc->codecs().size(); ++i) { | 1322 for (size_t i = 0; i < audio_content_desc->codecs().size(); ++i) { |
1215 if (audio_content_desc->codecs()[i].name == "CN") | 1323 if (audio_content_desc->codecs()[i].name == "CN") |
1216 return false; | 1324 return false; |
1217 } | 1325 } |
1218 return true; | 1326 return true; |
1219 } | 1327 } |
1220 | 1328 |
| 1329 void CreateDataChannel() { |
| 1330 webrtc::InternalDataChannelInit dci; |
| 1331 dci.reliable = session_->data_channel_type() == cricket::DCT_SCTP; |
| 1332 data_channel_ = DataChannel::Create( |
| 1333 session_.get(), session_->data_channel_type(), "datachannel", dci); |
| 1334 } |
| 1335 |
1221 void SetLocalDescriptionWithDataChannel() { | 1336 void SetLocalDescriptionWithDataChannel() { |
1222 webrtc::InternalDataChannelInit dci; | 1337 CreateDataChannel(); |
1223 dci.reliable = false; | |
1224 session_->CreateDataChannel("datachannel", &dci); | |
1225 SessionDescriptionInterface* offer = CreateOffer(); | 1338 SessionDescriptionInterface* offer = CreateOffer(); |
1226 SetLocalDescriptionWithoutError(offer); | 1339 SetLocalDescriptionWithoutError(offer); |
1227 } | 1340 } |
1228 | 1341 |
1229 void VerifyMultipleAsyncCreateDescription( | 1342 void VerifyMultipleAsyncCreateDescription( |
1230 RTCCertificateGenerationMethod cert_gen_method, | 1343 RTCCertificateGenerationMethod cert_gen_method, |
1231 CreateSessionDescriptionRequest::Type type) { | 1344 CreateSessionDescriptionRequest::Type type) { |
1232 InitWithDtls(cert_gen_method); | 1345 InitWithDtls(cert_gen_method); |
1233 VerifyMultipleAsyncCreateDescriptionAfterInit(true, type); | 1346 VerifyMultipleAsyncCreateDescriptionAfterInit(true, type); |
1234 } | 1347 } |
(...skipping 10 matching lines...) Expand all Loading... |
1245 SetFactoryDtlsSrtp(); | 1358 SetFactoryDtlsSrtp(); |
1246 if (type == CreateSessionDescriptionRequest::kAnswer) { | 1359 if (type == CreateSessionDescriptionRequest::kAnswer) { |
1247 cricket::MediaSessionOptions options; | 1360 cricket::MediaSessionOptions options; |
1248 scoped_ptr<JsepSessionDescription> offer( | 1361 scoped_ptr<JsepSessionDescription> offer( |
1249 CreateRemoteOffer(options, cricket::SEC_DISABLED)); | 1362 CreateRemoteOffer(options, cricket::SEC_DISABLED)); |
1250 ASSERT_TRUE(offer.get() != NULL); | 1363 ASSERT_TRUE(offer.get() != NULL); |
1251 SetRemoteDescriptionWithoutError(offer.release()); | 1364 SetRemoteDescriptionWithoutError(offer.release()); |
1252 } | 1365 } |
1253 | 1366 |
1254 PeerConnectionInterface::RTCOfferAnswerOptions options; | 1367 PeerConnectionInterface::RTCOfferAnswerOptions options; |
| 1368 cricket::MediaSessionOptions session_options; |
1255 const int kNumber = 3; | 1369 const int kNumber = 3; |
1256 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> | 1370 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> |
1257 observers[kNumber]; | 1371 observers[kNumber]; |
1258 for (int i = 0; i < kNumber; ++i) { | 1372 for (int i = 0; i < kNumber; ++i) { |
1259 observers[i] = new WebRtcSessionCreateSDPObserverForTest(); | 1373 observers[i] = new WebRtcSessionCreateSDPObserverForTest(); |
1260 if (type == CreateSessionDescriptionRequest::kOffer) { | 1374 if (type == CreateSessionDescriptionRequest::kOffer) { |
1261 session_->CreateOffer(observers[i], options); | 1375 session_->CreateOffer(observers[i], options, session_options); |
1262 } else { | 1376 } else { |
1263 session_->CreateAnswer(observers[i], NULL); | 1377 session_->CreateAnswer(observers[i], nullptr, session_options); |
1264 } | 1378 } |
1265 } | 1379 } |
1266 | 1380 |
1267 WebRtcSessionCreateSDPObserverForTest::State expected_state = | 1381 WebRtcSessionCreateSDPObserverForTest::State expected_state = |
1268 success ? WebRtcSessionCreateSDPObserverForTest::kSucceeded : | 1382 success ? WebRtcSessionCreateSDPObserverForTest::kSucceeded : |
1269 WebRtcSessionCreateSDPObserverForTest::kFailed; | 1383 WebRtcSessionCreateSDPObserverForTest::kFailed; |
1270 | 1384 |
1271 for (int i = 0; i < kNumber; ++i) { | 1385 for (int i = 0; i < kNumber; ++i) { |
1272 EXPECT_EQ_WAIT(expected_state, observers[i]->state(), 1000); | 1386 EXPECT_EQ_WAIT(expected_state, observers[i]->state(), 1000); |
1273 if (success) { | 1387 if (success) { |
(...skipping 24 matching lines...) Expand all Loading... |
1298 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; | 1412 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; |
1299 rtc::scoped_ptr<rtc::FirewallSocketServer> fss_; | 1413 rtc::scoped_ptr<rtc::FirewallSocketServer> fss_; |
1300 rtc::SocketServerScope ss_scope_; | 1414 rtc::SocketServerScope ss_scope_; |
1301 rtc::SocketAddress stun_socket_addr_; | 1415 rtc::SocketAddress stun_socket_addr_; |
1302 rtc::scoped_ptr<cricket::TestStunServer> stun_server_; | 1416 rtc::scoped_ptr<cricket::TestStunServer> stun_server_; |
1303 cricket::TestTurnServer turn_server_; | 1417 cricket::TestTurnServer turn_server_; |
1304 rtc::FakeNetworkManager network_manager_; | 1418 rtc::FakeNetworkManager network_manager_; |
1305 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; | 1419 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; |
1306 PeerConnectionFactoryInterface::Options options_; | 1420 PeerConnectionFactoryInterface::Options options_; |
1307 rtc::scoped_ptr<FakeConstraints> constraints_; | 1421 rtc::scoped_ptr<FakeConstraints> constraints_; |
1308 FakeMediaStreamSignaling mediastream_signaling_; | |
1309 rtc::scoped_ptr<WebRtcSessionForTest> session_; | 1422 rtc::scoped_ptr<WebRtcSessionForTest> session_; |
1310 MockIceObserver observer_; | 1423 MockIceObserver observer_; |
1311 cricket::FakeVideoMediaChannel* video_channel_; | 1424 cricket::FakeVideoMediaChannel* video_channel_; |
1312 cricket::FakeVoiceMediaChannel* voice_channel_; | 1425 cricket::FakeVoiceMediaChannel* voice_channel_; |
1313 rtc::scoped_refptr<FakeMetricsObserver> metrics_observer_; | 1426 rtc::scoped_refptr<FakeMetricsObserver> metrics_observer_; |
| 1427 // The following flags affect options created for CreateOffer/CreateAnswer. |
| 1428 bool send_stream_1_ = false; |
| 1429 bool send_stream_2_ = false; |
| 1430 bool send_audio_ = false; |
| 1431 bool send_video_ = false; |
| 1432 rtc::scoped_refptr<DataChannel> data_channel_; |
| 1433 // Last values received from data channel creation signal. |
| 1434 std::string last_data_channel_label_; |
| 1435 InternalDataChannelInit last_data_channel_config_; |
1314 }; | 1436 }; |
1315 | 1437 |
1316 TEST_P(WebRtcSessionTest, TestInitializeWithDtls) { | 1438 TEST_P(WebRtcSessionTest, TestInitializeWithDtls) { |
1317 InitWithDtls(GetParam()); | 1439 InitWithDtls(GetParam()); |
1318 // SDES is disabled when DTLS is on. | 1440 // SDES is disabled when DTLS is on. |
1319 EXPECT_EQ(cricket::SEC_DISABLED, session_->SdesPolicy()); | 1441 EXPECT_EQ(cricket::SEC_DISABLED, session_->SdesPolicy()); |
1320 } | 1442 } |
1321 | 1443 |
1322 TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) { | 1444 TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) { |
1323 Init(); | 1445 Init(); |
(...skipping 12 matching lines...) Expand all Loading... |
1336 } | 1458 } |
1337 | 1459 |
1338 TEST_F(WebRtcSessionTest, TestSessionCandidatesWithBundleRtcpMux) { | 1460 TEST_F(WebRtcSessionTest, TestSessionCandidatesWithBundleRtcpMux) { |
1339 TestSessionCandidatesWithBundleRtcpMux(true, true); | 1461 TestSessionCandidatesWithBundleRtcpMux(true, true); |
1340 } | 1462 } |
1341 | 1463 |
1342 TEST_F(WebRtcSessionTest, TestMultihomeCandidates) { | 1464 TEST_F(WebRtcSessionTest, TestMultihomeCandidates) { |
1343 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1465 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1344 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); | 1466 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); |
1345 Init(); | 1467 Init(); |
1346 mediastream_signaling_.SendAudioVideoStream1(); | 1468 SendAudioVideoStream1(); |
1347 InitiateCall(); | 1469 InitiateCall(); |
1348 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 1470 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
1349 EXPECT_EQ(8u, observer_.mline_0_candidates_.size()); | 1471 EXPECT_EQ(8u, observer_.mline_0_candidates_.size()); |
1350 EXPECT_EQ(8u, observer_.mline_1_candidates_.size()); | 1472 EXPECT_EQ(8u, observer_.mline_1_candidates_.size()); |
1351 } | 1473 } |
1352 | 1474 |
1353 TEST_F(WebRtcSessionTest, TestStunError) { | 1475 TEST_F(WebRtcSessionTest, TestStunError) { |
1354 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1476 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1355 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); | 1477 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); |
1356 fss_->AddRule(false, | 1478 fss_->AddRule(false, |
1357 rtc::FP_UDP, | 1479 rtc::FP_UDP, |
1358 rtc::FD_ANY, | 1480 rtc::FD_ANY, |
1359 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1481 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1360 Init(); | 1482 Init(); |
1361 mediastream_signaling_.SendAudioVideoStream1(); | 1483 SendAudioVideoStream1(); |
1362 InitiateCall(); | 1484 InitiateCall(); |
1363 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it. | 1485 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it. |
1364 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 1486 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
1365 EXPECT_EQ(6u, observer_.mline_0_candidates_.size()); | 1487 EXPECT_EQ(6u, observer_.mline_0_candidates_.size()); |
1366 EXPECT_EQ(6u, observer_.mline_1_candidates_.size()); | 1488 EXPECT_EQ(6u, observer_.mline_1_candidates_.size()); |
1367 } | 1489 } |
1368 | 1490 |
1369 // Test session delivers no candidates gathered when constraint set to "none". | 1491 // Test session delivers no candidates gathered when constraint set to "none". |
1370 TEST_F(WebRtcSessionTest, TestIceTransportsNone) { | 1492 TEST_F(WebRtcSessionTest, TestIceTransportsNone) { |
1371 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1493 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1372 InitWithIceTransport(PeerConnectionInterface::kNone); | 1494 InitWithIceTransport(PeerConnectionInterface::kNone); |
1373 mediastream_signaling_.SendAudioVideoStream1(); | 1495 SendAudioVideoStream1(); |
1374 InitiateCall(); | 1496 InitiateCall(); |
1375 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 1497 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
1376 EXPECT_EQ(0u, observer_.mline_0_candidates_.size()); | 1498 EXPECT_EQ(0u, observer_.mline_0_candidates_.size()); |
1377 EXPECT_EQ(0u, observer_.mline_1_candidates_.size()); | 1499 EXPECT_EQ(0u, observer_.mline_1_candidates_.size()); |
1378 } | 1500 } |
1379 | 1501 |
1380 // Test session delivers only relay candidates gathered when constaint set to | 1502 // Test session delivers only relay candidates gathered when constaint set to |
1381 // "relay". | 1503 // "relay". |
1382 TEST_F(WebRtcSessionTest, TestIceTransportsRelay) { | 1504 TEST_F(WebRtcSessionTest, TestIceTransportsRelay) { |
1383 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1505 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1384 ConfigureAllocatorWithTurn(); | 1506 ConfigureAllocatorWithTurn(); |
1385 InitWithIceTransport(PeerConnectionInterface::kRelay); | 1507 InitWithIceTransport(PeerConnectionInterface::kRelay); |
1386 mediastream_signaling_.SendAudioVideoStream1(); | 1508 SendAudioVideoStream1(); |
1387 InitiateCall(); | 1509 InitiateCall(); |
1388 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 1510 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
1389 EXPECT_EQ(2u, observer_.mline_0_candidates_.size()); | 1511 EXPECT_EQ(2u, observer_.mline_0_candidates_.size()); |
1390 EXPECT_EQ(2u, observer_.mline_1_candidates_.size()); | 1512 EXPECT_EQ(2u, observer_.mline_1_candidates_.size()); |
1391 for (size_t i = 0; i < observer_.mline_0_candidates_.size(); ++i) { | 1513 for (size_t i = 0; i < observer_.mline_0_candidates_.size(); ++i) { |
1392 EXPECT_EQ(cricket::RELAY_PORT_TYPE, | 1514 EXPECT_EQ(cricket::RELAY_PORT_TYPE, |
1393 observer_.mline_0_candidates_[i].type()); | 1515 observer_.mline_0_candidates_[i].type()); |
1394 } | 1516 } |
1395 for (size_t i = 0; i < observer_.mline_1_candidates_.size(); ++i) { | 1517 for (size_t i = 0; i < observer_.mline_1_candidates_.size(); ++i) { |
1396 EXPECT_EQ(cricket::RELAY_PORT_TYPE, | 1518 EXPECT_EQ(cricket::RELAY_PORT_TYPE, |
1397 observer_.mline_1_candidates_[i].type()); | 1519 observer_.mline_1_candidates_[i].type()); |
1398 } | 1520 } |
1399 } | 1521 } |
1400 | 1522 |
1401 // Test session delivers all candidates gathered when constaint set to "all". | 1523 // Test session delivers all candidates gathered when constaint set to "all". |
1402 TEST_F(WebRtcSessionTest, TestIceTransportsAll) { | 1524 TEST_F(WebRtcSessionTest, TestIceTransportsAll) { |
1403 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1525 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1404 InitWithIceTransport(PeerConnectionInterface::kAll); | 1526 InitWithIceTransport(PeerConnectionInterface::kAll); |
1405 mediastream_signaling_.SendAudioVideoStream1(); | 1527 SendAudioVideoStream1(); |
1406 InitiateCall(); | 1528 InitiateCall(); |
1407 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 1529 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
1408 // Host + STUN. By default allocator is disabled to gather relay candidates. | 1530 // Host + STUN. By default allocator is disabled to gather relay candidates. |
1409 EXPECT_EQ(4u, observer_.mline_0_candidates_.size()); | 1531 EXPECT_EQ(4u, observer_.mline_0_candidates_.size()); |
1410 EXPECT_EQ(4u, observer_.mline_1_candidates_.size()); | 1532 EXPECT_EQ(4u, observer_.mline_1_candidates_.size()); |
1411 } | 1533 } |
1412 | 1534 |
1413 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) { | 1535 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) { |
1414 Init(); | 1536 Init(); |
1415 SessionDescriptionInterface* offer = NULL; | 1537 SessionDescriptionInterface* offer = NULL; |
1416 // Since |offer| is NULL, there's no way to tell if it's an offer or answer. | 1538 // Since |offer| is NULL, there's no way to tell if it's an offer or answer. |
1417 std::string unknown_action; | 1539 std::string unknown_action; |
1418 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer); | 1540 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer); |
1419 SetRemoteDescriptionExpectError(unknown_action, kInvalidSdp, offer); | 1541 SetRemoteDescriptionExpectError(unknown_action, kInvalidSdp, offer); |
1420 } | 1542 } |
1421 | 1543 |
1422 // Test creating offers and receive answers and make sure the | 1544 // Test creating offers and receive answers and make sure the |
1423 // media engine creates the expected send and receive streams. | 1545 // media engine creates the expected send and receive streams. |
1424 TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) { | 1546 TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) { |
1425 Init(); | 1547 Init(); |
1426 mediastream_signaling_.SendAudioVideoStream1(); | 1548 SendAudioVideoStream1(); |
1427 SessionDescriptionInterface* offer = CreateOffer(); | 1549 SessionDescriptionInterface* offer = CreateOffer(); |
1428 const std::string session_id_orig = offer->session_id(); | 1550 const std::string session_id_orig = offer->session_id(); |
1429 const std::string session_version_orig = offer->session_version(); | 1551 const std::string session_version_orig = offer->session_version(); |
1430 SetLocalDescriptionWithoutError(offer); | 1552 SetLocalDescriptionWithoutError(offer); |
1431 | 1553 |
1432 mediastream_signaling_.SendAudioVideoStream2(); | 1554 SendAudioVideoStream2(); |
1433 SessionDescriptionInterface* answer = | 1555 SessionDescriptionInterface* answer = |
1434 CreateRemoteAnswer(session_->local_description()); | 1556 CreateRemoteAnswer(session_->local_description()); |
1435 SetRemoteDescriptionWithoutError(answer); | 1557 SetRemoteDescriptionWithoutError(answer); |
1436 | 1558 |
1437 video_channel_ = media_engine_->GetVideoChannel(0); | 1559 video_channel_ = media_engine_->GetVideoChannel(0); |
1438 voice_channel_ = media_engine_->GetVoiceChannel(0); | 1560 voice_channel_ = media_engine_->GetVoiceChannel(0); |
1439 | 1561 |
1440 ASSERT_EQ(1u, video_channel_->recv_streams().size()); | 1562 ASSERT_EQ(1u, video_channel_->recv_streams().size()); |
1441 EXPECT_TRUE(kVideoTrack2 == video_channel_->recv_streams()[0].id); | 1563 EXPECT_TRUE(kVideoTrack2 == video_channel_->recv_streams()[0].id); |
1442 | 1564 |
1443 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); | 1565 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); |
1444 EXPECT_TRUE(kAudioTrack2 == voice_channel_->recv_streams()[0].id); | 1566 EXPECT_TRUE(kAudioTrack2 == voice_channel_->recv_streams()[0].id); |
1445 | 1567 |
1446 ASSERT_EQ(1u, video_channel_->send_streams().size()); | 1568 ASSERT_EQ(1u, video_channel_->send_streams().size()); |
1447 EXPECT_TRUE(kVideoTrack1 == video_channel_->send_streams()[0].id); | 1569 EXPECT_TRUE(kVideoTrack1 == video_channel_->send_streams()[0].id); |
1448 ASSERT_EQ(1u, voice_channel_->send_streams().size()); | 1570 ASSERT_EQ(1u, voice_channel_->send_streams().size()); |
1449 EXPECT_TRUE(kAudioTrack1 == voice_channel_->send_streams()[0].id); | 1571 EXPECT_TRUE(kAudioTrack1 == voice_channel_->send_streams()[0].id); |
1450 | 1572 |
1451 // Create new offer without send streams. | 1573 // Create new offer without send streams. |
1452 mediastream_signaling_.SendNothing(); | 1574 SendNothing(); |
1453 offer = CreateOffer(); | 1575 offer = CreateOffer(); |
1454 | 1576 |
1455 // Verify the session id is the same and the session version is | 1577 // Verify the session id is the same and the session version is |
1456 // increased. | 1578 // increased. |
1457 EXPECT_EQ(session_id_orig, offer->session_id()); | 1579 EXPECT_EQ(session_id_orig, offer->session_id()); |
1458 EXPECT_LT(rtc::FromString<uint64_t>(session_version_orig), | 1580 EXPECT_LT(rtc::FromString<uint64_t>(session_version_orig), |
1459 rtc::FromString<uint64_t>(offer->session_version())); | 1581 rtc::FromString<uint64_t>(offer->session_version())); |
1460 | 1582 |
1461 SetLocalDescriptionWithoutError(offer); | 1583 SetLocalDescriptionWithoutError(offer); |
1462 EXPECT_EQ(0u, video_channel_->send_streams().size()); | 1584 EXPECT_EQ(0u, video_channel_->send_streams().size()); |
1463 EXPECT_EQ(0u, voice_channel_->send_streams().size()); | 1585 EXPECT_EQ(0u, voice_channel_->send_streams().size()); |
1464 | 1586 |
1465 mediastream_signaling_.SendAudioVideoStream2(); | 1587 SendAudioVideoStream2(); |
1466 answer = CreateRemoteAnswer(session_->local_description()); | 1588 answer = CreateRemoteAnswer(session_->local_description()); |
1467 SetRemoteDescriptionWithoutError(answer); | 1589 SetRemoteDescriptionWithoutError(answer); |
1468 | 1590 |
1469 // Make sure the receive streams have not changed. | 1591 // Make sure the receive streams have not changed. |
1470 ASSERT_EQ(1u, video_channel_->recv_streams().size()); | 1592 ASSERT_EQ(1u, video_channel_->recv_streams().size()); |
1471 EXPECT_TRUE(kVideoTrack2 == video_channel_->recv_streams()[0].id); | 1593 EXPECT_TRUE(kVideoTrack2 == video_channel_->recv_streams()[0].id); |
1472 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); | 1594 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); |
1473 EXPECT_TRUE(kAudioTrack2 == voice_channel_->recv_streams()[0].id); | 1595 EXPECT_TRUE(kAudioTrack2 == voice_channel_->recv_streams()[0].id); |
1474 } | 1596 } |
1475 | 1597 |
1476 // Test receiving offers and creating answers and make sure the | 1598 // Test receiving offers and creating answers and make sure the |
1477 // media engine creates the expected send and receive streams. | 1599 // media engine creates the expected send and receive streams. |
1478 TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) { | 1600 TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) { |
1479 Init(); | 1601 Init(); |
1480 mediastream_signaling_.SendAudioVideoStream2(); | 1602 SendAudioVideoStream2(); |
1481 SessionDescriptionInterface* offer = CreateOffer(); | 1603 SessionDescriptionInterface* offer = CreateOffer(); |
1482 VerifyCryptoParams(offer->description()); | 1604 VerifyCryptoParams(offer->description()); |
1483 SetRemoteDescriptionWithoutError(offer); | 1605 SetRemoteDescriptionWithoutError(offer); |
1484 | 1606 |
1485 mediastream_signaling_.SendAudioVideoStream1(); | 1607 SendAudioVideoStream1(); |
1486 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 1608 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
1487 VerifyCryptoParams(answer->description()); | 1609 VerifyCryptoParams(answer->description()); |
1488 SetLocalDescriptionWithoutError(answer); | 1610 SetLocalDescriptionWithoutError(answer); |
1489 | 1611 |
1490 const std::string session_id_orig = answer->session_id(); | 1612 const std::string session_id_orig = answer->session_id(); |
1491 const std::string session_version_orig = answer->session_version(); | 1613 const std::string session_version_orig = answer->session_version(); |
1492 | 1614 |
1493 video_channel_ = media_engine_->GetVideoChannel(0); | 1615 video_channel_ = media_engine_->GetVideoChannel(0); |
1494 voice_channel_ = media_engine_->GetVoiceChannel(0); | 1616 voice_channel_ = media_engine_->GetVoiceChannel(0); |
1495 | 1617 |
1496 ASSERT_EQ(1u, video_channel_->recv_streams().size()); | 1618 ASSERT_EQ(1u, video_channel_->recv_streams().size()); |
1497 EXPECT_TRUE(kVideoTrack2 == video_channel_->recv_streams()[0].id); | 1619 EXPECT_TRUE(kVideoTrack2 == video_channel_->recv_streams()[0].id); |
1498 | 1620 |
1499 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); | 1621 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); |
1500 EXPECT_TRUE(kAudioTrack2 == voice_channel_->recv_streams()[0].id); | 1622 EXPECT_TRUE(kAudioTrack2 == voice_channel_->recv_streams()[0].id); |
1501 | 1623 |
1502 ASSERT_EQ(1u, video_channel_->send_streams().size()); | 1624 ASSERT_EQ(1u, video_channel_->send_streams().size()); |
1503 EXPECT_TRUE(kVideoTrack1 == video_channel_->send_streams()[0].id); | 1625 EXPECT_TRUE(kVideoTrack1 == video_channel_->send_streams()[0].id); |
1504 ASSERT_EQ(1u, voice_channel_->send_streams().size()); | 1626 ASSERT_EQ(1u, voice_channel_->send_streams().size()); |
1505 EXPECT_TRUE(kAudioTrack1 == voice_channel_->send_streams()[0].id); | 1627 EXPECT_TRUE(kAudioTrack1 == voice_channel_->send_streams()[0].id); |
1506 | 1628 |
1507 mediastream_signaling_.SendAudioVideoStream1And2(); | 1629 SendAudioVideoStream1And2(); |
1508 offer = CreateOffer(); | 1630 offer = CreateOffer(); |
1509 SetRemoteDescriptionWithoutError(offer); | 1631 SetRemoteDescriptionWithoutError(offer); |
1510 | 1632 |
1511 // Answer by turning off all send streams. | 1633 // Answer by turning off all send streams. |
1512 mediastream_signaling_.SendNothing(); | 1634 SendNothing(); |
1513 answer = CreateAnswer(NULL); | 1635 answer = CreateAnswer(NULL); |
1514 | 1636 |
1515 // Verify the session id is the same and the session version is | 1637 // Verify the session id is the same and the session version is |
1516 // increased. | 1638 // increased. |
1517 EXPECT_EQ(session_id_orig, answer->session_id()); | 1639 EXPECT_EQ(session_id_orig, answer->session_id()); |
1518 EXPECT_LT(rtc::FromString<uint64_t>(session_version_orig), | 1640 EXPECT_LT(rtc::FromString<uint64_t>(session_version_orig), |
1519 rtc::FromString<uint64_t>(answer->session_version())); | 1641 rtc::FromString<uint64_t>(answer->session_version())); |
1520 SetLocalDescriptionWithoutError(answer); | 1642 SetLocalDescriptionWithoutError(answer); |
1521 | 1643 |
1522 ASSERT_EQ(2u, video_channel_->recv_streams().size()); | 1644 ASSERT_EQ(2u, video_channel_->recv_streams().size()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1738 // SetRemoteDescription and SetLocalDescription will take the ownership of |
1617 // the offer. | 1739 // the offer. |
1618 SetLocalDescriptionWithoutError(offer); | 1740 SetLocalDescriptionWithoutError(offer); |
1619 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer); | 1741 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer); |
1620 } | 1742 } |
1621 | 1743 |
1622 // Test that we accept an offer with a DTLS fingerprint when DTLS is on | 1744 // Test that we accept an offer with a DTLS fingerprint when DTLS is on |
1623 // and that we return an answer with a DTLS fingerprint. | 1745 // and that we return an answer with a DTLS fingerprint. |
1624 TEST_P(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) { | 1746 TEST_P(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) { |
1625 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1747 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1626 mediastream_signaling_.SendAudioVideoStream1(); | 1748 SendAudioVideoStream1(); |
1627 InitWithDtls(GetParam()); | 1749 InitWithDtls(GetParam()); |
1628 SetFactoryDtlsSrtp(); | 1750 SetFactoryDtlsSrtp(); |
1629 cricket::MediaSessionOptions options; | 1751 cricket::MediaSessionOptions options; |
1630 options.recv_video = true; | 1752 options.recv_video = true; |
1631 JsepSessionDescription* offer = | 1753 JsepSessionDescription* offer = |
1632 CreateRemoteOffer(options, cricket::SEC_DISABLED); | 1754 CreateRemoteOffer(options, cricket::SEC_DISABLED); |
1633 ASSERT_TRUE(offer != NULL); | 1755 ASSERT_TRUE(offer != NULL); |
1634 VerifyFingerprintStatus(offer->description(), true); | 1756 VerifyFingerprintStatus(offer->description(), true); |
1635 VerifyNoCryptoParams(offer->description(), true); | 1757 VerifyNoCryptoParams(offer->description(), true); |
1636 | 1758 |
1637 // SetRemoteDescription will take the ownership of the offer. | 1759 // SetRemoteDescription will take the ownership of the offer. |
1638 SetRemoteDescriptionWithoutError(offer); | 1760 SetRemoteDescriptionWithoutError(offer); |
1639 | 1761 |
1640 // Verify that we get a crypto fingerprint in the answer. | 1762 // Verify that we get a crypto fingerprint in the answer. |
1641 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 1763 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
1642 ASSERT_TRUE(answer != NULL); | 1764 ASSERT_TRUE(answer != NULL); |
1643 VerifyFingerprintStatus(answer->description(), true); | 1765 VerifyFingerprintStatus(answer->description(), true); |
1644 // Check that we don't have an a=crypto line in the answer. | 1766 // Check that we don't have an a=crypto line in the answer. |
1645 VerifyNoCryptoParams(answer->description(), true); | 1767 VerifyNoCryptoParams(answer->description(), true); |
1646 | 1768 |
1647 // Now set the local description, which should work, even without a=crypto. | 1769 // Now set the local description, which should work, even without a=crypto. |
1648 SetLocalDescriptionWithoutError(answer); | 1770 SetLocalDescriptionWithoutError(answer); |
1649 } | 1771 } |
1650 | 1772 |
1651 // Test that we set a local offer with a DTLS fingerprint when DTLS is on | 1773 // Test that we set a local offer with a DTLS fingerprint when DTLS is on |
1652 // and then we accept a remote answer with a DTLS fingerprint successfully. | 1774 // and then we accept a remote answer with a DTLS fingerprint successfully. |
1653 TEST_P(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) { | 1775 TEST_P(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) { |
1654 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1776 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1655 mediastream_signaling_.SendAudioVideoStream1(); | 1777 SendAudioVideoStream1(); |
1656 InitWithDtls(GetParam()); | 1778 InitWithDtls(GetParam()); |
1657 SetFactoryDtlsSrtp(); | 1779 SetFactoryDtlsSrtp(); |
1658 | 1780 |
1659 // Verify that we get a crypto fingerprint in the answer. | 1781 // Verify that we get a crypto fingerprint in the answer. |
1660 SessionDescriptionInterface* offer = CreateOffer(); | 1782 SessionDescriptionInterface* offer = CreateOffer(); |
1661 ASSERT_TRUE(offer != NULL); | 1783 ASSERT_TRUE(offer != NULL); |
1662 VerifyFingerprintStatus(offer->description(), true); | 1784 VerifyFingerprintStatus(offer->description(), true); |
1663 // Check that we don't have an a=crypto line in the offer. | 1785 // Check that we don't have an a=crypto line in the offer. |
1664 VerifyNoCryptoParams(offer->description(), true); | 1786 VerifyNoCryptoParams(offer->description(), true); |
1665 | 1787 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1856 // SetRemoteDescription and SetLocalDescription will take the ownership of |
1735 // the offer and answer. | 1857 // the offer and answer. |
1736 SetLocalDescriptionWithoutError(offer); | 1858 SetLocalDescriptionWithoutError(offer); |
1737 SetRemoteDescriptionAnswerExpectError( | 1859 SetRemoteDescriptionAnswerExpectError( |
1738 kSdpWithoutDtlsFingerprint, answer); | 1860 kSdpWithoutDtlsFingerprint, answer); |
1739 } | 1861 } |
1740 | 1862 |
1741 // Test that we create a local offer without SDES or DTLS and accept a remote | 1863 // Test that we create a local offer without SDES or DTLS and accept a remote |
1742 // answer without SDES or DTLS when encryption is disabled. | 1864 // answer without SDES or DTLS when encryption is disabled. |
1743 TEST_P(WebRtcSessionTest, TestCreateOfferReceiveAnswerWithoutEncryption) { | 1865 TEST_P(WebRtcSessionTest, TestCreateOfferReceiveAnswerWithoutEncryption) { |
1744 mediastream_signaling_.SendAudioVideoStream1(); | 1866 SendAudioVideoStream1(); |
1745 options_.disable_encryption = true; | 1867 options_.disable_encryption = true; |
1746 InitWithDtls(GetParam()); | 1868 InitWithDtls(GetParam()); |
1747 | 1869 |
1748 // Verify that we get a crypto fingerprint in the answer. | 1870 // Verify that we get a crypto fingerprint in the answer. |
1749 SessionDescriptionInterface* offer = CreateOffer(); | 1871 SessionDescriptionInterface* offer = CreateOffer(); |
1750 ASSERT_TRUE(offer != NULL); | 1872 ASSERT_TRUE(offer != NULL); |
1751 VerifyFingerprintStatus(offer->description(), false); | 1873 VerifyFingerprintStatus(offer->description(), false); |
1752 // Check that we don't have an a=crypto line in the offer. | 1874 // Check that we don't have an a=crypto line in the offer. |
1753 VerifyNoCryptoParams(offer->description(), false); | 1875 VerifyNoCryptoParams(offer->description(), false); |
1754 | 1876 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 VerifyFingerprintStatus(answer->description(), false); | 1912 VerifyFingerprintStatus(answer->description(), false); |
1791 // Check that we don't have an a=crypto line in the answer. | 1913 // Check that we don't have an a=crypto line in the answer. |
1792 VerifyNoCryptoParams(answer->description(), false); | 1914 VerifyNoCryptoParams(answer->description(), false); |
1793 | 1915 |
1794 // Now set the local description, which should work, even without a=crypto. | 1916 // Now set the local description, which should work, even without a=crypto. |
1795 SetLocalDescriptionWithoutError(answer); | 1917 SetLocalDescriptionWithoutError(answer); |
1796 } | 1918 } |
1797 | 1919 |
1798 TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) { | 1920 TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) { |
1799 Init(); | 1921 Init(); |
1800 mediastream_signaling_.SendNothing(); | 1922 SendNothing(); |
1801 // SetLocalDescription take ownership of offer. | 1923 // SetLocalDescription take ownership of offer. |
1802 SessionDescriptionInterface* offer = CreateOffer(); | 1924 SessionDescriptionInterface* offer = CreateOffer(); |
1803 SetLocalDescriptionWithoutError(offer); | 1925 SetLocalDescriptionWithoutError(offer); |
1804 | 1926 |
1805 // SetLocalDescription take ownership of offer. | 1927 // SetLocalDescription take ownership of offer. |
1806 SessionDescriptionInterface* offer2 = CreateOffer(); | 1928 SessionDescriptionInterface* offer2 = CreateOffer(); |
1807 SetLocalDescriptionWithoutError(offer2); | 1929 SetLocalDescriptionWithoutError(offer2); |
1808 } | 1930 } |
1809 | 1931 |
1810 TEST_F(WebRtcSessionTest, TestSetRemoteOfferTwice) { | 1932 TEST_F(WebRtcSessionTest, TestSetRemoteOfferTwice) { |
1811 Init(); | 1933 Init(); |
1812 mediastream_signaling_.SendNothing(); | 1934 SendNothing(); |
1813 // SetLocalDescription take ownership of offer. | 1935 // SetLocalDescription take ownership of offer. |
1814 SessionDescriptionInterface* offer = CreateOffer(); | 1936 SessionDescriptionInterface* offer = CreateOffer(); |
1815 SetRemoteDescriptionWithoutError(offer); | 1937 SetRemoteDescriptionWithoutError(offer); |
1816 | 1938 |
1817 SessionDescriptionInterface* offer2 = CreateOffer(); | 1939 SessionDescriptionInterface* offer2 = CreateOffer(); |
1818 SetRemoteDescriptionWithoutError(offer2); | 1940 SetRemoteDescriptionWithoutError(offer2); |
1819 } | 1941 } |
1820 | 1942 |
1821 TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) { | 1943 TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) { |
1822 Init(); | 1944 Init(); |
1823 mediastream_signaling_.SendNothing(); | 1945 SendNothing(); |
1824 SessionDescriptionInterface* offer = CreateOffer(); | 1946 SessionDescriptionInterface* offer = CreateOffer(); |
1825 SetLocalDescriptionWithoutError(offer); | 1947 SetLocalDescriptionWithoutError(offer); |
1826 offer = CreateOffer(); | 1948 offer = CreateOffer(); |
1827 SetRemoteDescriptionOfferExpectError( | 1949 SetRemoteDescriptionOfferExpectError( |
1828 "Called in wrong state: STATE_SENTINITIATE", offer); | 1950 "Called in wrong state: STATE_SENTINITIATE", offer); |
1829 } | 1951 } |
1830 | 1952 |
1831 TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) { | 1953 TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) { |
1832 Init(); | 1954 Init(); |
1833 mediastream_signaling_.SendNothing(); | 1955 SendNothing(); |
1834 SessionDescriptionInterface* offer = CreateOffer(); | 1956 SessionDescriptionInterface* offer = CreateOffer(); |
1835 SetRemoteDescriptionWithoutError(offer); | 1957 SetRemoteDescriptionWithoutError(offer); |
1836 offer = CreateOffer(); | 1958 offer = CreateOffer(); |
1837 SetLocalDescriptionOfferExpectError( | 1959 SetLocalDescriptionOfferExpectError( |
1838 "Called in wrong state: STATE_RECEIVEDINITIATE", offer); | 1960 "Called in wrong state: STATE_RECEIVEDINITIATE", offer); |
1839 } | 1961 } |
1840 | 1962 |
1841 TEST_F(WebRtcSessionTest, TestSetLocalPrAnswer) { | 1963 TEST_F(WebRtcSessionTest, TestSetLocalPrAnswer) { |
1842 Init(); | 1964 Init(); |
1843 mediastream_signaling_.SendNothing(); | 1965 SendNothing(); |
1844 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 1966 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
1845 SetRemoteDescriptionExpectState(offer, BaseSession::STATE_RECEIVEDINITIATE); | 1967 SetRemoteDescriptionExpectState(offer, BaseSession::STATE_RECEIVEDINITIATE); |
1846 | 1968 |
1847 JsepSessionDescription* pranswer = static_cast<JsepSessionDescription*>( | 1969 JsepSessionDescription* pranswer = static_cast<JsepSessionDescription*>( |
1848 CreateAnswer(NULL)); | 1970 CreateAnswer(NULL)); |
1849 pranswer->set_type(SessionDescriptionInterface::kPrAnswer); | 1971 pranswer->set_type(SessionDescriptionInterface::kPrAnswer); |
1850 SetLocalDescriptionExpectState(pranswer, BaseSession::STATE_SENTPRACCEPT); | 1972 SetLocalDescriptionExpectState(pranswer, BaseSession::STATE_SENTPRACCEPT); |
1851 | 1973 |
1852 mediastream_signaling_.SendAudioVideoStream1(); | 1974 SendAudioVideoStream1(); |
1853 JsepSessionDescription* pranswer2 = static_cast<JsepSessionDescription*>( | 1975 JsepSessionDescription* pranswer2 = static_cast<JsepSessionDescription*>( |
1854 CreateAnswer(NULL)); | 1976 CreateAnswer(NULL)); |
1855 pranswer2->set_type(SessionDescriptionInterface::kPrAnswer); | 1977 pranswer2->set_type(SessionDescriptionInterface::kPrAnswer); |
1856 | 1978 |
1857 SetLocalDescriptionExpectState(pranswer2, BaseSession::STATE_SENTPRACCEPT); | 1979 SetLocalDescriptionExpectState(pranswer2, BaseSession::STATE_SENTPRACCEPT); |
1858 | 1980 |
1859 mediastream_signaling_.SendAudioVideoStream2(); | 1981 SendAudioVideoStream2(); |
1860 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 1982 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
1861 SetLocalDescriptionExpectState(answer, BaseSession::STATE_SENTACCEPT); | 1983 SetLocalDescriptionExpectState(answer, BaseSession::STATE_SENTACCEPT); |
1862 } | 1984 } |
1863 | 1985 |
1864 TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) { | 1986 TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) { |
1865 Init(); | 1987 Init(); |
1866 mediastream_signaling_.SendNothing(); | 1988 SendNothing(); |
1867 SessionDescriptionInterface* offer = CreateOffer(); | 1989 SessionDescriptionInterface* offer = CreateOffer(); |
1868 SetLocalDescriptionExpectState(offer, BaseSession::STATE_SENTINITIATE); | 1990 SetLocalDescriptionExpectState(offer, BaseSession::STATE_SENTINITIATE); |
1869 | 1991 |
1870 JsepSessionDescription* pranswer = | 1992 JsepSessionDescription* pranswer = |
1871 CreateRemoteAnswer(session_->local_description()); | 1993 CreateRemoteAnswer(session_->local_description()); |
1872 pranswer->set_type(SessionDescriptionInterface::kPrAnswer); | 1994 pranswer->set_type(SessionDescriptionInterface::kPrAnswer); |
1873 | 1995 |
1874 SetRemoteDescriptionExpectState(pranswer, | 1996 SetRemoteDescriptionExpectState(pranswer, |
1875 BaseSession::STATE_RECEIVEDPRACCEPT); | 1997 BaseSession::STATE_RECEIVEDPRACCEPT); |
1876 | 1998 |
1877 mediastream_signaling_.SendAudioVideoStream1(); | 1999 SendAudioVideoStream1(); |
1878 JsepSessionDescription* pranswer2 = | 2000 JsepSessionDescription* pranswer2 = |
1879 CreateRemoteAnswer(session_->local_description()); | 2001 CreateRemoteAnswer(session_->local_description()); |
1880 pranswer2->set_type(SessionDescriptionInterface::kPrAnswer); | 2002 pranswer2->set_type(SessionDescriptionInterface::kPrAnswer); |
1881 | 2003 |
1882 SetRemoteDescriptionExpectState(pranswer2, | 2004 SetRemoteDescriptionExpectState(pranswer2, |
1883 BaseSession::STATE_RECEIVEDPRACCEPT); | 2005 BaseSession::STATE_RECEIVEDPRACCEPT); |
1884 | 2006 |
1885 mediastream_signaling_.SendAudioVideoStream2(); | 2007 SendAudioVideoStream2(); |
1886 SessionDescriptionInterface* answer = | 2008 SessionDescriptionInterface* answer = |
1887 CreateRemoteAnswer(session_->local_description()); | 2009 CreateRemoteAnswer(session_->local_description()); |
1888 SetRemoteDescriptionExpectState(answer, BaseSession::STATE_RECEIVEDACCEPT); | 2010 SetRemoteDescriptionExpectState(answer, BaseSession::STATE_RECEIVEDACCEPT); |
1889 } | 2011 } |
1890 | 2012 |
1891 TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) { | 2013 TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) { |
1892 Init(); | 2014 Init(); |
1893 mediastream_signaling_.SendNothing(); | 2015 SendNothing(); |
1894 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2016 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
1895 | 2017 |
1896 SessionDescriptionInterface* answer = | 2018 SessionDescriptionInterface* answer = |
1897 CreateRemoteAnswer(offer.get()); | 2019 CreateRemoteAnswer(offer.get()); |
1898 SetLocalDescriptionAnswerExpectError("Called in wrong state: STATE_INIT", | 2020 SetLocalDescriptionAnswerExpectError("Called in wrong state: STATE_INIT", |
1899 answer); | 2021 answer); |
1900 } | 2022 } |
1901 | 2023 |
1902 TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) { | 2024 TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) { |
1903 Init(); | 2025 Init(); |
1904 mediastream_signaling_.SendNothing(); | 2026 SendNothing(); |
1905 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2027 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
1906 | 2028 |
1907 SessionDescriptionInterface* answer = | 2029 SessionDescriptionInterface* answer = |
1908 CreateRemoteAnswer(offer.get()); | 2030 CreateRemoteAnswer(offer.get()); |
1909 SetRemoteDescriptionAnswerExpectError( | 2031 SetRemoteDescriptionAnswerExpectError( |
1910 "Called in wrong state: STATE_INIT", answer); | 2032 "Called in wrong state: STATE_INIT", answer); |
1911 } | 2033 } |
1912 | 2034 |
1913 TEST_F(WebRtcSessionTest, TestAddRemoteCandidate) { | 2035 TEST_F(WebRtcSessionTest, TestAddRemoteCandidate) { |
1914 Init(); | 2036 Init(); |
1915 mediastream_signaling_.SendAudioVideoStream1(); | 2037 SendAudioVideoStream1(); |
1916 | 2038 |
1917 cricket::Candidate candidate; | 2039 cricket::Candidate candidate; |
1918 candidate.set_component(1); | 2040 candidate.set_component(1); |
1919 JsepIceCandidate ice_candidate1(kMediaContentName0, 0, candidate); | 2041 JsepIceCandidate ice_candidate1(kMediaContentName0, 0, candidate); |
1920 | 2042 |
1921 // Fail since we have not set a offer description. | 2043 // Fail since we have not set a offer description. |
1922 EXPECT_FALSE(session_->ProcessIceMessage(&ice_candidate1)); | 2044 EXPECT_FALSE(session_->ProcessIceMessage(&ice_candidate1)); |
1923 | 2045 |
1924 SessionDescriptionInterface* offer = CreateOffer(); | 2046 SessionDescriptionInterface* offer = CreateOffer(); |
1925 SetLocalDescriptionWithoutError(offer); | 2047 SetLocalDescriptionWithoutError(offer); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 } | 2080 } |
1959 | 2081 |
1960 // Test that a remote candidate is added to the remote session description and | 2082 // Test that a remote candidate is added to the remote session description and |
1961 // that it is retained if the remote session description is changed. | 2083 // that it is retained if the remote session description is changed. |
1962 TEST_F(WebRtcSessionTest, TestRemoteCandidatesAddedToSessionDescription) { | 2084 TEST_F(WebRtcSessionTest, TestRemoteCandidatesAddedToSessionDescription) { |
1963 Init(); | 2085 Init(); |
1964 cricket::Candidate candidate1; | 2086 cricket::Candidate candidate1; |
1965 candidate1.set_component(1); | 2087 candidate1.set_component(1); |
1966 JsepIceCandidate ice_candidate1(kMediaContentName0, kMediaContentIndex0, | 2088 JsepIceCandidate ice_candidate1(kMediaContentName0, kMediaContentIndex0, |
1967 candidate1); | 2089 candidate1); |
1968 mediastream_signaling_.SendAudioVideoStream1(); | 2090 SendAudioVideoStream1(); |
1969 CreateAndSetRemoteOfferAndLocalAnswer(); | 2091 CreateAndSetRemoteOfferAndLocalAnswer(); |
1970 | 2092 |
1971 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate1)); | 2093 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate1)); |
1972 const SessionDescriptionInterface* remote_desc = | 2094 const SessionDescriptionInterface* remote_desc = |
1973 session_->remote_description(); | 2095 session_->remote_description(); |
1974 ASSERT_TRUE(remote_desc != NULL); | 2096 ASSERT_TRUE(remote_desc != NULL); |
1975 ASSERT_EQ(2u, remote_desc->number_of_mediasections()); | 2097 ASSERT_EQ(2u, remote_desc->number_of_mediasections()); |
1976 const IceCandidateCollection* candidates = | 2098 const IceCandidateCollection* candidates = |
1977 remote_desc->candidates(kMediaContentIndex0); | 2099 remote_desc->candidates(kMediaContentIndex0); |
1978 ASSERT_EQ(1u, candidates->count()); | 2100 ASSERT_EQ(1u, candidates->count()); |
(...skipping 28 matching lines...) Expand all Loading... |
2007 | 2129 |
2008 // Test that the candidate is ignored if we can add the same candidate again. | 2130 // Test that the candidate is ignored if we can add the same candidate again. |
2009 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate2)); | 2131 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate2)); |
2010 } | 2132 } |
2011 | 2133 |
2012 // Test that local candidates are added to the local session description and | 2134 // Test that local candidates are added to the local session description and |
2013 // that they are retained if the local session description is changed. | 2135 // that they are retained if the local session description is changed. |
2014 TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) { | 2136 TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) { |
2015 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 2137 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
2016 Init(); | 2138 Init(); |
2017 mediastream_signaling_.SendAudioVideoStream1(); | 2139 SendAudioVideoStream1(); |
2018 CreateAndSetRemoteOfferAndLocalAnswer(); | 2140 CreateAndSetRemoteOfferAndLocalAnswer(); |
2019 | 2141 |
2020 const SessionDescriptionInterface* local_desc = session_->local_description(); | 2142 const SessionDescriptionInterface* local_desc = session_->local_description(); |
2021 const IceCandidateCollection* candidates = | 2143 const IceCandidateCollection* candidates = |
2022 local_desc->candidates(kMediaContentIndex0); | 2144 local_desc->candidates(kMediaContentIndex0); |
2023 ASSERT_TRUE(candidates != NULL); | 2145 ASSERT_TRUE(candidates != NULL); |
2024 EXPECT_EQ(0u, candidates->count()); | 2146 EXPECT_EQ(0u, candidates->count()); |
2025 | 2147 |
2026 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 2148 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
2027 | 2149 |
2028 local_desc = session_->local_description(); | 2150 local_desc = session_->local_description(); |
2029 candidates = local_desc->candidates(kMediaContentIndex0); | 2151 candidates = local_desc->candidates(kMediaContentIndex0); |
2030 ASSERT_TRUE(candidates != NULL); | 2152 ASSERT_TRUE(candidates != NULL); |
2031 EXPECT_LT(0u, candidates->count()); | 2153 EXPECT_LT(0u, candidates->count()); |
2032 candidates = local_desc->candidates(1); | 2154 candidates = local_desc->candidates(1); |
2033 ASSERT_TRUE(candidates != NULL); | 2155 ASSERT_TRUE(candidates != NULL); |
2034 EXPECT_EQ(0u, candidates->count()); | 2156 EXPECT_EQ(0u, candidates->count()); |
2035 | 2157 |
2036 // Update the session descriptions. | 2158 // Update the session descriptions. |
2037 mediastream_signaling_.SendAudioVideoStream1(); | 2159 SendAudioVideoStream1(); |
2038 CreateAndSetRemoteOfferAndLocalAnswer(); | 2160 CreateAndSetRemoteOfferAndLocalAnswer(); |
2039 | 2161 |
2040 local_desc = session_->local_description(); | 2162 local_desc = session_->local_description(); |
2041 candidates = local_desc->candidates(kMediaContentIndex0); | 2163 candidates = local_desc->candidates(kMediaContentIndex0); |
2042 ASSERT_TRUE(candidates != NULL); | 2164 ASSERT_TRUE(candidates != NULL); |
2043 EXPECT_LT(0u, candidates->count()); | 2165 EXPECT_LT(0u, candidates->count()); |
2044 candidates = local_desc->candidates(1); | 2166 candidates = local_desc->candidates(1); |
2045 ASSERT_TRUE(candidates != NULL); | 2167 ASSERT_TRUE(candidates != NULL); |
2046 EXPECT_EQ(0u, candidates->count()); | 2168 EXPECT_EQ(0u, candidates->count()); |
2047 } | 2169 } |
2048 | 2170 |
2049 // Test that we can set a remote session description with remote candidates. | 2171 // Test that we can set a remote session description with remote candidates. |
2050 TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) { | 2172 TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) { |
2051 Init(); | 2173 Init(); |
2052 | 2174 |
2053 cricket::Candidate candidate1; | 2175 cricket::Candidate candidate1; |
2054 candidate1.set_component(1); | 2176 candidate1.set_component(1); |
2055 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0, | 2177 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0, |
2056 candidate1); | 2178 candidate1); |
2057 mediastream_signaling_.SendAudioVideoStream1(); | 2179 SendAudioVideoStream1(); |
2058 SessionDescriptionInterface* offer = CreateOffer(); | 2180 SessionDescriptionInterface* offer = CreateOffer(); |
2059 | 2181 |
2060 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); | 2182 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); |
2061 SetRemoteDescriptionWithoutError(offer); | 2183 SetRemoteDescriptionWithoutError(offer); |
2062 | 2184 |
2063 const SessionDescriptionInterface* remote_desc = | 2185 const SessionDescriptionInterface* remote_desc = |
2064 session_->remote_description(); | 2186 session_->remote_description(); |
2065 ASSERT_TRUE(remote_desc != NULL); | 2187 ASSERT_TRUE(remote_desc != NULL); |
2066 ASSERT_EQ(2u, remote_desc->number_of_mediasections()); | 2188 ASSERT_EQ(2u, remote_desc->number_of_mediasections()); |
2067 const IceCandidateCollection* candidates = | 2189 const IceCandidateCollection* candidates = |
2068 remote_desc->candidates(kMediaContentIndex0); | 2190 remote_desc->candidates(kMediaContentIndex0); |
2069 ASSERT_EQ(1u, candidates->count()); | 2191 ASSERT_EQ(1u, candidates->count()); |
2070 EXPECT_EQ(kMediaContentIndex0, candidates->at(0)->sdp_mline_index()); | 2192 EXPECT_EQ(kMediaContentIndex0, candidates->at(0)->sdp_mline_index()); |
2071 | 2193 |
2072 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 2194 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
2073 SetLocalDescriptionWithoutError(answer); | 2195 SetLocalDescriptionWithoutError(answer); |
2074 } | 2196 } |
2075 | 2197 |
2076 // Test that offers and answers contains ice candidates when Ice candidates have | 2198 // Test that offers and answers contains ice candidates when Ice candidates have |
2077 // been gathered. | 2199 // been gathered. |
2078 TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) { | 2200 TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) { |
2079 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 2201 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
2080 Init(); | 2202 Init(); |
2081 mediastream_signaling_.SendAudioVideoStream1(); | 2203 SendAudioVideoStream1(); |
2082 // Ice is started but candidates are not provided until SetLocalDescription | 2204 // Ice is started but candidates are not provided until SetLocalDescription |
2083 // is called. | 2205 // is called. |
2084 EXPECT_EQ(0u, observer_.mline_0_candidates_.size()); | 2206 EXPECT_EQ(0u, observer_.mline_0_candidates_.size()); |
2085 EXPECT_EQ(0u, observer_.mline_1_candidates_.size()); | 2207 EXPECT_EQ(0u, observer_.mline_1_candidates_.size()); |
2086 CreateAndSetRemoteOfferAndLocalAnswer(); | 2208 CreateAndSetRemoteOfferAndLocalAnswer(); |
2087 // Wait until at least one local candidate has been collected. | 2209 // Wait until at least one local candidate has been collected. |
2088 EXPECT_TRUE_WAIT(0u < observer_.mline_0_candidates_.size(), | 2210 EXPECT_TRUE_WAIT(0u < observer_.mline_0_candidates_.size(), |
2089 kIceCandidatesTimeout); | 2211 kIceCandidatesTimeout); |
2090 | 2212 |
2091 rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer()); | 2213 rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer()); |
2092 | 2214 |
2093 ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL); | 2215 ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL); |
2094 EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count()); | 2216 EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count()); |
2095 | 2217 |
2096 SessionDescriptionInterface* remote_offer(CreateRemoteOffer()); | 2218 SessionDescriptionInterface* remote_offer(CreateRemoteOffer()); |
2097 SetRemoteDescriptionWithoutError(remote_offer); | 2219 SetRemoteDescriptionWithoutError(remote_offer); |
2098 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 2220 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
2099 ASSERT_TRUE(answer->candidates(kMediaContentIndex0) != NULL); | 2221 ASSERT_TRUE(answer->candidates(kMediaContentIndex0) != NULL); |
2100 EXPECT_LT(0u, answer->candidates(kMediaContentIndex0)->count()); | 2222 EXPECT_LT(0u, answer->candidates(kMediaContentIndex0)->count()); |
2101 SetLocalDescriptionWithoutError(answer); | 2223 SetLocalDescriptionWithoutError(answer); |
2102 } | 2224 } |
2103 | 2225 |
2104 // Verifies TransportProxy and media channels are created with content names | 2226 // Verifies TransportProxy and media channels are created with content names |
2105 // present in the SessionDescription. | 2227 // present in the SessionDescription. |
2106 TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) { | 2228 TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) { |
2107 Init(); | 2229 Init(); |
2108 mediastream_signaling_.SendAudioVideoStream1(); | 2230 SendAudioVideoStream1(); |
2109 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2231 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
2110 | 2232 |
2111 // CreateOffer creates session description with the content names "audio" and | 2233 // CreateOffer creates session description with the content names "audio" and |
2112 // "video". Goal is to modify these content names and verify transport channel | 2234 // "video". Goal is to modify these content names and verify transport channel |
2113 // proxy in the BaseSession, as proxies are created with the content names | 2235 // proxy in the BaseSession, as proxies are created with the content names |
2114 // present in SDP. | 2236 // present in SDP. |
2115 std::string sdp; | 2237 std::string sdp; |
2116 EXPECT_TRUE(offer->ToString(&sdp)); | 2238 EXPECT_TRUE(offer->ToString(&sdp)); |
2117 const std::string kAudioMid = "a=mid:audio"; | 2239 const std::string kAudioMid = "a=mid:audio"; |
2118 const std::string kAudioMidReplaceStr = "a=mid:audio_content_name"; | 2240 const std::string kAudioMidReplaceStr = "a=mid:audio_content_name"; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 EXPECT_TRUE(content != NULL); | 2285 EXPECT_TRUE(content != NULL); |
2164 content = cricket::GetFirstVideoContent(offer->description()); | 2286 content = cricket::GetFirstVideoContent(offer->description()); |
2165 EXPECT_TRUE(content == NULL); | 2287 EXPECT_TRUE(content == NULL); |
2166 } | 2288 } |
2167 | 2289 |
2168 // Test that an offer contains the correct media content descriptions based on | 2290 // Test that an offer contains the correct media content descriptions based on |
2169 // the send streams when no constraints have been set. | 2291 // the send streams when no constraints have been set. |
2170 TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) { | 2292 TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) { |
2171 Init(); | 2293 Init(); |
2172 // Test Audio only offer. | 2294 // Test Audio only offer. |
2173 mediastream_signaling_.UseOptionsAudioOnly(); | 2295 SendAudioOnlyStream2(); |
2174 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2296 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
2175 | 2297 |
2176 const cricket::ContentInfo* content = | 2298 const cricket::ContentInfo* content = |
2177 cricket::GetFirstAudioContent(offer->description()); | 2299 cricket::GetFirstAudioContent(offer->description()); |
2178 EXPECT_TRUE(content != NULL); | 2300 EXPECT_TRUE(content != NULL); |
2179 content = cricket::GetFirstVideoContent(offer->description()); | 2301 content = cricket::GetFirstVideoContent(offer->description()); |
2180 EXPECT_TRUE(content == NULL); | 2302 EXPECT_TRUE(content == NULL); |
2181 | 2303 |
2182 // Test Audio / Video offer. | 2304 // Test Audio / Video offer. |
2183 mediastream_signaling_.SendAudioVideoStream1(); | 2305 SendAudioVideoStream1(); |
2184 offer.reset(CreateOffer()); | 2306 offer.reset(CreateOffer()); |
2185 content = cricket::GetFirstAudioContent(offer->description()); | 2307 content = cricket::GetFirstAudioContent(offer->description()); |
2186 EXPECT_TRUE(content != NULL); | 2308 EXPECT_TRUE(content != NULL); |
2187 content = cricket::GetFirstVideoContent(offer->description()); | 2309 content = cricket::GetFirstVideoContent(offer->description()); |
2188 EXPECT_TRUE(content != NULL); | 2310 EXPECT_TRUE(content != NULL); |
2189 } | 2311 } |
2190 | 2312 |
2191 // Test that an offer contains no media content descriptions if | 2313 // Test that an offer contains no media content descriptions if |
2192 // kOfferToReceiveVideo and kOfferToReceiveAudio constraints are set to false. | 2314 // kOfferToReceiveVideo and kOfferToReceiveAudio constraints are set to false. |
2193 TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) { | 2315 TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 } | 2434 } |
2313 | 2435 |
2314 // Test that an answer contains the correct media content descriptions when no | 2436 // Test that an answer contains the correct media content descriptions when no |
2315 // constraints have been set. | 2437 // constraints have been set. |
2316 TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) { | 2438 TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) { |
2317 Init(); | 2439 Init(); |
2318 // Create a remote offer with audio and video content. | 2440 // Create a remote offer with audio and video content. |
2319 rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); | 2441 rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); |
2320 SetRemoteDescriptionWithoutError(offer.release()); | 2442 SetRemoteDescriptionWithoutError(offer.release()); |
2321 // Test with a stream with tracks. | 2443 // Test with a stream with tracks. |
2322 mediastream_signaling_.SendAudioVideoStream1(); | 2444 SendAudioVideoStream1(); |
2323 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 2445 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
2324 CreateAnswer(NULL)); | 2446 CreateAnswer(NULL)); |
2325 const cricket::ContentInfo* content = | 2447 const cricket::ContentInfo* content = |
2326 cricket::GetFirstAudioContent(answer->description()); | 2448 cricket::GetFirstAudioContent(answer->description()); |
2327 ASSERT_TRUE(content != NULL); | 2449 ASSERT_TRUE(content != NULL); |
2328 EXPECT_FALSE(content->rejected); | 2450 EXPECT_FALSE(content->rejected); |
2329 | 2451 |
2330 content = cricket::GetFirstVideoContent(answer->description()); | 2452 content = cricket::GetFirstVideoContent(answer->description()); |
2331 ASSERT_TRUE(content != NULL); | 2453 ASSERT_TRUE(content != NULL); |
2332 EXPECT_FALSE(content->rejected); | 2454 EXPECT_FALSE(content->rejected); |
(...skipping 29 matching lines...) Expand all Loading... |
2362 Init(); | 2484 Init(); |
2363 // Create a remote offer with audio and video content. | 2485 // Create a remote offer with audio and video content. |
2364 rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); | 2486 rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); |
2365 SetRemoteDescriptionWithoutError(offer.release()); | 2487 SetRemoteDescriptionWithoutError(offer.release()); |
2366 | 2488 |
2367 webrtc::FakeConstraints constraints_no_receive; | 2489 webrtc::FakeConstraints constraints_no_receive; |
2368 constraints_no_receive.SetMandatoryReceiveAudio(false); | 2490 constraints_no_receive.SetMandatoryReceiveAudio(false); |
2369 constraints_no_receive.SetMandatoryReceiveVideo(false); | 2491 constraints_no_receive.SetMandatoryReceiveVideo(false); |
2370 | 2492 |
2371 // Test with a stream with tracks. | 2493 // Test with a stream with tracks. |
2372 mediastream_signaling_.SendAudioVideoStream1(); | 2494 SendAudioVideoStream1(); |
2373 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 2495 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
2374 CreateAnswer(&constraints_no_receive)); | 2496 CreateAnswer(&constraints_no_receive)); |
2375 | 2497 |
2376 // TODO(perkj): Should the direction be set to SEND_ONLY? | 2498 // TODO(perkj): Should the direction be set to SEND_ONLY? |
2377 const cricket::ContentInfo* content = | 2499 const cricket::ContentInfo* content = |
2378 cricket::GetFirstAudioContent(answer->description()); | 2500 cricket::GetFirstAudioContent(answer->description()); |
2379 ASSERT_TRUE(content != NULL); | 2501 ASSERT_TRUE(content != NULL); |
2380 EXPECT_FALSE(content->rejected); | 2502 EXPECT_FALSE(content->rejected); |
2381 | 2503 |
2382 // TODO(perkj): Should the direction be set to SEND_ONLY? | 2504 // TODO(perkj): Should the direction be set to SEND_ONLY? |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2419 EXPECT_TRUE(VerifyNoCNCodecs(content)); | 2541 EXPECT_TRUE(VerifyNoCNCodecs(content)); |
2420 } | 2542 } |
2421 | 2543 |
2422 // This test verifies the call setup when remote answer with audio only and | 2544 // This test verifies the call setup when remote answer with audio only and |
2423 // later updates with video. | 2545 // later updates with video. |
2424 TEST_F(WebRtcSessionTest, TestAVOfferWithAudioOnlyAnswer) { | 2546 TEST_F(WebRtcSessionTest, TestAVOfferWithAudioOnlyAnswer) { |
2425 Init(); | 2547 Init(); |
2426 EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL); | 2548 EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL); |
2427 EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL); | 2549 EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL); |
2428 | 2550 |
2429 mediastream_signaling_.SendAudioVideoStream1(); | 2551 SendAudioVideoStream1(); |
2430 SessionDescriptionInterface* offer = CreateOffer(); | 2552 SessionDescriptionInterface* offer = CreateOffer(); |
2431 | 2553 |
2432 cricket::MediaSessionOptions options; | 2554 cricket::MediaSessionOptions options; |
2433 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer, options); | 2555 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer, options); |
2434 | 2556 |
2435 // SetLocalDescription and SetRemoteDescriptions takes ownership of offer | 2557 // SetLocalDescription and SetRemoteDescriptions takes ownership of offer |
2436 // and answer; | 2558 // and answer; |
2437 SetLocalDescriptionWithoutError(offer); | 2559 SetLocalDescriptionWithoutError(offer); |
2438 SetRemoteDescriptionWithoutError(answer); | 2560 SetRemoteDescriptionWithoutError(answer); |
2439 | 2561 |
2440 video_channel_ = media_engine_->GetVideoChannel(0); | 2562 video_channel_ = media_engine_->GetVideoChannel(0); |
2441 voice_channel_ = media_engine_->GetVoiceChannel(0); | 2563 voice_channel_ = media_engine_->GetVoiceChannel(0); |
2442 | 2564 |
2443 ASSERT_TRUE(video_channel_ == NULL); | 2565 ASSERT_TRUE(video_channel_ == NULL); |
2444 | 2566 |
2445 ASSERT_EQ(0u, voice_channel_->recv_streams().size()); | 2567 ASSERT_EQ(0u, voice_channel_->recv_streams().size()); |
2446 ASSERT_EQ(1u, voice_channel_->send_streams().size()); | 2568 ASSERT_EQ(1u, voice_channel_->send_streams().size()); |
2447 EXPECT_EQ(kAudioTrack1, voice_channel_->send_streams()[0].id); | 2569 EXPECT_EQ(kAudioTrack1, voice_channel_->send_streams()[0].id); |
2448 | 2570 |
2449 // Let the remote end update the session descriptions, with Audio and Video. | 2571 // Let the remote end update the session descriptions, with Audio and Video. |
2450 mediastream_signaling_.SendAudioVideoStream2(); | 2572 SendAudioVideoStream2(); |
2451 CreateAndSetRemoteOfferAndLocalAnswer(); | 2573 CreateAndSetRemoteOfferAndLocalAnswer(); |
2452 | 2574 |
2453 video_channel_ = media_engine_->GetVideoChannel(0); | 2575 video_channel_ = media_engine_->GetVideoChannel(0); |
2454 voice_channel_ = media_engine_->GetVoiceChannel(0); | 2576 voice_channel_ = media_engine_->GetVoiceChannel(0); |
2455 | 2577 |
2456 ASSERT_TRUE(video_channel_ != NULL); | 2578 ASSERT_TRUE(video_channel_ != NULL); |
2457 ASSERT_TRUE(voice_channel_ != NULL); | 2579 ASSERT_TRUE(voice_channel_ != NULL); |
2458 | 2580 |
2459 ASSERT_EQ(1u, video_channel_->recv_streams().size()); | 2581 ASSERT_EQ(1u, video_channel_->recv_streams().size()); |
2460 ASSERT_EQ(1u, video_channel_->send_streams().size()); | 2582 ASSERT_EQ(1u, video_channel_->send_streams().size()); |
2461 EXPECT_EQ(kVideoTrack2, video_channel_->recv_streams()[0].id); | 2583 EXPECT_EQ(kVideoTrack2, video_channel_->recv_streams()[0].id); |
2462 EXPECT_EQ(kVideoTrack2, video_channel_->send_streams()[0].id); | 2584 EXPECT_EQ(kVideoTrack2, video_channel_->send_streams()[0].id); |
2463 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); | 2585 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); |
2464 ASSERT_EQ(1u, voice_channel_->send_streams().size()); | 2586 ASSERT_EQ(1u, voice_channel_->send_streams().size()); |
2465 EXPECT_EQ(kAudioTrack2, voice_channel_->recv_streams()[0].id); | 2587 EXPECT_EQ(kAudioTrack2, voice_channel_->recv_streams()[0].id); |
2466 EXPECT_EQ(kAudioTrack2, voice_channel_->send_streams()[0].id); | 2588 EXPECT_EQ(kAudioTrack2, voice_channel_->send_streams()[0].id); |
2467 | 2589 |
2468 // Change session back to audio only. | 2590 // Change session back to audio only. |
2469 mediastream_signaling_.UseOptionsAudioOnly(); | 2591 SendAudioOnlyStream2(); |
2470 CreateAndSetRemoteOfferAndLocalAnswer(); | 2592 CreateAndSetRemoteOfferAndLocalAnswer(); |
2471 | 2593 |
2472 EXPECT_EQ(0u, video_channel_->recv_streams().size()); | 2594 EXPECT_EQ(0u, video_channel_->recv_streams().size()); |
2473 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); | 2595 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); |
2474 EXPECT_EQ(kAudioTrack2, voice_channel_->recv_streams()[0].id); | 2596 EXPECT_EQ(kAudioTrack2, voice_channel_->recv_streams()[0].id); |
2475 ASSERT_EQ(1u, voice_channel_->send_streams().size()); | 2597 ASSERT_EQ(1u, voice_channel_->send_streams().size()); |
2476 EXPECT_EQ(kAudioTrack2, voice_channel_->send_streams()[0].id); | 2598 EXPECT_EQ(kAudioTrack2, voice_channel_->send_streams()[0].id); |
2477 } | 2599 } |
2478 | 2600 |
2479 // This test verifies the call setup when remote answer with video only and | 2601 // This test verifies the call setup when remote answer with video only and |
2480 // later updates with audio. | 2602 // later updates with audio. |
2481 TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) { | 2603 TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) { |
2482 Init(); | 2604 Init(); |
2483 EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL); | 2605 EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL); |
2484 EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL); | 2606 EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL); |
2485 mediastream_signaling_.SendAudioVideoStream1(); | 2607 SendAudioVideoStream1(); |
2486 SessionDescriptionInterface* offer = CreateOffer(); | 2608 SessionDescriptionInterface* offer = CreateOffer(); |
2487 | 2609 |
2488 cricket::MediaSessionOptions options; | 2610 cricket::MediaSessionOptions options; |
2489 options.recv_audio = false; | 2611 options.recv_audio = false; |
2490 options.recv_video = true; | 2612 options.recv_video = true; |
2491 SessionDescriptionInterface* answer = CreateRemoteAnswer( | 2613 SessionDescriptionInterface* answer = CreateRemoteAnswer( |
2492 offer, options, cricket::SEC_ENABLED); | 2614 offer, options, cricket::SEC_ENABLED); |
2493 | 2615 |
2494 // SetLocalDescription and SetRemoteDescriptions takes ownership of offer | 2616 // SetLocalDescription and SetRemoteDescriptions takes ownership of offer |
2495 // and answer. | 2617 // and answer. |
2496 SetLocalDescriptionWithoutError(offer); | 2618 SetLocalDescriptionWithoutError(offer); |
2497 SetRemoteDescriptionWithoutError(answer); | 2619 SetRemoteDescriptionWithoutError(answer); |
2498 | 2620 |
2499 video_channel_ = media_engine_->GetVideoChannel(0); | 2621 video_channel_ = media_engine_->GetVideoChannel(0); |
2500 voice_channel_ = media_engine_->GetVoiceChannel(0); | 2622 voice_channel_ = media_engine_->GetVoiceChannel(0); |
2501 | 2623 |
2502 ASSERT_TRUE(voice_channel_ == NULL); | 2624 ASSERT_TRUE(voice_channel_ == NULL); |
2503 ASSERT_TRUE(video_channel_ != NULL); | 2625 ASSERT_TRUE(video_channel_ != NULL); |
2504 | 2626 |
2505 EXPECT_EQ(0u, video_channel_->recv_streams().size()); | 2627 EXPECT_EQ(0u, video_channel_->recv_streams().size()); |
2506 ASSERT_EQ(1u, video_channel_->send_streams().size()); | 2628 ASSERT_EQ(1u, video_channel_->send_streams().size()); |
2507 EXPECT_EQ(kVideoTrack1, video_channel_->send_streams()[0].id); | 2629 EXPECT_EQ(kVideoTrack1, video_channel_->send_streams()[0].id); |
2508 | 2630 |
2509 // Update the session descriptions, with Audio and Video. | 2631 // Update the session descriptions, with Audio and Video. |
2510 mediastream_signaling_.SendAudioVideoStream2(); | 2632 SendAudioVideoStream2(); |
2511 CreateAndSetRemoteOfferAndLocalAnswer(); | 2633 CreateAndSetRemoteOfferAndLocalAnswer(); |
2512 | 2634 |
2513 voice_channel_ = media_engine_->GetVoiceChannel(0); | 2635 voice_channel_ = media_engine_->GetVoiceChannel(0); |
2514 ASSERT_TRUE(voice_channel_ != NULL); | 2636 ASSERT_TRUE(voice_channel_ != NULL); |
2515 | 2637 |
2516 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); | 2638 ASSERT_EQ(1u, voice_channel_->recv_streams().size()); |
2517 ASSERT_EQ(1u, voice_channel_->send_streams().size()); | 2639 ASSERT_EQ(1u, voice_channel_->send_streams().size()); |
2518 EXPECT_EQ(kAudioTrack2, voice_channel_->recv_streams()[0].id); | 2640 EXPECT_EQ(kAudioTrack2, voice_channel_->recv_streams()[0].id); |
2519 EXPECT_EQ(kAudioTrack2, voice_channel_->send_streams()[0].id); | 2641 EXPECT_EQ(kAudioTrack2, voice_channel_->send_streams()[0].id); |
2520 | 2642 |
2521 // Change session back to video only. | 2643 // Change session back to video only. |
2522 mediastream_signaling_.UseOptionsVideoOnly(); | 2644 SendVideoOnlyStream2(); |
2523 CreateAndSetRemoteOfferAndLocalAnswer(); | 2645 CreateAndSetRemoteOfferAndLocalAnswer(); |
2524 | 2646 |
2525 video_channel_ = media_engine_->GetVideoChannel(0); | 2647 video_channel_ = media_engine_->GetVideoChannel(0); |
2526 voice_channel_ = media_engine_->GetVoiceChannel(0); | 2648 voice_channel_ = media_engine_->GetVoiceChannel(0); |
2527 | 2649 |
2528 ASSERT_EQ(1u, video_channel_->recv_streams().size()); | 2650 ASSERT_EQ(1u, video_channel_->recv_streams().size()); |
2529 EXPECT_EQ(kVideoTrack2, video_channel_->recv_streams()[0].id); | 2651 EXPECT_EQ(kVideoTrack2, video_channel_->recv_streams()[0].id); |
2530 ASSERT_EQ(1u, video_channel_->send_streams().size()); | 2652 ASSERT_EQ(1u, video_channel_->send_streams().size()); |
2531 EXPECT_EQ(kVideoTrack2, video_channel_->send_streams()[0].id); | 2653 EXPECT_EQ(kVideoTrack2, video_channel_->send_streams()[0].id); |
2532 } | 2654 } |
2533 | 2655 |
2534 TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) { | 2656 TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) { |
2535 Init(); | 2657 Init(); |
2536 mediastream_signaling_.SendAudioVideoStream1(); | 2658 SendAudioVideoStream1(); |
2537 scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2659 scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
2538 VerifyCryptoParams(offer->description()); | 2660 VerifyCryptoParams(offer->description()); |
2539 SetRemoteDescriptionWithoutError(offer.release()); | 2661 SetRemoteDescriptionWithoutError(offer.release()); |
2540 scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); | 2662 scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); |
2541 VerifyCryptoParams(answer->description()); | 2663 VerifyCryptoParams(answer->description()); |
2542 } | 2664 } |
2543 | 2665 |
2544 TEST_F(WebRtcSessionTest, VerifyNoCryptoParamsInSDP) { | 2666 TEST_F(WebRtcSessionTest, VerifyNoCryptoParamsInSDP) { |
2545 options_.disable_encryption = true; | 2667 options_.disable_encryption = true; |
2546 Init(); | 2668 Init(); |
2547 mediastream_signaling_.SendAudioVideoStream1(); | 2669 SendAudioVideoStream1(); |
2548 scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2670 scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
2549 VerifyNoCryptoParams(offer->description(), false); | 2671 VerifyNoCryptoParams(offer->description(), false); |
2550 } | 2672 } |
2551 | 2673 |
2552 TEST_F(WebRtcSessionTest, VerifyAnswerFromNonCryptoOffer) { | 2674 TEST_F(WebRtcSessionTest, VerifyAnswerFromNonCryptoOffer) { |
2553 Init(); | 2675 Init(); |
2554 VerifyAnswerFromNonCryptoOffer(); | 2676 VerifyAnswerFromNonCryptoOffer(); |
2555 } | 2677 } |
2556 | 2678 |
2557 TEST_F(WebRtcSessionTest, VerifyAnswerFromCryptoOffer) { | 2679 TEST_F(WebRtcSessionTest, VerifyAnswerFromCryptoOffer) { |
2558 Init(); | 2680 Init(); |
2559 VerifyAnswerFromCryptoOffer(); | 2681 VerifyAnswerFromCryptoOffer(); |
2560 } | 2682 } |
2561 | 2683 |
2562 // This test verifies that setLocalDescription fails if | 2684 // This test verifies that setLocalDescription fails if |
2563 // no a=ice-ufrag and a=ice-pwd lines are present in the SDP. | 2685 // no a=ice-ufrag and a=ice-pwd lines are present in the SDP. |
2564 TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) { | 2686 TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) { |
2565 Init(); | 2687 Init(); |
2566 mediastream_signaling_.SendAudioVideoStream1(); | 2688 SendAudioVideoStream1(); |
2567 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2689 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
2568 | 2690 |
2569 std::string sdp; | 2691 std::string sdp; |
2570 RemoveIceUfragPwdLines(offer.get(), &sdp); | 2692 RemoveIceUfragPwdLines(offer.get(), &sdp); |
2571 SessionDescriptionInterface* modified_offer = | 2693 SessionDescriptionInterface* modified_offer = |
2572 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); | 2694 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
2573 SetLocalDescriptionOfferExpectError(kSdpWithoutIceUfragPwd, modified_offer); | 2695 SetLocalDescriptionOfferExpectError(kSdpWithoutIceUfragPwd, modified_offer); |
2574 } | 2696 } |
2575 | 2697 |
2576 // This test verifies that setRemoteDescription fails if | 2698 // This test verifies that setRemoteDescription fails if |
2577 // no a=ice-ufrag and a=ice-pwd lines are present in the SDP. | 2699 // no a=ice-ufrag and a=ice-pwd lines are present in the SDP. |
2578 TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) { | 2700 TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) { |
2579 Init(); | 2701 Init(); |
2580 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); | 2702 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); |
2581 std::string sdp; | 2703 std::string sdp; |
2582 RemoveIceUfragPwdLines(offer.get(), &sdp); | 2704 RemoveIceUfragPwdLines(offer.get(), &sdp); |
2583 SessionDescriptionInterface* modified_offer = | 2705 SessionDescriptionInterface* modified_offer = |
2584 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); | 2706 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
2585 SetRemoteDescriptionOfferExpectError(kSdpWithoutIceUfragPwd, modified_offer); | 2707 SetRemoteDescriptionOfferExpectError(kSdpWithoutIceUfragPwd, modified_offer); |
2586 } | 2708 } |
2587 | 2709 |
2588 // This test verifies that setLocalDescription fails if local offer has | 2710 // This test verifies that setLocalDescription fails if local offer has |
2589 // too short ice ufrag and pwd strings. | 2711 // too short ice ufrag and pwd strings. |
2590 TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) { | 2712 TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) { |
2591 Init(); | 2713 Init(); |
2592 mediastream_signaling_.SendAudioVideoStream1(); | 2714 SendAudioVideoStream1(); |
2593 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 2715 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
2594 | 2716 |
2595 std::string sdp; | 2717 std::string sdp; |
2596 // Modifying ice ufrag and pwd in local offer with strings smaller than the | 2718 // Modifying ice ufrag and pwd in local offer with strings smaller than the |
2597 // recommended values of 4 and 22 bytes respectively. | 2719 // recommended values of 4 and 22 bytes respectively. |
2598 ModifyIceUfragPwdLines(offer.get(), "ice", "icepwd", &sdp); | 2720 ModifyIceUfragPwdLines(offer.get(), "ice", "icepwd", &sdp); |
2599 SessionDescriptionInterface* modified_offer = | 2721 SessionDescriptionInterface* modified_offer = |
2600 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); | 2722 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
2601 std::string error; | 2723 std::string error; |
2602 EXPECT_FALSE(session_->SetLocalDescription(modified_offer, &error)); | 2724 EXPECT_FALSE(session_->SetLocalDescription(modified_offer, &error)); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 SetRemoteDescriptionWithoutError(offer4); | 2810 SetRemoteDescriptionWithoutError(offer4); |
2689 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count()); | 2811 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count()); |
2690 } | 2812 } |
2691 | 2813 |
2692 // Test that candidates sent to the "video" transport do not get pushed down to | 2814 // Test that candidates sent to the "video" transport do not get pushed down to |
2693 // the "audio" transport channel when bundling using TransportProxy. | 2815 // the "audio" transport channel when bundling using TransportProxy. |
2694 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) { | 2816 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) { |
2695 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 2817 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
2696 | 2818 |
2697 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); | 2819 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); |
2698 mediastream_signaling_.SendAudioVideoStream1(); | 2820 SendAudioVideoStream1(); |
2699 | 2821 |
2700 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2822 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2701 options.use_rtp_mux = true; | 2823 options.use_rtp_mux = true; |
2702 | 2824 |
2703 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 2825 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
2704 SetRemoteDescriptionWithoutError(offer); | 2826 SetRemoteDescriptionWithoutError(offer); |
2705 | 2827 |
2706 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 2828 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
2707 SetLocalDescriptionWithoutError(answer); | 2829 SetLocalDescriptionWithoutError(answer); |
2708 | 2830 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 | 2893 |
2772 // No need here for a _WAIT check since we are checking that state hasn't | 2894 // No need here for a _WAIT check since we are checking that state hasn't |
2773 // changed: if this is false we would be doing waits for nothing and if this | 2895 // changed: if this is false we would be doing waits for nothing and if this |
2774 // is true then there will be no messages processed anyways. | 2896 // is true then there will be no messages processed anyways. |
2775 EXPECT_FALSE(connection_with_remote_port(6000)); | 2897 EXPECT_FALSE(connection_with_remote_port(6000)); |
2776 } | 2898 } |
2777 | 2899 |
2778 // kBundlePolicyBalanced BUNDLE policy and answer contains BUNDLE. | 2900 // kBundlePolicyBalanced BUNDLE policy and answer contains BUNDLE. |
2779 TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) { | 2901 TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) { |
2780 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); | 2902 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); |
2781 mediastream_signaling_.SendAudioVideoStream1(); | 2903 SendAudioVideoStream1(); |
2782 | 2904 |
2783 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2905 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2784 options.use_rtp_mux = true; | 2906 options.use_rtp_mux = true; |
2785 | 2907 |
2786 SessionDescriptionInterface* offer = CreateOffer(options); | 2908 SessionDescriptionInterface* offer = CreateOffer(options); |
2787 SetLocalDescriptionWithoutError(offer); | 2909 SetLocalDescriptionWithoutError(offer); |
2788 | 2910 |
2789 EXPECT_NE(session_->voice_rtp_transport_channel(), | 2911 EXPECT_NE(session_->voice_rtp_transport_channel(), |
2790 session_->video_rtp_transport_channel()); | 2912 session_->video_rtp_transport_channel()); |
2791 | 2913 |
2792 mediastream_signaling_.SendAudioVideoStream2(); | 2914 SendAudioVideoStream2(); |
2793 SessionDescriptionInterface* answer = | 2915 SessionDescriptionInterface* answer = |
2794 CreateRemoteAnswer(session_->local_description()); | 2916 CreateRemoteAnswer(session_->local_description()); |
2795 SetRemoteDescriptionWithoutError(answer); | 2917 SetRemoteDescriptionWithoutError(answer); |
2796 | 2918 |
2797 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 2919 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2798 session_->video_rtp_transport_channel()); | 2920 session_->video_rtp_transport_channel()); |
2799 } | 2921 } |
2800 | 2922 |
2801 // kBundlePolicyBalanced BUNDLE policy but no BUNDLE in the answer. | 2923 // kBundlePolicyBalanced BUNDLE policy but no BUNDLE in the answer. |
2802 TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) { | 2924 TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) { |
2803 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); | 2925 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); |
2804 mediastream_signaling_.SendAudioVideoStream1(); | 2926 SendAudioVideoStream1(); |
2805 | 2927 |
2806 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2928 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2807 options.use_rtp_mux = true; | 2929 options.use_rtp_mux = true; |
2808 | 2930 |
2809 SessionDescriptionInterface* offer = CreateOffer(options); | 2931 SessionDescriptionInterface* offer = CreateOffer(options); |
2810 SetLocalDescriptionWithoutError(offer); | 2932 SetLocalDescriptionWithoutError(offer); |
2811 | 2933 |
2812 EXPECT_NE(session_->voice_rtp_transport_channel(), | 2934 EXPECT_NE(session_->voice_rtp_transport_channel(), |
2813 session_->video_rtp_transport_channel()); | 2935 session_->video_rtp_transport_channel()); |
2814 | 2936 |
2815 mediastream_signaling_.SendAudioVideoStream2(); | 2937 SendAudioVideoStream2(); |
2816 | 2938 |
2817 // Remove BUNDLE from the answer. | 2939 // Remove BUNDLE from the answer. |
2818 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 2940 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
2819 CreateRemoteAnswer(session_->local_description())); | 2941 CreateRemoteAnswer(session_->local_description())); |
2820 cricket::SessionDescription* answer_copy = answer->description()->Copy(); | 2942 cricket::SessionDescription* answer_copy = answer->description()->Copy(); |
2821 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); | 2943 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); |
2822 JsepSessionDescription* modified_answer = | 2944 JsepSessionDescription* modified_answer = |
2823 new JsepSessionDescription(JsepSessionDescription::kAnswer); | 2945 new JsepSessionDescription(JsepSessionDescription::kAnswer); |
2824 modified_answer->Initialize(answer_copy, "1", "1"); | 2946 modified_answer->Initialize(answer_copy, "1", "1"); |
2825 SetRemoteDescriptionWithoutError(modified_answer); // | 2947 SetRemoteDescriptionWithoutError(modified_answer); // |
2826 | 2948 |
2827 EXPECT_NE(session_->voice_rtp_transport_channel(), | 2949 EXPECT_NE(session_->voice_rtp_transport_channel(), |
2828 session_->video_rtp_transport_channel()); | 2950 session_->video_rtp_transport_channel()); |
2829 } | 2951 } |
2830 | 2952 |
2831 // kBundlePolicyMaxBundle policy with BUNDLE in the answer. | 2953 // kBundlePolicyMaxBundle policy with BUNDLE in the answer. |
2832 TEST_F(WebRtcSessionTest, TestMaxBundleBundleInAnswer) { | 2954 TEST_F(WebRtcSessionTest, TestMaxBundleBundleInAnswer) { |
2833 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); | 2955 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); |
2834 mediastream_signaling_.SendAudioVideoStream1(); | 2956 SendAudioVideoStream1(); |
2835 | 2957 |
2836 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2958 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2837 options.use_rtp_mux = true; | 2959 options.use_rtp_mux = true; |
2838 | 2960 |
2839 SessionDescriptionInterface* offer = CreateOffer(options); | 2961 SessionDescriptionInterface* offer = CreateOffer(options); |
2840 SetLocalDescriptionWithoutError(offer); | 2962 SetLocalDescriptionWithoutError(offer); |
2841 | 2963 |
2842 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 2964 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2843 session_->video_rtp_transport_channel()); | 2965 session_->video_rtp_transport_channel()); |
2844 | 2966 |
2845 mediastream_signaling_.SendAudioVideoStream2(); | 2967 SendAudioVideoStream2(); |
2846 SessionDescriptionInterface* answer = | 2968 SessionDescriptionInterface* answer = |
2847 CreateRemoteAnswer(session_->local_description()); | 2969 CreateRemoteAnswer(session_->local_description()); |
2848 SetRemoteDescriptionWithoutError(answer); | 2970 SetRemoteDescriptionWithoutError(answer); |
2849 | 2971 |
2850 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 2972 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2851 session_->video_rtp_transport_channel()); | 2973 session_->video_rtp_transport_channel()); |
2852 } | 2974 } |
2853 | 2975 |
2854 // kBundlePolicyMaxBundle policy with BUNDLE in the answer, but no | 2976 // kBundlePolicyMaxBundle policy with BUNDLE in the answer, but no |
2855 // audio content in the answer. | 2977 // audio content in the answer. |
2856 TEST_F(WebRtcSessionTest, TestMaxBundleRejectAudio) { | 2978 TEST_F(WebRtcSessionTest, TestMaxBundleRejectAudio) { |
2857 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); | 2979 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); |
2858 mediastream_signaling_.SendAudioVideoStream1(); | 2980 SendAudioVideoStream1(); |
2859 | 2981 |
2860 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2982 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2861 options.use_rtp_mux = true; | 2983 options.use_rtp_mux = true; |
2862 | 2984 |
2863 SessionDescriptionInterface* offer = CreateOffer(options); | 2985 SessionDescriptionInterface* offer = CreateOffer(options); |
2864 SetLocalDescriptionWithoutError(offer); | 2986 SetLocalDescriptionWithoutError(offer); |
2865 | 2987 |
2866 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 2988 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2867 session_->video_rtp_transport_channel()); | 2989 session_->video_rtp_transport_channel()); |
2868 | 2990 |
2869 mediastream_signaling_.SendAudioVideoStream2(); | 2991 SendAudioVideoStream2(); |
2870 cricket::MediaSessionOptions recv_options; | 2992 cricket::MediaSessionOptions recv_options; |
2871 recv_options.recv_audio = false; | 2993 recv_options.recv_audio = false; |
2872 recv_options.recv_video = true; | 2994 recv_options.recv_video = true; |
2873 SessionDescriptionInterface* answer = | 2995 SessionDescriptionInterface* answer = |
2874 CreateRemoteAnswer(session_->local_description(), recv_options); | 2996 CreateRemoteAnswer(session_->local_description(), recv_options); |
2875 SetRemoteDescriptionWithoutError(answer); | 2997 SetRemoteDescriptionWithoutError(answer); |
2876 | 2998 |
2877 EXPECT_TRUE(NULL == session_->voice_channel()); | 2999 EXPECT_TRUE(NULL == session_->voice_channel()); |
2878 EXPECT_TRUE(NULL != session_->video_rtp_transport_channel()); | 3000 EXPECT_TRUE(NULL != session_->video_rtp_transport_channel()); |
2879 | 3001 |
2880 session_->Terminate(); | 3002 session_->Terminate(); |
2881 EXPECT_TRUE(NULL == session_->voice_rtp_transport_channel()); | 3003 EXPECT_TRUE(NULL == session_->voice_rtp_transport_channel()); |
2882 EXPECT_TRUE(NULL == session_->voice_rtcp_transport_channel()); | 3004 EXPECT_TRUE(NULL == session_->voice_rtcp_transport_channel()); |
2883 EXPECT_TRUE(NULL == session_->video_rtp_transport_channel()); | 3005 EXPECT_TRUE(NULL == session_->video_rtp_transport_channel()); |
2884 EXPECT_TRUE(NULL == session_->video_rtcp_transport_channel()); | 3006 EXPECT_TRUE(NULL == session_->video_rtcp_transport_channel()); |
2885 } | 3007 } |
2886 | 3008 |
2887 // kBundlePolicyMaxBundle policy but no BUNDLE in the answer. | 3009 // kBundlePolicyMaxBundle policy but no BUNDLE in the answer. |
2888 TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) { | 3010 TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) { |
2889 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); | 3011 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); |
2890 mediastream_signaling_.SendAudioVideoStream1(); | 3012 SendAudioVideoStream1(); |
2891 | 3013 |
2892 PeerConnectionInterface::RTCOfferAnswerOptions options; | 3014 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2893 options.use_rtp_mux = true; | 3015 options.use_rtp_mux = true; |
2894 | 3016 |
2895 SessionDescriptionInterface* offer = CreateOffer(options); | 3017 SessionDescriptionInterface* offer = CreateOffer(options); |
2896 SetLocalDescriptionWithoutError(offer); | 3018 SetLocalDescriptionWithoutError(offer); |
2897 | 3019 |
2898 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 3020 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2899 session_->video_rtp_transport_channel()); | 3021 session_->video_rtp_transport_channel()); |
2900 | 3022 |
2901 mediastream_signaling_.SendAudioVideoStream2(); | 3023 SendAudioVideoStream2(); |
2902 | 3024 |
2903 // Remove BUNDLE from the answer. | 3025 // Remove BUNDLE from the answer. |
2904 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 3026 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
2905 CreateRemoteAnswer(session_->local_description())); | 3027 CreateRemoteAnswer(session_->local_description())); |
2906 cricket::SessionDescription* answer_copy = answer->description()->Copy(); | 3028 cricket::SessionDescription* answer_copy = answer->description()->Copy(); |
2907 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); | 3029 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); |
2908 JsepSessionDescription* modified_answer = | 3030 JsepSessionDescription* modified_answer = |
2909 new JsepSessionDescription(JsepSessionDescription::kAnswer); | 3031 new JsepSessionDescription(JsepSessionDescription::kAnswer); |
2910 modified_answer->Initialize(answer_copy, "1", "1"); | 3032 modified_answer->Initialize(answer_copy, "1", "1"); |
2911 SetRemoteDescriptionWithoutError(modified_answer); | 3033 SetRemoteDescriptionWithoutError(modified_answer); |
2912 | 3034 |
2913 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 3035 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2914 session_->video_rtp_transport_channel()); | 3036 session_->video_rtp_transport_channel()); |
2915 } | 3037 } |
2916 | 3038 |
2917 // kBundlePolicyMaxBundle policy with BUNDLE in the remote offer. | 3039 // kBundlePolicyMaxBundle policy with BUNDLE in the remote offer. |
2918 TEST_F(WebRtcSessionTest, TestMaxBundleBundleInRemoteOffer) { | 3040 TEST_F(WebRtcSessionTest, TestMaxBundleBundleInRemoteOffer) { |
2919 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); | 3041 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); |
2920 mediastream_signaling_.SendAudioVideoStream1(); | 3042 SendAudioVideoStream1(); |
2921 | 3043 |
2922 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 3044 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
2923 SetRemoteDescriptionWithoutError(offer); | 3045 SetRemoteDescriptionWithoutError(offer); |
2924 | 3046 |
2925 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 3047 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2926 session_->video_rtp_transport_channel()); | 3048 session_->video_rtp_transport_channel()); |
2927 | 3049 |
2928 mediastream_signaling_.SendAudioVideoStream2(); | 3050 SendAudioVideoStream2(); |
2929 SessionDescriptionInterface* answer = CreateAnswer(nullptr); | 3051 SessionDescriptionInterface* answer = CreateAnswer(nullptr); |
2930 SetLocalDescriptionWithoutError(answer); | 3052 SetLocalDescriptionWithoutError(answer); |
2931 | 3053 |
2932 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 3054 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2933 session_->video_rtp_transport_channel()); | 3055 session_->video_rtp_transport_channel()); |
2934 } | 3056 } |
2935 | 3057 |
2936 // kBundlePolicyMaxBundle policy but no BUNDLE in the remote offer. | 3058 // kBundlePolicyMaxBundle policy but no BUNDLE in the remote offer. |
2937 TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInRemoteOffer) { | 3059 TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInRemoteOffer) { |
2938 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); | 3060 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); |
2939 mediastream_signaling_.SendAudioVideoStream1(); | 3061 SendAudioVideoStream1(); |
2940 | 3062 |
2941 // Remove BUNDLE from the offer. | 3063 // Remove BUNDLE from the offer. |
2942 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); | 3064 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); |
2943 cricket::SessionDescription* offer_copy = offer->description()->Copy(); | 3065 cricket::SessionDescription* offer_copy = offer->description()->Copy(); |
2944 offer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); | 3066 offer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); |
2945 JsepSessionDescription* modified_offer = | 3067 JsepSessionDescription* modified_offer = |
2946 new JsepSessionDescription(JsepSessionDescription::kOffer); | 3068 new JsepSessionDescription(JsepSessionDescription::kOffer); |
2947 modified_offer->Initialize(offer_copy, "1", "1"); | 3069 modified_offer->Initialize(offer_copy, "1", "1"); |
2948 | 3070 |
2949 // Expect an error when applying the remote description | 3071 // Expect an error when applying the remote description |
2950 SetRemoteDescriptionExpectError(JsepSessionDescription::kOffer, | 3072 SetRemoteDescriptionExpectError(JsepSessionDescription::kOffer, |
2951 kCreateChannelFailed, modified_offer); | 3073 kCreateChannelFailed, modified_offer); |
2952 } | 3074 } |
2953 | 3075 |
2954 // kBundlePolicyMaxCompat bundle policy and answer contains BUNDLE. | 3076 // kBundlePolicyMaxCompat bundle policy and answer contains BUNDLE. |
2955 TEST_F(WebRtcSessionTest, TestMaxCompatBundleInAnswer) { | 3077 TEST_F(WebRtcSessionTest, TestMaxCompatBundleInAnswer) { |
2956 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat); | 3078 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat); |
2957 mediastream_signaling_.SendAudioVideoStream1(); | 3079 SendAudioVideoStream1(); |
2958 | 3080 |
2959 PeerConnectionInterface::RTCOfferAnswerOptions options; | 3081 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2960 options.use_rtp_mux = true; | 3082 options.use_rtp_mux = true; |
2961 | 3083 |
2962 SessionDescriptionInterface* offer = CreateOffer(options); | 3084 SessionDescriptionInterface* offer = CreateOffer(options); |
2963 SetLocalDescriptionWithoutError(offer); | 3085 SetLocalDescriptionWithoutError(offer); |
2964 | 3086 |
2965 EXPECT_NE(session_->voice_rtp_transport_channel(), | 3087 EXPECT_NE(session_->voice_rtp_transport_channel(), |
2966 session_->video_rtp_transport_channel()); | 3088 session_->video_rtp_transport_channel()); |
2967 | 3089 |
2968 mediastream_signaling_.SendAudioVideoStream2(); | 3090 SendAudioVideoStream2(); |
2969 SessionDescriptionInterface* answer = | 3091 SessionDescriptionInterface* answer = |
2970 CreateRemoteAnswer(session_->local_description()); | 3092 CreateRemoteAnswer(session_->local_description()); |
2971 SetRemoteDescriptionWithoutError(answer); | 3093 SetRemoteDescriptionWithoutError(answer); |
2972 | 3094 |
2973 // This should lead to an audio-only call but isn't implemented | 3095 // This should lead to an audio-only call but isn't implemented |
2974 // correctly yet. | 3096 // correctly yet. |
2975 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 3097 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
2976 session_->video_rtp_transport_channel()); | 3098 session_->video_rtp_transport_channel()); |
2977 } | 3099 } |
2978 | 3100 |
2979 // kBundlePolicyMaxCompat BUNDLE policy but no BUNDLE in the answer. | 3101 // kBundlePolicyMaxCompat BUNDLE policy but no BUNDLE in the answer. |
2980 TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) { | 3102 TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) { |
2981 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat); | 3103 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat); |
2982 mediastream_signaling_.SendAudioVideoStream1(); | 3104 SendAudioVideoStream1(); |
2983 PeerConnectionInterface::RTCOfferAnswerOptions options; | 3105 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2984 options.use_rtp_mux = true; | 3106 options.use_rtp_mux = true; |
2985 | 3107 |
2986 SessionDescriptionInterface* offer = CreateOffer(options); | 3108 SessionDescriptionInterface* offer = CreateOffer(options); |
2987 SetLocalDescriptionWithoutError(offer); | 3109 SetLocalDescriptionWithoutError(offer); |
2988 | 3110 |
2989 EXPECT_NE(session_->voice_rtp_transport_channel(), | 3111 EXPECT_NE(session_->voice_rtp_transport_channel(), |
2990 session_->video_rtp_transport_channel()); | 3112 session_->video_rtp_transport_channel()); |
2991 | 3113 |
2992 mediastream_signaling_.SendAudioVideoStream2(); | 3114 SendAudioVideoStream2(); |
2993 | 3115 |
2994 // Remove BUNDLE from the answer. | 3116 // Remove BUNDLE from the answer. |
2995 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 3117 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
2996 CreateRemoteAnswer(session_->local_description())); | 3118 CreateRemoteAnswer(session_->local_description())); |
2997 cricket::SessionDescription* answer_copy = answer->description()->Copy(); | 3119 cricket::SessionDescription* answer_copy = answer->description()->Copy(); |
2998 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); | 3120 answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); |
2999 JsepSessionDescription* modified_answer = | 3121 JsepSessionDescription* modified_answer = |
3000 new JsepSessionDescription(JsepSessionDescription::kAnswer); | 3122 new JsepSessionDescription(JsepSessionDescription::kAnswer); |
3001 modified_answer->Initialize(answer_copy, "1", "1"); | 3123 modified_answer->Initialize(answer_copy, "1", "1"); |
3002 SetRemoteDescriptionWithoutError(modified_answer); // | 3124 SetRemoteDescriptionWithoutError(modified_answer); // |
3003 | 3125 |
3004 EXPECT_NE(session_->voice_rtp_transport_channel(), | 3126 EXPECT_NE(session_->voice_rtp_transport_channel(), |
3005 session_->video_rtp_transport_channel()); | 3127 session_->video_rtp_transport_channel()); |
3006 } | 3128 } |
3007 | 3129 |
3008 // kBundlePolicyMaxbundle and then we call SetRemoteDescription first. | 3130 // kBundlePolicyMaxbundle and then we call SetRemoteDescription first. |
3009 TEST_F(WebRtcSessionTest, TestMaxBundleWithSetRemoteDescriptionFirst) { | 3131 TEST_F(WebRtcSessionTest, TestMaxBundleWithSetRemoteDescriptionFirst) { |
3010 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); | 3132 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); |
3011 mediastream_signaling_.SendAudioVideoStream1(); | 3133 SendAudioVideoStream1(); |
3012 | 3134 |
3013 PeerConnectionInterface::RTCOfferAnswerOptions options; | 3135 PeerConnectionInterface::RTCOfferAnswerOptions options; |
3014 options.use_rtp_mux = true; | 3136 options.use_rtp_mux = true; |
3015 | 3137 |
3016 SessionDescriptionInterface* offer = CreateOffer(options); | 3138 SessionDescriptionInterface* offer = CreateOffer(options); |
3017 SetRemoteDescriptionWithoutError(offer); | 3139 SetRemoteDescriptionWithoutError(offer); |
3018 | 3140 |
3019 EXPECT_EQ(session_->voice_rtp_transport_channel(), | 3141 EXPECT_EQ(session_->voice_rtp_transport_channel(), |
3020 session_->video_rtp_transport_channel()); | 3142 session_->video_rtp_transport_channel()); |
3021 } | 3143 } |
3022 | 3144 |
3023 TEST_F(WebRtcSessionTest, TestRequireRtcpMux) { | 3145 TEST_F(WebRtcSessionTest, TestRequireRtcpMux) { |
3024 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyRequire); | 3146 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyRequire); |
3025 mediastream_signaling_.SendAudioVideoStream1(); | 3147 SendAudioVideoStream1(); |
3026 | 3148 |
3027 PeerConnectionInterface::RTCOfferAnswerOptions options; | 3149 PeerConnectionInterface::RTCOfferAnswerOptions options; |
3028 SessionDescriptionInterface* offer = CreateOffer(options); | 3150 SessionDescriptionInterface* offer = CreateOffer(options); |
3029 SetLocalDescriptionWithoutError(offer); | 3151 SetLocalDescriptionWithoutError(offer); |
3030 | 3152 |
3031 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL); | 3153 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL); |
3032 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL); | 3154 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL); |
3033 | 3155 |
3034 mediastream_signaling_.SendAudioVideoStream2(); | 3156 SendAudioVideoStream2(); |
3035 SessionDescriptionInterface* answer = | 3157 SessionDescriptionInterface* answer = |
3036 CreateRemoteAnswer(session_->local_description()); | 3158 CreateRemoteAnswer(session_->local_description()); |
3037 SetRemoteDescriptionWithoutError(answer); | 3159 SetRemoteDescriptionWithoutError(answer); |
3038 | 3160 |
3039 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL); | 3161 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL); |
3040 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL); | 3162 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL); |
3041 } | 3163 } |
3042 | 3164 |
3043 TEST_F(WebRtcSessionTest, TestNegotiateRtcpMux) { | 3165 TEST_F(WebRtcSessionTest, TestNegotiateRtcpMux) { |
3044 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyNegotiate); | 3166 InitWithRtcpMuxPolicy(PeerConnectionInterface::kRtcpMuxPolicyNegotiate); |
3045 mediastream_signaling_.SendAudioVideoStream1(); | 3167 SendAudioVideoStream1(); |
3046 | 3168 |
3047 PeerConnectionInterface::RTCOfferAnswerOptions options; | 3169 PeerConnectionInterface::RTCOfferAnswerOptions options; |
3048 SessionDescriptionInterface* offer = CreateOffer(options); | 3170 SessionDescriptionInterface* offer = CreateOffer(options); |
3049 SetLocalDescriptionWithoutError(offer); | 3171 SetLocalDescriptionWithoutError(offer); |
3050 | 3172 |
3051 EXPECT_TRUE(session_->voice_rtcp_transport_channel() != NULL); | 3173 EXPECT_TRUE(session_->voice_rtcp_transport_channel() != NULL); |
3052 EXPECT_TRUE(session_->video_rtcp_transport_channel() != NULL); | 3174 EXPECT_TRUE(session_->video_rtcp_transport_channel() != NULL); |
3053 | 3175 |
3054 mediastream_signaling_.SendAudioVideoStream2(); | 3176 SendAudioVideoStream2(); |
3055 SessionDescriptionInterface* answer = | 3177 SessionDescriptionInterface* answer = |
3056 CreateRemoteAnswer(session_->local_description()); | 3178 CreateRemoteAnswer(session_->local_description()); |
3057 SetRemoteDescriptionWithoutError(answer); | 3179 SetRemoteDescriptionWithoutError(answer); |
3058 | 3180 |
3059 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL); | 3181 EXPECT_TRUE(session_->voice_rtcp_transport_channel() == NULL); |
3060 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL); | 3182 EXPECT_TRUE(session_->video_rtcp_transport_channel() == NULL); |
3061 } | 3183 } |
3062 | 3184 |
3063 // This test verifies that SetLocalDescription and SetRemoteDescription fails | 3185 // This test verifies that SetLocalDescription and SetRemoteDescription fails |
3064 // if BUNDLE is enabled but rtcp-mux is disabled in m-lines. | 3186 // if BUNDLE is enabled but rtcp-mux is disabled in m-lines. |
3065 TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) { | 3187 TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) { |
3066 Init(); | 3188 Init(); |
3067 mediastream_signaling_.SendAudioVideoStream1(); | 3189 SendAudioVideoStream1(); |
3068 | 3190 |
3069 PeerConnectionInterface::RTCOfferAnswerOptions options; | 3191 PeerConnectionInterface::RTCOfferAnswerOptions options; |
3070 options.use_rtp_mux = true; | 3192 options.use_rtp_mux = true; |
3071 | 3193 |
3072 SessionDescriptionInterface* offer = CreateOffer(options); | 3194 SessionDescriptionInterface* offer = CreateOffer(options); |
3073 std::string offer_str; | 3195 std::string offer_str; |
3074 offer->ToString(&offer_str); | 3196 offer->ToString(&offer_str); |
3075 // Disable rtcp-mux | 3197 // Disable rtcp-mux |
3076 const std::string rtcp_mux = "rtcp-mux"; | 3198 const std::string rtcp_mux = "rtcp-mux"; |
3077 const std::string xrtcp_mux = "xrtcp-mux"; | 3199 const std::string xrtcp_mux = "xrtcp-mux"; |
3078 rtc::replace_substrs(rtcp_mux.c_str(), rtcp_mux.length(), | 3200 rtc::replace_substrs(rtcp_mux.c_str(), rtcp_mux.length(), |
3079 xrtcp_mux.c_str(), xrtcp_mux.length(), | 3201 xrtcp_mux.c_str(), xrtcp_mux.length(), |
3080 &offer_str); | 3202 &offer_str); |
3081 JsepSessionDescription* local_offer = | 3203 JsepSessionDescription* local_offer = |
3082 new JsepSessionDescription(JsepSessionDescription::kOffer); | 3204 new JsepSessionDescription(JsepSessionDescription::kOffer); |
3083 EXPECT_TRUE((local_offer)->Initialize(offer_str, NULL)); | 3205 EXPECT_TRUE((local_offer)->Initialize(offer_str, NULL)); |
3084 SetLocalDescriptionOfferExpectError(kBundleWithoutRtcpMux, local_offer); | 3206 SetLocalDescriptionOfferExpectError(kBundleWithoutRtcpMux, local_offer); |
3085 JsepSessionDescription* remote_offer = | 3207 JsepSessionDescription* remote_offer = |
3086 new JsepSessionDescription(JsepSessionDescription::kOffer); | 3208 new JsepSessionDescription(JsepSessionDescription::kOffer); |
3087 EXPECT_TRUE((remote_offer)->Initialize(offer_str, NULL)); | 3209 EXPECT_TRUE((remote_offer)->Initialize(offer_str, NULL)); |
3088 SetRemoteDescriptionOfferExpectError(kBundleWithoutRtcpMux, remote_offer); | 3210 SetRemoteDescriptionOfferExpectError(kBundleWithoutRtcpMux, remote_offer); |
3089 // Trying unmodified SDP. | 3211 // Trying unmodified SDP. |
3090 SetLocalDescriptionWithoutError(offer); | 3212 SetLocalDescriptionWithoutError(offer); |
3091 } | 3213 } |
3092 | 3214 |
3093 TEST_F(WebRtcSessionTest, SetAudioPlayout) { | 3215 TEST_F(WebRtcSessionTest, SetAudioPlayout) { |
3094 Init(); | 3216 Init(); |
3095 mediastream_signaling_.SendAudioVideoStream1(); | 3217 SendAudioVideoStream1(); |
3096 CreateAndSetRemoteOfferAndLocalAnswer(); | 3218 CreateAndSetRemoteOfferAndLocalAnswer(); |
3097 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); | 3219 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); |
3098 ASSERT_TRUE(channel != NULL); | 3220 ASSERT_TRUE(channel != NULL); |
3099 ASSERT_EQ(1u, channel->recv_streams().size()); | 3221 ASSERT_EQ(1u, channel->recv_streams().size()); |
3100 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc(); | 3222 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc(); |
3101 double volume; | 3223 double volume; |
3102 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); | 3224 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); |
3103 EXPECT_EQ(1, volume); | 3225 EXPECT_EQ(1, volume); |
3104 session_->SetAudioPlayout(receive_ssrc, false); | 3226 session_->SetAudioPlayout(receive_ssrc, false); |
3105 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); | 3227 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); |
3106 EXPECT_EQ(0, volume); | 3228 EXPECT_EQ(0, volume); |
3107 session_->SetAudioPlayout(receive_ssrc, true); | 3229 session_->SetAudioPlayout(receive_ssrc, true); |
3108 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); | 3230 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); |
3109 EXPECT_EQ(1, volume); | 3231 EXPECT_EQ(1, volume); |
3110 } | 3232 } |
3111 | 3233 |
3112 TEST_F(WebRtcSessionTest, SetAudioSend) { | 3234 TEST_F(WebRtcSessionTest, SetAudioSend) { |
3113 Init(); | 3235 Init(); |
3114 mediastream_signaling_.SendAudioVideoStream1(); | 3236 SendAudioVideoStream1(); |
3115 CreateAndSetRemoteOfferAndLocalAnswer(); | 3237 CreateAndSetRemoteOfferAndLocalAnswer(); |
3116 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); | 3238 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); |
3117 ASSERT_TRUE(channel != NULL); | 3239 ASSERT_TRUE(channel != NULL); |
3118 ASSERT_EQ(1u, channel->send_streams().size()); | 3240 ASSERT_EQ(1u, channel->send_streams().size()); |
3119 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); | 3241 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); |
3120 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); | 3242 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); |
3121 | 3243 |
3122 cricket::AudioOptions options; | 3244 cricket::AudioOptions options; |
3123 options.echo_cancellation.Set(true); | 3245 options.echo_cancellation.Set(true); |
3124 | 3246 |
3125 rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer()); | 3247 rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer()); |
3126 session_->SetAudioSend(send_ssrc, false, options, renderer.get()); | 3248 session_->SetAudioSend(send_ssrc, false, options, renderer.get()); |
3127 EXPECT_TRUE(channel->IsStreamMuted(send_ssrc)); | 3249 EXPECT_TRUE(channel->IsStreamMuted(send_ssrc)); |
3128 EXPECT_FALSE(channel->options().echo_cancellation.IsSet()); | 3250 EXPECT_FALSE(channel->options().echo_cancellation.IsSet()); |
3129 EXPECT_TRUE(renderer->sink() != NULL); | 3251 EXPECT_TRUE(renderer->sink() != NULL); |
3130 | 3252 |
3131 // This will trigger SetSink(NULL) to the |renderer|. | 3253 // This will trigger SetSink(NULL) to the |renderer|. |
3132 session_->SetAudioSend(send_ssrc, true, options, NULL); | 3254 session_->SetAudioSend(send_ssrc, true, options, NULL); |
3133 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); | 3255 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); |
3134 bool value; | 3256 bool value; |
3135 EXPECT_TRUE(channel->options().echo_cancellation.Get(&value)); | 3257 EXPECT_TRUE(channel->options().echo_cancellation.Get(&value)); |
3136 EXPECT_TRUE(value); | 3258 EXPECT_TRUE(value); |
3137 EXPECT_TRUE(renderer->sink() == NULL); | 3259 EXPECT_TRUE(renderer->sink() == NULL); |
3138 } | 3260 } |
3139 | 3261 |
3140 TEST_F(WebRtcSessionTest, AudioRendererForLocalStream) { | 3262 TEST_F(WebRtcSessionTest, AudioRendererForLocalStream) { |
3141 Init(); | 3263 Init(); |
3142 mediastream_signaling_.SendAudioVideoStream1(); | 3264 SendAudioVideoStream1(); |
3143 CreateAndSetRemoteOfferAndLocalAnswer(); | 3265 CreateAndSetRemoteOfferAndLocalAnswer(); |
3144 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); | 3266 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); |
3145 ASSERT_TRUE(channel != NULL); | 3267 ASSERT_TRUE(channel != NULL); |
3146 ASSERT_EQ(1u, channel->send_streams().size()); | 3268 ASSERT_EQ(1u, channel->send_streams().size()); |
3147 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); | 3269 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); |
3148 | 3270 |
3149 rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer()); | 3271 rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer()); |
3150 cricket::AudioOptions options; | 3272 cricket::AudioOptions options; |
3151 session_->SetAudioSend(send_ssrc, true, options, renderer.get()); | 3273 session_->SetAudioSend(send_ssrc, true, options, renderer.get()); |
3152 EXPECT_TRUE(renderer->sink() != NULL); | 3274 EXPECT_TRUE(renderer->sink() != NULL); |
3153 | 3275 |
3154 // Delete the |renderer| and it will trigger OnClose() to the sink, and this | 3276 // Delete the |renderer| and it will trigger OnClose() to the sink, and this |
3155 // will invalidate the |renderer_| pointer in the sink and prevent getting a | 3277 // will invalidate the |renderer_| pointer in the sink and prevent getting a |
3156 // SetSink(NULL) callback afterwards. | 3278 // SetSink(NULL) callback afterwards. |
3157 renderer.reset(); | 3279 renderer.reset(); |
3158 | 3280 |
3159 // This will trigger SetSink(NULL) if no OnClose() callback. | 3281 // This will trigger SetSink(NULL) if no OnClose() callback. |
3160 session_->SetAudioSend(send_ssrc, true, options, NULL); | 3282 session_->SetAudioSend(send_ssrc, true, options, NULL); |
3161 } | 3283 } |
3162 | 3284 |
3163 TEST_F(WebRtcSessionTest, SetVideoPlayout) { | 3285 TEST_F(WebRtcSessionTest, SetVideoPlayout) { |
3164 Init(); | 3286 Init(); |
3165 mediastream_signaling_.SendAudioVideoStream1(); | 3287 SendAudioVideoStream1(); |
3166 CreateAndSetRemoteOfferAndLocalAnswer(); | 3288 CreateAndSetRemoteOfferAndLocalAnswer(); |
3167 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); | 3289 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); |
3168 ASSERT_TRUE(channel != NULL); | 3290 ASSERT_TRUE(channel != NULL); |
3169 ASSERT_LT(0u, channel->renderers().size()); | 3291 ASSERT_LT(0u, channel->renderers().size()); |
3170 EXPECT_TRUE(channel->renderers().begin()->second == NULL); | 3292 EXPECT_TRUE(channel->renderers().begin()->second == NULL); |
3171 ASSERT_EQ(1u, channel->recv_streams().size()); | 3293 ASSERT_EQ(1u, channel->recv_streams().size()); |
3172 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc(); | 3294 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc(); |
3173 cricket::FakeVideoRenderer renderer; | 3295 cricket::FakeVideoRenderer renderer; |
3174 session_->SetVideoPlayout(receive_ssrc, true, &renderer); | 3296 session_->SetVideoPlayout(receive_ssrc, true, &renderer); |
3175 EXPECT_TRUE(channel->renderers().begin()->second == &renderer); | 3297 EXPECT_TRUE(channel->renderers().begin()->second == &renderer); |
3176 session_->SetVideoPlayout(receive_ssrc, false, &renderer); | 3298 session_->SetVideoPlayout(receive_ssrc, false, &renderer); |
3177 EXPECT_TRUE(channel->renderers().begin()->second == NULL); | 3299 EXPECT_TRUE(channel->renderers().begin()->second == NULL); |
3178 } | 3300 } |
3179 | 3301 |
3180 TEST_F(WebRtcSessionTest, SetVideoSend) { | 3302 TEST_F(WebRtcSessionTest, SetVideoSend) { |
3181 Init(); | 3303 Init(); |
3182 mediastream_signaling_.SendAudioVideoStream1(); | 3304 SendAudioVideoStream1(); |
3183 CreateAndSetRemoteOfferAndLocalAnswer(); | 3305 CreateAndSetRemoteOfferAndLocalAnswer(); |
3184 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); | 3306 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); |
3185 ASSERT_TRUE(channel != NULL); | 3307 ASSERT_TRUE(channel != NULL); |
3186 ASSERT_EQ(1u, channel->send_streams().size()); | 3308 ASSERT_EQ(1u, channel->send_streams().size()); |
3187 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); | 3309 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); |
3188 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); | 3310 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); |
3189 cricket::VideoOptions* options = NULL; | 3311 cricket::VideoOptions* options = NULL; |
3190 session_->SetVideoSend(send_ssrc, false, options); | 3312 session_->SetVideoSend(send_ssrc, false, options); |
3191 EXPECT_TRUE(channel->IsStreamMuted(send_ssrc)); | 3313 EXPECT_TRUE(channel->IsStreamMuted(send_ssrc)); |
3192 session_->SetVideoSend(send_ssrc, true, options); | 3314 session_->SetVideoSend(send_ssrc, true, options); |
3193 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); | 3315 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); |
3194 } | 3316 } |
3195 | 3317 |
3196 TEST_F(WebRtcSessionTest, CanNotInsertDtmf) { | 3318 TEST_F(WebRtcSessionTest, CanNotInsertDtmf) { |
3197 TestCanInsertDtmf(false); | 3319 TestCanInsertDtmf(false); |
3198 } | 3320 } |
3199 | 3321 |
3200 TEST_F(WebRtcSessionTest, CanInsertDtmf) { | 3322 TEST_F(WebRtcSessionTest, CanInsertDtmf) { |
3201 TestCanInsertDtmf(true); | 3323 TestCanInsertDtmf(true); |
3202 } | 3324 } |
3203 | 3325 |
3204 TEST_F(WebRtcSessionTest, InsertDtmf) { | 3326 TEST_F(WebRtcSessionTest, InsertDtmf) { |
3205 // Setup | 3327 // Setup |
3206 Init(); | 3328 Init(); |
3207 mediastream_signaling_.SendAudioVideoStream1(); | 3329 SendAudioVideoStream1(); |
3208 CreateAndSetRemoteOfferAndLocalAnswer(); | 3330 CreateAndSetRemoteOfferAndLocalAnswer(); |
3209 FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); | 3331 FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); |
3210 EXPECT_EQ(0U, channel->dtmf_info_queue().size()); | 3332 EXPECT_EQ(0U, channel->dtmf_info_queue().size()); |
3211 | 3333 |
3212 // Insert DTMF | 3334 // Insert DTMF |
3213 const int expected_flags = DF_SEND; | 3335 const int expected_flags = DF_SEND; |
3214 const int expected_duration = 90; | 3336 const int expected_duration = 90; |
3215 session_->InsertDtmf(kAudioTrack1, 0, expected_duration); | 3337 session_->InsertDtmf(kAudioTrack1, 0, expected_duration); |
3216 session_->InsertDtmf(kAudioTrack1, 1, expected_duration); | 3338 session_->InsertDtmf(kAudioTrack1, 1, expected_duration); |
3217 session_->InsertDtmf(kAudioTrack1, 2, expected_duration); | 3339 session_->InsertDtmf(kAudioTrack1, 2, expected_duration); |
(...skipping 30 matching lines...) Expand all Loading... |
3248 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 3370 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
3249 | 3371 |
3250 EXPECT_FALSE(session_->initiator()); | 3372 EXPECT_FALSE(session_->initiator()); |
3251 SetLocalDescriptionWithoutError(answer); | 3373 SetLocalDescriptionWithoutError(answer); |
3252 EXPECT_FALSE(session_->initiator()); | 3374 EXPECT_FALSE(session_->initiator()); |
3253 } | 3375 } |
3254 | 3376 |
3255 // Verifing local offer and remote answer have matching m-lines as per RFC 3264. | 3377 // Verifing local offer and remote answer have matching m-lines as per RFC 3264. |
3256 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) { | 3378 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) { |
3257 Init(); | 3379 Init(); |
3258 mediastream_signaling_.SendAudioVideoStream1(); | 3380 SendAudioVideoStream1(); |
3259 SessionDescriptionInterface* offer = CreateOffer(); | 3381 SessionDescriptionInterface* offer = CreateOffer(); |
3260 SetLocalDescriptionWithoutError(offer); | 3382 SetLocalDescriptionWithoutError(offer); |
3261 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 3383 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
3262 CreateRemoteAnswer(session_->local_description())); | 3384 CreateRemoteAnswer(session_->local_description())); |
3263 | 3385 |
3264 cricket::SessionDescription* answer_copy = answer->description()->Copy(); | 3386 cricket::SessionDescription* answer_copy = answer->description()->Copy(); |
3265 answer_copy->RemoveContentByName("video"); | 3387 answer_copy->RemoveContentByName("video"); |
3266 JsepSessionDescription* modified_answer = | 3388 JsepSessionDescription* modified_answer = |
3267 new JsepSessionDescription(JsepSessionDescription::kAnswer); | 3389 new JsepSessionDescription(JsepSessionDescription::kAnswer); |
3268 | 3390 |
(...skipping 27 matching lines...) Expand all Loading... |
3296 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); | 3418 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); |
3297 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer2); | 3419 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer2); |
3298 | 3420 |
3299 SetRemoteDescriptionWithoutError(answer.release()); | 3421 SetRemoteDescriptionWithoutError(answer.release()); |
3300 } | 3422 } |
3301 | 3423 |
3302 // Verifying remote offer and local answer have matching m-lines as per | 3424 // Verifying remote offer and local answer have matching m-lines as per |
3303 // RFC 3264. | 3425 // RFC 3264. |
3304 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) { | 3426 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) { |
3305 Init(); | 3427 Init(); |
3306 mediastream_signaling_.SendAudioVideoStream1(); | 3428 SendAudioVideoStream1(); |
3307 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 3429 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
3308 SetRemoteDescriptionWithoutError(offer); | 3430 SetRemoteDescriptionWithoutError(offer); |
3309 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 3431 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
3310 | 3432 |
3311 cricket::SessionDescription* answer_copy = answer->description()->Copy(); | 3433 cricket::SessionDescription* answer_copy = answer->description()->Copy(); |
3312 answer_copy->RemoveContentByName("video"); | 3434 answer_copy->RemoveContentByName("video"); |
3313 JsepSessionDescription* modified_answer = | 3435 JsepSessionDescription* modified_answer = |
3314 new JsepSessionDescription(JsepSessionDescription::kAnswer); | 3436 new JsepSessionDescription(JsepSessionDescription::kAnswer); |
3315 | 3437 |
3316 EXPECT_TRUE(modified_answer->Initialize(answer_copy, | 3438 EXPECT_TRUE(modified_answer->Initialize(answer_copy, |
3317 answer->session_id(), | 3439 answer->session_id(), |
3318 answer->session_version())); | 3440 answer->session_version())); |
3319 SetLocalDescriptionAnswerExpectError(kMlineMismatch, modified_answer); | 3441 SetLocalDescriptionAnswerExpectError(kMlineMismatch, modified_answer); |
3320 SetLocalDescriptionWithoutError(answer); | 3442 SetLocalDescriptionWithoutError(answer); |
3321 } | 3443 } |
3322 | 3444 |
3323 // This test verifies that WebRtcSession does not start candidate allocation | 3445 // This test verifies that WebRtcSession does not start candidate allocation |
3324 // before SetLocalDescription is called. | 3446 // before SetLocalDescription is called. |
3325 TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) { | 3447 TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) { |
3326 Init(); | 3448 Init(); |
3327 mediastream_signaling_.SendAudioVideoStream1(); | 3449 SendAudioVideoStream1(); |
3328 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 3450 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
3329 cricket::Candidate candidate; | 3451 cricket::Candidate candidate; |
3330 candidate.set_component(1); | 3452 candidate.set_component(1); |
3331 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0, | 3453 JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0, |
3332 candidate); | 3454 candidate); |
3333 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); | 3455 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); |
3334 cricket::Candidate candidate1; | 3456 cricket::Candidate candidate1; |
3335 candidate1.set_component(1); | 3457 candidate1.set_component(1); |
3336 JsepIceCandidate ice_candidate1(kMediaContentName1, kMediaContentIndex1, | 3458 JsepIceCandidate ice_candidate1(kMediaContentName1, kMediaContentIndex1, |
3337 candidate1); | 3459 candidate1); |
3338 EXPECT_TRUE(offer->AddCandidate(&ice_candidate1)); | 3460 EXPECT_TRUE(offer->AddCandidate(&ice_candidate1)); |
3339 SetRemoteDescriptionWithoutError(offer); | 3461 SetRemoteDescriptionWithoutError(offer); |
3340 ASSERT_TRUE(session_->voice_rtp_transport_channel() != NULL); | 3462 ASSERT_TRUE(session_->voice_rtp_transport_channel() != NULL); |
3341 ASSERT_TRUE(session_->video_rtp_transport_channel() != NULL); | 3463 ASSERT_TRUE(session_->video_rtp_transport_channel() != NULL); |
3342 | 3464 |
3343 // Pump for 1 second and verify that no candidates are generated. | 3465 // Pump for 1 second and verify that no candidates are generated. |
3344 rtc::Thread::Current()->ProcessMessages(1000); | 3466 rtc::Thread::Current()->ProcessMessages(1000); |
3345 EXPECT_TRUE(observer_.mline_0_candidates_.empty()); | 3467 EXPECT_TRUE(observer_.mline_0_candidates_.empty()); |
3346 EXPECT_TRUE(observer_.mline_1_candidates_.empty()); | 3468 EXPECT_TRUE(observer_.mline_1_candidates_.empty()); |
3347 | 3469 |
3348 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 3470 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
3349 SetLocalDescriptionWithoutError(answer); | 3471 SetLocalDescriptionWithoutError(answer); |
3350 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 3472 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
3351 } | 3473 } |
3352 | 3474 |
3353 // This test verifies that crypto parameter is updated in local session | 3475 // This test verifies that crypto parameter is updated in local session |
3354 // description as per security policy set in MediaSessionDescriptionFactory. | 3476 // description as per security policy set in MediaSessionDescriptionFactory. |
3355 TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) { | 3477 TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) { |
3356 Init(); | 3478 Init(); |
3357 mediastream_signaling_.SendAudioVideoStream1(); | 3479 SendAudioVideoStream1(); |
3358 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3480 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
3359 | 3481 |
3360 // Making sure SetLocalDescription correctly sets crypto value in | 3482 // Making sure SetLocalDescription correctly sets crypto value in |
3361 // SessionDescription object after de-serialization of sdp string. The value | 3483 // SessionDescription object after de-serialization of sdp string. The value |
3362 // will be set as per MediaSessionDescriptionFactory. | 3484 // will be set as per MediaSessionDescriptionFactory. |
3363 std::string offer_str; | 3485 std::string offer_str; |
3364 offer->ToString(&offer_str); | 3486 offer->ToString(&offer_str); |
3365 SessionDescriptionInterface* jsep_offer_str = | 3487 SessionDescriptionInterface* jsep_offer_str = |
3366 CreateSessionDescription(JsepSessionDescription::kOffer, offer_str, NULL); | 3488 CreateSessionDescription(JsepSessionDescription::kOffer, offer_str, NULL); |
3367 SetLocalDescriptionWithoutError(jsep_offer_str); | 3489 SetLocalDescriptionWithoutError(jsep_offer_str); |
3368 EXPECT_TRUE(session_->voice_channel()->secure_required()); | 3490 EXPECT_TRUE(session_->voice_channel()->secure_required()); |
3369 EXPECT_TRUE(session_->video_channel()->secure_required()); | 3491 EXPECT_TRUE(session_->video_channel()->secure_required()); |
3370 } | 3492 } |
3371 | 3493 |
3372 // This test verifies the crypto parameter when security is disabled. | 3494 // This test verifies the crypto parameter when security is disabled. |
3373 TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) { | 3495 TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) { |
3374 options_.disable_encryption = true; | 3496 options_.disable_encryption = true; |
3375 Init(); | 3497 Init(); |
3376 mediastream_signaling_.SendAudioVideoStream1(); | 3498 SendAudioVideoStream1(); |
3377 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3499 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
3378 | 3500 |
3379 // Making sure SetLocalDescription correctly sets crypto value in | 3501 // Making sure SetLocalDescription correctly sets crypto value in |
3380 // SessionDescription object after de-serialization of sdp string. The value | 3502 // SessionDescription object after de-serialization of sdp string. The value |
3381 // will be set as per MediaSessionDescriptionFactory. | 3503 // will be set as per MediaSessionDescriptionFactory. |
3382 std::string offer_str; | 3504 std::string offer_str; |
3383 offer->ToString(&offer_str); | 3505 offer->ToString(&offer_str); |
3384 SessionDescriptionInterface* jsep_offer_str = | 3506 SessionDescriptionInterface* jsep_offer_str = |
3385 CreateSessionDescription(JsepSessionDescription::kOffer, offer_str, NULL); | 3507 CreateSessionDescription(JsepSessionDescription::kOffer, offer_str, NULL); |
3386 SetLocalDescriptionWithoutError(jsep_offer_str); | 3508 SetLocalDescriptionWithoutError(jsep_offer_str); |
3387 EXPECT_FALSE(session_->voice_channel()->secure_required()); | 3509 EXPECT_FALSE(session_->voice_channel()->secure_required()); |
3388 EXPECT_FALSE(session_->video_channel()->secure_required()); | 3510 EXPECT_FALSE(session_->video_channel()->secure_required()); |
3389 } | 3511 } |
3390 | 3512 |
3391 // This test verifies that an answer contains new ufrag and password if an offer | 3513 // This test verifies that an answer contains new ufrag and password if an offer |
3392 // with new ufrag and password is received. | 3514 // with new ufrag and password is received. |
3393 TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) { | 3515 TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) { |
3394 Init(); | 3516 Init(); |
3395 cricket::MediaSessionOptions options; | 3517 cricket::MediaSessionOptions options; |
3396 options.recv_video = true; | 3518 options.recv_video = true; |
3397 rtc::scoped_ptr<JsepSessionDescription> offer( | 3519 rtc::scoped_ptr<JsepSessionDescription> offer( |
3398 CreateRemoteOffer(options)); | 3520 CreateRemoteOffer(options)); |
3399 SetRemoteDescriptionWithoutError(offer.release()); | 3521 SetRemoteDescriptionWithoutError(offer.release()); |
3400 | 3522 |
3401 mediastream_signaling_.SendAudioVideoStream1(); | 3523 SendAudioVideoStream1(); |
3402 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 3524 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
3403 CreateAnswer(NULL)); | 3525 CreateAnswer(NULL)); |
3404 SetLocalDescriptionWithoutError(answer.release()); | 3526 SetLocalDescriptionWithoutError(answer.release()); |
3405 | 3527 |
3406 // Receive an offer with new ufrag and password. | 3528 // Receive an offer with new ufrag and password. |
3407 options.transport_options.ice_restart = true; | 3529 options.transport_options.ice_restart = true; |
3408 rtc::scoped_ptr<JsepSessionDescription> updated_offer1( | 3530 rtc::scoped_ptr<JsepSessionDescription> updated_offer1( |
3409 CreateRemoteOffer(options, session_->remote_description())); | 3531 CreateRemoteOffer(options, session_->remote_description())); |
3410 SetRemoteDescriptionWithoutError(updated_offer1.release()); | 3532 SetRemoteDescriptionWithoutError(updated_offer1.release()); |
3411 | 3533 |
(...skipping 10 matching lines...) Expand all Loading... |
3422 // This test verifies that an answer contains old ufrag and password if an offer | 3544 // This test verifies that an answer contains old ufrag and password if an offer |
3423 // with old ufrag and password is received. | 3545 // with old ufrag and password is received. |
3424 TEST_F(WebRtcSessionTest, TestCreateAnswerWithOldUfragAndPassword) { | 3546 TEST_F(WebRtcSessionTest, TestCreateAnswerWithOldUfragAndPassword) { |
3425 Init(); | 3547 Init(); |
3426 cricket::MediaSessionOptions options; | 3548 cricket::MediaSessionOptions options; |
3427 options.recv_video = true; | 3549 options.recv_video = true; |
3428 rtc::scoped_ptr<JsepSessionDescription> offer( | 3550 rtc::scoped_ptr<JsepSessionDescription> offer( |
3429 CreateRemoteOffer(options)); | 3551 CreateRemoteOffer(options)); |
3430 SetRemoteDescriptionWithoutError(offer.release()); | 3552 SetRemoteDescriptionWithoutError(offer.release()); |
3431 | 3553 |
3432 mediastream_signaling_.SendAudioVideoStream1(); | 3554 SendAudioVideoStream1(); |
3433 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 3555 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
3434 CreateAnswer(NULL)); | 3556 CreateAnswer(NULL)); |
3435 SetLocalDescriptionWithoutError(answer.release()); | 3557 SetLocalDescriptionWithoutError(answer.release()); |
3436 | 3558 |
3437 // Receive an offer without changed ufrag or password. | 3559 // Receive an offer without changed ufrag or password. |
3438 options.transport_options.ice_restart = false; | 3560 options.transport_options.ice_restart = false; |
3439 rtc::scoped_ptr<JsepSessionDescription> updated_offer2( | 3561 rtc::scoped_ptr<JsepSessionDescription> updated_offer2( |
3440 CreateRemoteOffer(options, session_->remote_description())); | 3562 CreateRemoteOffer(options, session_->remote_description())); |
3441 SetRemoteDescriptionWithoutError(updated_offer2.release()); | 3563 SetRemoteDescriptionWithoutError(updated_offer2.release()); |
3442 | 3564 |
3443 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2( | 3565 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2( |
3444 CreateAnswer(NULL)); | 3566 CreateAnswer(NULL)); |
3445 | 3567 |
3446 CompareIceUfragAndPassword(updated_answer2->description(), | 3568 CompareIceUfragAndPassword(updated_answer2->description(), |
3447 session_->local_description()->description(), | 3569 session_->local_description()->description(), |
3448 true); | 3570 true); |
3449 | 3571 |
3450 SetLocalDescriptionWithoutError(updated_answer2.release()); | 3572 SetLocalDescriptionWithoutError(updated_answer2.release()); |
3451 } | 3573 } |
3452 | 3574 |
3453 TEST_F(WebRtcSessionTest, TestSessionContentError) { | 3575 TEST_F(WebRtcSessionTest, TestSessionContentError) { |
3454 Init(); | 3576 Init(); |
3455 mediastream_signaling_.SendAudioVideoStream1(); | 3577 SendAudioVideoStream1(); |
3456 SessionDescriptionInterface* offer = CreateOffer(); | 3578 SessionDescriptionInterface* offer = CreateOffer(); |
3457 const std::string session_id_orig = offer->session_id(); | 3579 const std::string session_id_orig = offer->session_id(); |
3458 const std::string session_version_orig = offer->session_version(); | 3580 const std::string session_version_orig = offer->session_version(); |
3459 SetLocalDescriptionWithoutError(offer); | 3581 SetLocalDescriptionWithoutError(offer); |
3460 | 3582 |
3461 video_channel_ = media_engine_->GetVideoChannel(0); | 3583 video_channel_ = media_engine_->GetVideoChannel(0); |
3462 video_channel_->set_fail_set_send_codecs(true); | 3584 video_channel_->set_fail_set_send_codecs(true); |
3463 | 3585 |
3464 mediastream_signaling_.SendAudioVideoStream2(); | 3586 SendAudioVideoStream2(); |
3465 SessionDescriptionInterface* answer = | 3587 SessionDescriptionInterface* answer = |
3466 CreateRemoteAnswer(session_->local_description()); | 3588 CreateRemoteAnswer(session_->local_description()); |
3467 SetRemoteDescriptionAnswerExpectError("ERROR_CONTENT", answer); | 3589 SetRemoteDescriptionAnswerExpectError("ERROR_CONTENT", answer); |
3468 } | 3590 } |
3469 | 3591 |
3470 // Runs the loopback call test with BUNDLE and STUN disabled. | 3592 // Runs the loopback call test with BUNDLE and STUN disabled. |
3471 TEST_F(WebRtcSessionTest, TestIceStatesBasic) { | 3593 TEST_F(WebRtcSessionTest, TestIceStatesBasic) { |
3472 // Lets try with only UDP ports. | 3594 // Lets try with only UDP ports. |
3473 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | | 3595 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | |
3474 cricket::PORTALLOCATOR_DISABLE_STUN | | 3596 cricket::PORTALLOCATOR_DISABLE_STUN | |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3622 | 3744 |
3623 SessionDescriptionInterface* answer = ChangeSDPSctpPort( | 3745 SessionDescriptionInterface* answer = ChangeSDPSctpPort( |
3624 new_recv_port, CreateAnswer(NULL)); | 3746 new_recv_port, CreateAnswer(NULL)); |
3625 ASSERT_TRUE(answer != NULL); | 3747 ASSERT_TRUE(answer != NULL); |
3626 | 3748 |
3627 // Now set the local description, which'll take ownership of the answer. | 3749 // Now set the local description, which'll take ownership of the answer. |
3628 SetLocalDescriptionWithoutError(answer); | 3750 SetLocalDescriptionWithoutError(answer); |
3629 | 3751 |
3630 // TEST PLAN: Set the port number to something new, set it in the SDP, | 3752 // TEST PLAN: Set the port number to something new, set it in the SDP, |
3631 // and pass it all the way down. | 3753 // and pass it all the way down. |
3632 webrtc::InternalDataChannelInit dci; | |
3633 dci.reliable = true; | |
3634 EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type()); | 3754 EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type()); |
3635 rtc::scoped_refptr<webrtc::DataChannel> dc = | 3755 CreateDataChannel(); |
3636 session_->CreateDataChannel("datachannel", &dci); | |
3637 | 3756 |
3638 cricket::FakeDataMediaChannel* ch = data_engine_->GetChannel(0); | 3757 cricket::FakeDataMediaChannel* ch = data_engine_->GetChannel(0); |
3639 int portnum = -1; | 3758 int portnum = -1; |
3640 ASSERT_TRUE(ch != NULL); | 3759 ASSERT_TRUE(ch != NULL); |
3641 ASSERT_EQ(1UL, ch->send_codecs().size()); | 3760 ASSERT_EQ(1UL, ch->send_codecs().size()); |
3642 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->send_codecs()[0].id); | 3761 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->send_codecs()[0].id); |
3643 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, | 3762 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, |
3644 ch->send_codecs()[0].name.c_str())); | 3763 ch->send_codecs()[0].name.c_str())); |
3645 EXPECT_TRUE(ch->send_codecs()[0].GetParam(cricket::kCodecParamPort, | 3764 EXPECT_TRUE(ch->send_codecs()[0].GetParam(cricket::kCodecParamPort, |
3646 &portnum)); | 3765 &portnum)); |
3647 EXPECT_EQ(new_send_port, portnum); | 3766 EXPECT_EQ(new_send_port, portnum); |
3648 | 3767 |
3649 ASSERT_EQ(1UL, ch->recv_codecs().size()); | 3768 ASSERT_EQ(1UL, ch->recv_codecs().size()); |
3650 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); | 3769 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); |
3651 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, | 3770 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, |
3652 ch->recv_codecs()[0].name.c_str())); | 3771 ch->recv_codecs()[0].name.c_str())); |
3653 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, | 3772 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, |
3654 &portnum)); | 3773 &portnum)); |
3655 EXPECT_EQ(new_recv_port, portnum); | 3774 EXPECT_EQ(new_recv_port, portnum); |
3656 } | 3775 } |
3657 | 3776 |
3658 TEST_F(WebRtcSessionTest, TestUsesProvidedCertificate) { | 3777 // Verifies that when a session's DataChannel receives an OPEN message, |
| 3778 // WebRtcSession signals the DataChannel creation request with the expected |
| 3779 // config. |
| 3780 TEST_P(WebRtcSessionTest, TestSctpDataChannelOpenMessage) { |
| 3781 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3782 |
| 3783 InitWithDtls(GetParam()); |
| 3784 |
| 3785 SetLocalDescriptionWithDataChannel(); |
| 3786 EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type()); |
| 3787 |
| 3788 webrtc::DataChannelInit config; |
| 3789 config.id = 1; |
| 3790 rtc::Buffer payload; |
| 3791 webrtc::WriteDataChannelOpenMessage("a", config, &payload); |
| 3792 cricket::ReceiveDataParams params; |
| 3793 params.ssrc = config.id; |
| 3794 params.type = cricket::DMT_CONTROL; |
| 3795 |
| 3796 cricket::DataChannel* data_channel = session_->data_channel(); |
| 3797 data_channel->SignalDataReceived(data_channel, params, payload); |
| 3798 |
| 3799 EXPECT_EQ("a", last_data_channel_label_); |
| 3800 EXPECT_EQ(config.id, last_data_channel_config_.id); |
| 3801 EXPECT_FALSE(last_data_channel_config_.negotiated); |
| 3802 EXPECT_EQ(webrtc::InternalDataChannelInit::kAcker, |
| 3803 last_data_channel_config_.open_handshake_role); |
| 3804 } |
| 3805 |
| 3806 TEST_P(WebRtcSessionTest, TestUsesProvidedCertificate) { |
3659 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 3807 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
3660 FakeDtlsIdentityStore::GenerateCertificate(); | 3808 FakeDtlsIdentityStore::GenerateCertificate(); |
3661 | 3809 |
3662 PeerConnectionInterface::RTCConfiguration configuration; | 3810 PeerConnectionInterface::RTCConfiguration configuration; |
3663 configuration.certificates.push_back(certificate); | 3811 configuration.certificates.push_back(certificate); |
3664 Init(nullptr, configuration); | 3812 Init(nullptr, configuration); |
3665 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); | 3813 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); |
3666 | 3814 |
3667 EXPECT_EQ(session_->certificate_for_testing(), certificate); | 3815 EXPECT_EQ(session_->certificate_for_testing(), certificate); |
3668 } | 3816 } |
3669 | 3817 |
3670 // Verifies that CreateOffer succeeds when CreateOffer is called before async | 3818 // Verifies that CreateOffer succeeds when CreateOffer is called before async |
3671 // identity generation is finished (even if a certificate is provided this is | 3819 // identity generation is finished (even if a certificate is provided this is |
3672 // an async op). | 3820 // an async op). |
3673 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { | 3821 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { |
3674 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3822 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3675 InitWithDtls(GetParam()); | 3823 InitWithDtls(GetParam()); |
3676 | 3824 |
3677 EXPECT_TRUE(session_->waiting_for_certificate_for_testing()); | 3825 EXPECT_TRUE(session_->waiting_for_certificate_for_testing()); |
3678 mediastream_signaling_.SendAudioVideoStream1(); | 3826 SendAudioVideoStream1(); |
3679 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3827 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
3680 | 3828 |
3681 EXPECT_TRUE(offer != NULL); | 3829 EXPECT_TRUE(offer != NULL); |
3682 VerifyNoCryptoParams(offer->description(), true); | 3830 VerifyNoCryptoParams(offer->description(), true); |
3683 VerifyFingerprintStatus(offer->description(), true); | 3831 VerifyFingerprintStatus(offer->description(), true); |
3684 } | 3832 } |
3685 | 3833 |
3686 // Verifies that CreateAnswer succeeds when CreateOffer is called before async | 3834 // Verifies that CreateAnswer succeeds when CreateOffer is called before async |
3687 // identity generation is finished (even if a certificate is provided this is | 3835 // identity generation is finished (even if a certificate is provided this is |
3688 // an async op). | 3836 // an async op). |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3785 SetRemoteDescriptionOfferExpectError(kSdpWithoutSdesCrypto, | 3933 SetRemoteDescriptionOfferExpectError(kSdpWithoutSdesCrypto, |
3786 offer); | 3934 offer); |
3787 } | 3935 } |
3788 | 3936 |
3789 // This test verifies DSCP is properly applied on the media channels. | 3937 // This test verifies DSCP is properly applied on the media channels. |
3790 TEST_F(WebRtcSessionTest, TestDscpConstraint) { | 3938 TEST_F(WebRtcSessionTest, TestDscpConstraint) { |
3791 constraints_.reset(new FakeConstraints()); | 3939 constraints_.reset(new FakeConstraints()); |
3792 constraints_->AddOptional( | 3940 constraints_->AddOptional( |
3793 webrtc::MediaConstraintsInterface::kEnableDscp, true); | 3941 webrtc::MediaConstraintsInterface::kEnableDscp, true); |
3794 Init(); | 3942 Init(); |
3795 mediastream_signaling_.SendAudioVideoStream1(); | 3943 SendAudioVideoStream1(); |
3796 SessionDescriptionInterface* offer = CreateOffer(); | 3944 SessionDescriptionInterface* offer = CreateOffer(); |
3797 | 3945 |
3798 SetLocalDescriptionWithoutError(offer); | 3946 SetLocalDescriptionWithoutError(offer); |
3799 | 3947 |
3800 video_channel_ = media_engine_->GetVideoChannel(0); | 3948 video_channel_ = media_engine_->GetVideoChannel(0); |
3801 voice_channel_ = media_engine_->GetVoiceChannel(0); | 3949 voice_channel_ = media_engine_->GetVoiceChannel(0); |
3802 | 3950 |
3803 ASSERT_TRUE(video_channel_ != NULL); | 3951 ASSERT_TRUE(video_channel_ != NULL); |
3804 ASSERT_TRUE(voice_channel_ != NULL); | 3952 ASSERT_TRUE(voice_channel_ != NULL); |
3805 const cricket::AudioOptions& audio_options = voice_channel_->options(); | 3953 const cricket::AudioOptions& audio_options = voice_channel_->options(); |
3806 const cricket::VideoOptions& video_options = video_channel_->options(); | 3954 const cricket::VideoOptions& video_options = video_channel_->options(); |
3807 EXPECT_TRUE(audio_options.dscp.IsSet()); | 3955 EXPECT_TRUE(audio_options.dscp.IsSet()); |
3808 EXPECT_TRUE(audio_options.dscp.GetWithDefaultIfUnset(false)); | 3956 EXPECT_TRUE(audio_options.dscp.GetWithDefaultIfUnset(false)); |
3809 EXPECT_TRUE(video_options.dscp.IsSet()); | 3957 EXPECT_TRUE(video_options.dscp.IsSet()); |
3810 EXPECT_TRUE(video_options.dscp.GetWithDefaultIfUnset(false)); | 3958 EXPECT_TRUE(video_options.dscp.GetWithDefaultIfUnset(false)); |
3811 } | 3959 } |
3812 | 3960 |
3813 TEST_F(WebRtcSessionTest, TestSuspendBelowMinBitrateConstraint) { | 3961 TEST_F(WebRtcSessionTest, TestSuspendBelowMinBitrateConstraint) { |
3814 constraints_.reset(new FakeConstraints()); | 3962 constraints_.reset(new FakeConstraints()); |
3815 constraints_->AddOptional( | 3963 constraints_->AddOptional( |
3816 webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, | 3964 webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, |
3817 true); | 3965 true); |
3818 Init(); | 3966 Init(); |
3819 mediastream_signaling_.SendAudioVideoStream1(); | 3967 SendAudioVideoStream1(); |
3820 SessionDescriptionInterface* offer = CreateOffer(); | 3968 SessionDescriptionInterface* offer = CreateOffer(); |
3821 | 3969 |
3822 SetLocalDescriptionWithoutError(offer); | 3970 SetLocalDescriptionWithoutError(offer); |
3823 | 3971 |
3824 video_channel_ = media_engine_->GetVideoChannel(0); | 3972 video_channel_ = media_engine_->GetVideoChannel(0); |
3825 | 3973 |
3826 ASSERT_TRUE(video_channel_ != NULL); | 3974 ASSERT_TRUE(video_channel_ != NULL); |
3827 const cricket::VideoOptions& video_options = video_channel_->options(); | 3975 const cricket::VideoOptions& video_options = video_channel_->options(); |
3828 EXPECT_TRUE( | 3976 EXPECT_TRUE( |
3829 video_options.suspend_below_min_bitrate.GetWithDefaultIfUnset(false)); | 3977 video_options.suspend_below_min_bitrate.GetWithDefaultIfUnset(false)); |
3830 } | 3978 } |
3831 | 3979 |
3832 TEST_F(WebRtcSessionTest, TestNumUnsignalledRecvStreamsConstraint) { | 3980 TEST_F(WebRtcSessionTest, TestNumUnsignalledRecvStreamsConstraint) { |
3833 // Number of unsignalled receiving streams should be between 0 and | 3981 // Number of unsignalled receiving streams should be between 0 and |
3834 // kMaxUnsignalledRecvStreams. | 3982 // kMaxUnsignalledRecvStreams. |
3835 SetAndVerifyNumUnsignalledRecvStreams(10, 10); | 3983 SetAndVerifyNumUnsignalledRecvStreams(10, 10); |
3836 SetAndVerifyNumUnsignalledRecvStreams(kMaxUnsignalledRecvStreams + 1, | 3984 SetAndVerifyNumUnsignalledRecvStreams(kMaxUnsignalledRecvStreams + 1, |
3837 kMaxUnsignalledRecvStreams); | 3985 kMaxUnsignalledRecvStreams); |
3838 SetAndVerifyNumUnsignalledRecvStreams(-1, 0); | 3986 SetAndVerifyNumUnsignalledRecvStreams(-1, 0); |
3839 } | 3987 } |
3840 | 3988 |
3841 TEST_F(WebRtcSessionTest, TestCombinedAudioVideoBweConstraint) { | 3989 TEST_F(WebRtcSessionTest, TestCombinedAudioVideoBweConstraint) { |
3842 constraints_.reset(new FakeConstraints()); | 3990 constraints_.reset(new FakeConstraints()); |
3843 constraints_->AddOptional( | 3991 constraints_->AddOptional( |
3844 webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe, | 3992 webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe, |
3845 true); | 3993 true); |
3846 Init(); | 3994 Init(); |
3847 mediastream_signaling_.SendAudioVideoStream1(); | 3995 SendAudioVideoStream1(); |
3848 SessionDescriptionInterface* offer = CreateOffer(); | 3996 SessionDescriptionInterface* offer = CreateOffer(); |
3849 | 3997 |
3850 SetLocalDescriptionWithoutError(offer); | 3998 SetLocalDescriptionWithoutError(offer); |
3851 | 3999 |
3852 voice_channel_ = media_engine_->GetVoiceChannel(0); | 4000 voice_channel_ = media_engine_->GetVoiceChannel(0); |
3853 | 4001 |
3854 ASSERT_TRUE(voice_channel_ != NULL); | 4002 ASSERT_TRUE(voice_channel_ != NULL); |
3855 const cricket::AudioOptions& audio_options = voice_channel_->options(); | 4003 const cricket::AudioOptions& audio_options = voice_channel_->options(); |
3856 EXPECT_TRUE( | 4004 EXPECT_TRUE( |
3857 audio_options.combined_audio_video_bwe.GetWithDefaultIfUnset(false)); | 4005 audio_options.combined_audio_video_bwe.GetWithDefaultIfUnset(false)); |
3858 } | 4006 } |
3859 | 4007 |
3860 // Tests that we can renegotiate new media content with ICE candidates in the | 4008 // Tests that we can renegotiate new media content with ICE candidates in the |
3861 // new remote SDP. | 4009 // new remote SDP. |
3862 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { | 4010 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { |
3863 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 4011 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3864 InitWithDtls(GetParam()); | 4012 InitWithDtls(GetParam()); |
3865 SetFactoryDtlsSrtp(); | 4013 SetFactoryDtlsSrtp(); |
3866 | 4014 |
3867 mediastream_signaling_.UseOptionsAudioOnly(); | 4015 SendAudioOnlyStream2(); |
3868 SessionDescriptionInterface* offer = CreateOffer(); | 4016 SessionDescriptionInterface* offer = CreateOffer(); |
3869 SetLocalDescriptionWithoutError(offer); | 4017 SetLocalDescriptionWithoutError(offer); |
3870 | 4018 |
3871 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); | 4019 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); |
3872 SetRemoteDescriptionWithoutError(answer); | 4020 SetRemoteDescriptionWithoutError(answer); |
3873 | 4021 |
3874 cricket::MediaSessionOptions options; | 4022 cricket::MediaSessionOptions options; |
3875 options.recv_video = true; | 4023 options.recv_video = true; |
3876 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); | 4024 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); |
3877 | 4025 |
3878 cricket::Candidate candidate1; | 4026 cricket::Candidate candidate1; |
3879 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4027 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
3880 candidate1.set_component(1); | 4028 candidate1.set_component(1); |
3881 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4029 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
3882 candidate1); | 4030 candidate1); |
3883 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); | 4031 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); |
3884 SetRemoteDescriptionWithoutError(offer); | 4032 SetRemoteDescriptionWithoutError(offer); |
3885 | 4033 |
3886 answer = CreateAnswer(NULL); | 4034 answer = CreateAnswer(NULL); |
3887 SetLocalDescriptionWithoutError(answer); | 4035 SetLocalDescriptionWithoutError(answer); |
3888 } | 4036 } |
3889 | 4037 |
3890 // Tests that we can renegotiate new media content with ICE candidates separated | 4038 // Tests that we can renegotiate new media content with ICE candidates separated |
3891 // from the remote SDP. | 4039 // from the remote SDP. |
3892 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) { | 4040 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) { |
3893 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 4041 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3894 InitWithDtls(GetParam()); | 4042 InitWithDtls(GetParam()); |
3895 SetFactoryDtlsSrtp(); | 4043 SetFactoryDtlsSrtp(); |
3896 | 4044 |
3897 mediastream_signaling_.UseOptionsAudioOnly(); | 4045 SendAudioOnlyStream2(); |
3898 SessionDescriptionInterface* offer = CreateOffer(); | 4046 SessionDescriptionInterface* offer = CreateOffer(); |
3899 SetLocalDescriptionWithoutError(offer); | 4047 SetLocalDescriptionWithoutError(offer); |
3900 | 4048 |
3901 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); | 4049 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); |
3902 SetRemoteDescriptionWithoutError(answer); | 4050 SetRemoteDescriptionWithoutError(answer); |
3903 | 4051 |
3904 cricket::MediaSessionOptions options; | 4052 cricket::MediaSessionOptions options; |
3905 options.recv_video = true; | 4053 options.recv_video = true; |
3906 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); | 4054 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); |
3907 SetRemoteDescriptionWithoutError(offer); | 4055 SetRemoteDescriptionWithoutError(offer); |
3908 | 4056 |
3909 cricket::Candidate candidate1; | 4057 cricket::Candidate candidate1; |
3910 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 4058 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
3911 candidate1.set_component(1); | 4059 candidate1.set_component(1); |
3912 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 4060 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
3913 candidate1); | 4061 candidate1); |
3914 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); | 4062 EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate)); |
3915 | 4063 |
3916 answer = CreateAnswer(NULL); | 4064 answer = CreateAnswer(NULL); |
3917 SetLocalDescriptionWithoutError(answer); | 4065 SetLocalDescriptionWithoutError(answer); |
3918 } | 4066 } |
3919 // Tests that RTX codec is removed from the answer when it isn't supported | 4067 // Tests that RTX codec is removed from the answer when it isn't supported |
3920 // by local side. | 4068 // by local side. |
3921 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { | 4069 TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) { |
3922 Init(); | 4070 Init(); |
3923 mediastream_signaling_.SendAudioVideoStream1(); | 4071 SendAudioVideoStream1(); |
3924 std::string offer_sdp(kSdpWithRtx); | 4072 std::string offer_sdp(kSdpWithRtx); |
3925 | 4073 |
3926 SessionDescriptionInterface* offer = | 4074 SessionDescriptionInterface* offer = |
3927 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); | 4075 CreateSessionDescription(JsepSessionDescription::kOffer, offer_sdp, NULL); |
3928 EXPECT_TRUE(offer->ToString(&offer_sdp)); | 4076 EXPECT_TRUE(offer->ToString(&offer_sdp)); |
3929 | 4077 |
3930 // Offer SDP contains the RTX codec. | 4078 // Offer SDP contains the RTX codec. |
3931 EXPECT_TRUE(offer_sdp.find("rtx") != std::string::npos); | 4079 EXPECT_TRUE(offer_sdp.find("rtx") != std::string::npos); |
3932 SetRemoteDescriptionWithoutError(offer); | 4080 SetRemoteDescriptionWithoutError(offer); |
3933 | 4081 |
3934 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 4082 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
3935 std::string answer_sdp; | 4083 std::string answer_sdp; |
3936 answer->ToString(&answer_sdp); | 4084 answer->ToString(&answer_sdp); |
3937 // Answer SDP removes the unsupported RTX codec. | 4085 // Answer SDP removes the unsupported RTX codec. |
3938 EXPECT_TRUE(answer_sdp.find("rtx") == std::string::npos); | 4086 EXPECT_TRUE(answer_sdp.find("rtx") == std::string::npos); |
3939 SetLocalDescriptionWithoutError(answer); | 4087 SetLocalDescriptionWithoutError(answer); |
3940 } | 4088 } |
3941 | 4089 |
3942 // This verifies that the voice channel after bundle has both options from video | 4090 // This verifies that the voice channel after bundle has both options from video |
3943 // and voice channels. | 4091 // and voice channels. |
3944 TEST_F(WebRtcSessionTest, TestSetSocketOptionBeforeBundle) { | 4092 TEST_F(WebRtcSessionTest, TestSetSocketOptionBeforeBundle) { |
3945 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); | 4093 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); |
3946 mediastream_signaling_.SendAudioVideoStream1(); | 4094 SendAudioVideoStream1(); |
3947 | 4095 |
3948 PeerConnectionInterface::RTCOfferAnswerOptions options; | 4096 PeerConnectionInterface::RTCOfferAnswerOptions options; |
3949 options.use_rtp_mux = true; | 4097 options.use_rtp_mux = true; |
3950 | 4098 |
3951 SessionDescriptionInterface* offer = CreateOffer(options); | 4099 SessionDescriptionInterface* offer = CreateOffer(options); |
3952 SetLocalDescriptionWithoutError(offer); | 4100 SetLocalDescriptionWithoutError(offer); |
3953 | 4101 |
3954 session_->video_channel()->SetOption(cricket::BaseChannel::ST_RTP, | 4102 session_->video_channel()->SetOption(cricket::BaseChannel::ST_RTP, |
3955 rtc::Socket::Option::OPT_SNDBUF, 4000); | 4103 rtc::Socket::Option::OPT_SNDBUF, 4000); |
3956 | 4104 |
3957 session_->voice_channel()->SetOption(cricket::BaseChannel::ST_RTP, | 4105 session_->voice_channel()->SetOption(cricket::BaseChannel::ST_RTP, |
3958 rtc::Socket::Option::OPT_RCVBUF, 8000); | 4106 rtc::Socket::Option::OPT_RCVBUF, 8000); |
3959 | 4107 |
3960 int option_val; | 4108 int option_val; |
3961 EXPECT_TRUE(session_->video_rtp_transport_channel()->GetOption( | 4109 EXPECT_TRUE(session_->video_rtp_transport_channel()->GetOption( |
3962 rtc::Socket::Option::OPT_SNDBUF, &option_val)); | 4110 rtc::Socket::Option::OPT_SNDBUF, &option_val)); |
3963 EXPECT_EQ(4000, option_val); | 4111 EXPECT_EQ(4000, option_val); |
3964 EXPECT_FALSE(session_->voice_rtp_transport_channel()->GetOption( | 4112 EXPECT_FALSE(session_->voice_rtp_transport_channel()->GetOption( |
3965 rtc::Socket::Option::OPT_SNDBUF, &option_val)); | 4113 rtc::Socket::Option::OPT_SNDBUF, &option_val)); |
3966 | 4114 |
3967 EXPECT_TRUE(session_->voice_rtp_transport_channel()->GetOption( | 4115 EXPECT_TRUE(session_->voice_rtp_transport_channel()->GetOption( |
3968 rtc::Socket::Option::OPT_RCVBUF, &option_val)); | 4116 rtc::Socket::Option::OPT_RCVBUF, &option_val)); |
3969 EXPECT_EQ(8000, option_val); | 4117 EXPECT_EQ(8000, option_val); |
3970 EXPECT_FALSE(session_->video_rtp_transport_channel()->GetOption( | 4118 EXPECT_FALSE(session_->video_rtp_transport_channel()->GetOption( |
3971 rtc::Socket::Option::OPT_RCVBUF, &option_val)); | 4119 rtc::Socket::Option::OPT_RCVBUF, &option_val)); |
3972 | 4120 |
3973 EXPECT_NE(session_->voice_rtp_transport_channel(), | 4121 EXPECT_NE(session_->voice_rtp_transport_channel(), |
3974 session_->video_rtp_transport_channel()); | 4122 session_->video_rtp_transport_channel()); |
3975 | 4123 |
3976 mediastream_signaling_.SendAudioVideoStream2(); | 4124 SendAudioVideoStream2(); |
3977 SessionDescriptionInterface* answer = | 4125 SessionDescriptionInterface* answer = |
3978 CreateRemoteAnswer(session_->local_description()); | 4126 CreateRemoteAnswer(session_->local_description()); |
3979 SetRemoteDescriptionWithoutError(answer); | 4127 SetRemoteDescriptionWithoutError(answer); |
3980 | 4128 |
3981 EXPECT_TRUE(session_->voice_rtp_transport_channel()->GetOption( | 4129 EXPECT_TRUE(session_->voice_rtp_transport_channel()->GetOption( |
3982 rtc::Socket::Option::OPT_SNDBUF, &option_val)); | 4130 rtc::Socket::Option::OPT_SNDBUF, &option_val)); |
3983 EXPECT_EQ(4000, option_val); | 4131 EXPECT_EQ(4000, option_val); |
3984 | 4132 |
3985 EXPECT_TRUE(session_->voice_rtp_transport_channel()->GetOption( | 4133 EXPECT_TRUE(session_->voice_rtp_transport_channel()->GetOption( |
3986 rtc::Socket::Option::OPT_RCVBUF, &option_val)); | 4134 rtc::Socket::Option::OPT_RCVBUF, &option_val)); |
3987 EXPECT_EQ(8000, option_val); | 4135 EXPECT_EQ(8000, option_val); |
3988 } | 4136 } |
3989 | 4137 |
3990 // Test creating a session, request multiple offers, destroy the session | 4138 // Test creating a session, request multiple offers, destroy the session |
3991 // and make sure we got success/failure callbacks for all of the requests. | 4139 // and make sure we got success/failure callbacks for all of the requests. |
3992 // Background: crbug.com/507307 | 4140 // Background: crbug.com/507307 |
3993 TEST_F(WebRtcSessionTest, CreateOffersAndShutdown) { | 4141 TEST_F(WebRtcSessionTest, CreateOffersAndShutdown) { |
3994 Init(); | 4142 Init(); |
3995 | 4143 |
3996 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observers[100]; | 4144 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observers[100]; |
3997 PeerConnectionInterface::RTCOfferAnswerOptions options; | 4145 PeerConnectionInterface::RTCOfferAnswerOptions options; |
3998 options.offer_to_receive_audio = | 4146 options.offer_to_receive_audio = |
3999 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; | 4147 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; |
| 4148 cricket::MediaSessionOptions session_options; |
| 4149 session_options.recv_audio = true; |
4000 | 4150 |
4001 for (auto& o : observers) { | 4151 for (auto& o : observers) { |
4002 o = new WebRtcSessionCreateSDPObserverForTest(); | 4152 o = new WebRtcSessionCreateSDPObserverForTest(); |
4003 session_->CreateOffer(o, options); | 4153 session_->CreateOffer(o, options, session_options); |
4004 } | 4154 } |
4005 | 4155 |
4006 session_.reset(); | 4156 session_.reset(); |
4007 | 4157 |
4008 for (auto& o : observers) { | 4158 for (auto& o : observers) { |
4009 // We expect to have received a notification now even if the session was | 4159 // We expect to have received a notification now even if the session was |
4010 // terminated. The offer creation may or may not have succeeded, but we | 4160 // terminated. The offer creation may or may not have succeeded, but we |
4011 // must have received a notification which, so the only invalid state | 4161 // must have received a notification which, so the only invalid state |
4012 // is kInit. | 4162 // is kInit. |
4013 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); | 4163 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); |
4014 } | 4164 } |
4015 } | 4165 } |
4016 | 4166 |
4017 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4167 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4018 // currently fails because upon disconnection and reconnection OnIceComplete is | 4168 // currently fails because upon disconnection and reconnection OnIceComplete is |
4019 // called more than once without returning to IceGatheringGathering. | 4169 // called more than once without returning to IceGatheringGathering. |
4020 | 4170 |
4021 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4171 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4022 WebRtcSessionTest, | 4172 WebRtcSessionTest, |
4023 testing::Values(ALREADY_GENERATED, | 4173 testing::Values(ALREADY_GENERATED, |
4024 DTLS_IDENTITY_STORE)); | 4174 DTLS_IDENTITY_STORE)); |
OLD | NEW |