| 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, |
| 11 * this list of conditions and the following disclaimer in the documentation | 11 * this list of conditions and the following disclaimer in the documentation |
| 12 * and/or other materials provided with the distribution. | 12 * and/or other materials provided with the distribution. |
| 13 * 3. The name of the author may not be used to endorse or promote products | 13 * 3. The name of the author may not be used to endorse or promote products |
| 14 * derived from this software without specific prior written permission. | 14 * derived from this software without specific prior written permission. |
| 15 * | 15 * |
| 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "talk/app/webrtc/audiotrack.h" | 28 #include "talk/app/webrtc/audiotrack.h" |
| 29 #include "talk/app/webrtc/dtlscertificate.h" |
| 29 #include "talk/app/webrtc/fakemetricsobserver.h" | 30 #include "talk/app/webrtc/fakemetricsobserver.h" |
| 30 #include "talk/app/webrtc/jsepicecandidate.h" | 31 #include "talk/app/webrtc/jsepicecandidate.h" |
| 31 #include "talk/app/webrtc/jsepsessiondescription.h" | 32 #include "talk/app/webrtc/jsepsessiondescription.h" |
| 32 #include "talk/app/webrtc/mediastreamsignaling.h" | 33 #include "talk/app/webrtc/mediastreamsignaling.h" |
| 33 #include "talk/app/webrtc/streamcollection.h" | 34 #include "talk/app/webrtc/streamcollection.h" |
| 34 #include "talk/app/webrtc/test/fakeconstraints.h" | 35 #include "talk/app/webrtc/test/fakeconstraints.h" |
| 35 #include "talk/app/webrtc/test/fakedtlsidentitystore.h" | 36 #include "talk/app/webrtc/test/fakedtlsidentitystore.h" |
| 36 #include "talk/app/webrtc/test/fakemediastreamsignaling.h" | 37 #include "talk/app/webrtc/test/fakemediastreamsignaling.h" |
| 37 #include "talk/app/webrtc/videotrack.h" | 38 #include "talk/app/webrtc/videotrack.h" |
| 38 #include "talk/app/webrtc/webrtcsession.h" | 39 #include "talk/app/webrtc/webrtcsession.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 "a=ice-pwd:cMvOlFvQ6ochez1ZOoC2uBEC\r\n" | 152 "a=ice-pwd:cMvOlFvQ6ochez1ZOoC2uBEC\r\n" |
| 152 "a=mid:video\r\n" | 153 "a=mid:video\r\n" |
| 153 "a=sendrecv\r\n" | 154 "a=sendrecv\r\n" |
| 154 "a=rtcp-mux\r\n" | 155 "a=rtcp-mux\r\n" |
| 155 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | 156 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " |
| 156 "inline:5/4N5CDvMiyDArHtBByUM71VIkguH17ZNoX60GrA\r\n" | 157 "inline:5/4N5CDvMiyDArHtBByUM71VIkguH17ZNoX60GrA\r\n" |
| 157 "a=rtpmap:0 fake_video_codec/90000\r\n" | 158 "a=rtpmap:0 fake_video_codec/90000\r\n" |
| 158 "a=rtpmap:96 rtx/90000\r\n" | 159 "a=rtpmap:96 rtx/90000\r\n" |
| 159 "a=fmtp:96 apt=0\r\n"; | 160 "a=fmtp:96 apt=0\r\n"; |
| 160 | 161 |
| 162 enum DtlsCertificateGenerationMethod { PRE_GENERATED, DTLS_IDENTITY_STORE }; |
| 163 |
| 161 // Add some extra |newlines| to the |message| after |line|. | 164 // Add some extra |newlines| to the |message| after |line|. |
| 162 static void InjectAfter(const std::string& line, | 165 static void InjectAfter(const std::string& line, |
| 163 const std::string& newlines, | 166 const std::string& newlines, |
| 164 std::string* message) { | 167 std::string* message) { |
| 165 const std::string tmp = line + newlines; | 168 const std::string tmp = line + newlines; |
| 166 rtc::replace_substrs(line.c_str(), line.length(), | 169 rtc::replace_substrs(line.c_str(), line.length(), |
| 167 tmp.c_str(), tmp.length(), message); | 170 tmp.c_str(), tmp.length(), message); |
| 168 } | 171 } |
| 169 | 172 |
| 170 class MockIceObserver : public webrtc::IceObserver { | 173 class MockIceObserver : public webrtc::IceObserver { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 308 } |
| 306 void SetSink(Sink* sink) override { sink_ = sink; } | 309 void SetSink(Sink* sink) override { sink_ = sink; } |
| 307 | 310 |
| 308 int channel_id() const { return channel_id_; } | 311 int channel_id() const { return channel_id_; } |
| 309 cricket::AudioRenderer::Sink* sink() const { return sink_; } | 312 cricket::AudioRenderer::Sink* sink() const { return sink_; } |
| 310 private: | 313 private: |
| 311 int channel_id_; | 314 int channel_id_; |
| 312 cricket::AudioRenderer::Sink* sink_; | 315 cricket::AudioRenderer::Sink* sink_; |
| 313 }; | 316 }; |
| 314 | 317 |
| 315 class WebRtcSessionTest : public testing::Test { | 318 class WebRtcSessionTest |
| 319 : public testing::TestWithParam<DtlsCertificateGenerationMethod> { |
| 316 protected: | 320 protected: |
| 317 // TODO Investigate why ChannelManager crashes, if it's created | 321 // TODO Investigate why ChannelManager crashes, if it's created |
| 318 // after stun_server. | 322 // after stun_server. |
| 319 WebRtcSessionTest() | 323 WebRtcSessionTest() |
| 320 : media_engine_(new cricket::FakeMediaEngine()), | 324 : media_engine_(new cricket::FakeMediaEngine()), |
| 321 data_engine_(new cricket::FakeDataEngine()), | 325 data_engine_(new cricket::FakeDataEngine()), |
| 322 device_manager_(new cricket::FakeDeviceManager()), | 326 device_manager_(new cricket::FakeDeviceManager()), |
| 323 channel_manager_(new cricket::ChannelManager( | 327 channel_manager_(new cricket::ChannelManager( |
| 324 media_engine_, data_engine_, device_manager_, | 328 media_engine_, data_engine_, device_manager_, |
| 325 new cricket::CaptureManager(), rtc::Thread::Current())), | 329 new cricket::CaptureManager(), rtc::Thread::Current())), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 350 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); | 354 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); |
| 351 EXPECT_TRUE(channel_manager_->Init()); | 355 EXPECT_TRUE(channel_manager_->Init()); |
| 352 desc_factory_->set_add_legacy_streams(false); | 356 desc_factory_->set_add_legacy_streams(false); |
| 353 allocator_->set_step_delay(cricket::kMinimumStepDelay); | 357 allocator_->set_step_delay(cricket::kMinimumStepDelay); |
| 354 } | 358 } |
| 355 | 359 |
| 356 void AddInterface(const SocketAddress& addr) { | 360 void AddInterface(const SocketAddress& addr) { |
| 357 network_manager_.AddInterface(addr); | 361 network_manager_.AddInterface(addr); |
| 358 } | 362 } |
| 359 | 363 |
| 364 // If |certificate| != null then the certificate is used (DTLS on), otherwise |
| 365 // |dtls_identity_store| is used (DTLS on) to try to generate a certificate. |
| 366 // If null then DTLS is off by default, but this could be overwritten by |
| 367 // RTCConfiguration in which case a certificate is attempted to be generated |
| 368 // with an unspecified store. |
| 360 void Init( | 369 void Init( |
| 361 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, | 370 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, |
| 371 const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate, |
| 362 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { | 372 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { |
| 363 ASSERT_TRUE(session_.get() == NULL); | 373 ASSERT_TRUE(session_.get() == NULL); |
| 364 session_.reset(new WebRtcSessionForTest( | 374 session_.reset(new WebRtcSessionForTest( |
| 365 channel_manager_.get(), rtc::Thread::Current(), | 375 channel_manager_.get(), rtc::Thread::Current(), |
| 366 rtc::Thread::Current(), allocator_.get(), | 376 rtc::Thread::Current(), allocator_.get(), |
| 367 &observer_, | 377 &observer_, |
| 368 &mediastream_signaling_)); | 378 &mediastream_signaling_)); |
| 369 | 379 |
| 370 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, | 380 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, |
| 371 observer_.ice_connection_state_); | 381 observer_.ice_connection_state_); |
| 372 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, | 382 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, |
| 373 observer_.ice_gathering_state_); | 383 observer_.ice_gathering_state_); |
| 374 | 384 |
| 375 EXPECT_TRUE(session_->Initialize( | 385 if (!certificate) { |
| 376 options_, constraints_.get(), dtls_identity_store.Pass(), | 386 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), |
| 377 rtc_configuration)); | 387 dtls_identity_store.Pass(), |
| 388 rtc_configuration)); |
| 389 } else { |
| 390 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), |
| 391 certificate, rtc_configuration)); |
| 392 } |
| 378 session_->set_metrics_observer(metrics_observer_); | 393 session_->set_metrics_observer(metrics_observer_); |
| 379 } | 394 } |
| 380 | 395 |
| 381 void Init() { | 396 void Init() { |
| 382 PeerConnectionInterface::RTCConfiguration configuration; | 397 PeerConnectionInterface::RTCConfiguration configuration; |
| 383 Init(nullptr, configuration); | 398 Init(nullptr, nullptr, configuration); |
| 384 } | 399 } |
| 385 | 400 |
| 386 void InitWithIceTransport( | 401 void InitWithIceTransport( |
| 387 PeerConnectionInterface::IceTransportsType ice_transport_type) { | 402 PeerConnectionInterface::IceTransportsType ice_transport_type) { |
| 388 PeerConnectionInterface::RTCConfiguration configuration; | 403 PeerConnectionInterface::RTCConfiguration configuration; |
| 389 configuration.type = ice_transport_type; | 404 configuration.type = ice_transport_type; |
| 390 Init(nullptr, configuration); | 405 Init(nullptr, nullptr, configuration); |
| 391 } | 406 } |
| 392 | 407 |
| 393 void InitWithBundlePolicy( | 408 void InitWithBundlePolicy( |
| 394 PeerConnectionInterface::BundlePolicy bundle_policy) { | 409 PeerConnectionInterface::BundlePolicy bundle_policy) { |
| 395 PeerConnectionInterface::RTCConfiguration configuration; | 410 PeerConnectionInterface::RTCConfiguration configuration; |
| 396 configuration.bundle_policy = bundle_policy; | 411 configuration.bundle_policy = bundle_policy; |
| 397 Init(nullptr, configuration); | 412 Init(nullptr, nullptr, configuration); |
| 398 } | 413 } |
| 399 | 414 |
| 400 void InitWithRtcpMuxPolicy( | 415 void InitWithRtcpMuxPolicy( |
| 401 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy) { | 416 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy) { |
| 402 PeerConnectionInterface::RTCConfiguration configuration; | 417 PeerConnectionInterface::RTCConfiguration configuration; |
| 403 configuration.rtcp_mux_policy = rtcp_mux_policy; | 418 configuration.rtcp_mux_policy = rtcp_mux_policy; |
| 404 Init(nullptr, configuration); | 419 Init(nullptr, nullptr, configuration); |
| 405 } | 420 } |
| 406 | 421 |
| 407 void InitWithDtls(bool identity_request_should_fail = false) { | 422 void InitWithDtlsCertSuccess( |
| 423 DtlsCertificateGenerationMethod cert_gen_method) { |
| 424 if (cert_gen_method == PRE_GENERATED) { |
| 425 PeerConnectionInterface::RTCConfiguration configuration; |
| 426 Init(nullptr, FakeDtlsIdentityStore::GenerateCertificate(), |
| 427 configuration); |
| 428 } else if (cert_gen_method == DTLS_IDENTITY_STORE) { |
| 429 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
| 430 new FakeDtlsIdentityStore()); |
| 431 dtls_identity_store->set_should_fail(false); |
| 432 PeerConnectionInterface::RTCConfiguration configuration; |
| 433 Init(dtls_identity_store.Pass(), nullptr, configuration); |
| 434 } else { |
| 435 CHECK(false); |
| 436 } |
| 437 } |
| 438 |
| 439 void InitWithDtlsCertGenFailure() { |
| 408 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( | 440 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
| 409 new FakeDtlsIdentityStore()); | 441 new FakeDtlsIdentityStore()); |
| 410 dtls_identity_store->set_should_fail(identity_request_should_fail); | 442 dtls_identity_store->set_should_fail(true); |
| 411 PeerConnectionInterface::RTCConfiguration configuration; | 443 PeerConnectionInterface::RTCConfiguration configuration; |
| 412 Init(dtls_identity_store.Pass(), configuration); | 444 Init(dtls_identity_store.Pass(), nullptr, configuration); |
| 413 } | 445 } |
| 414 | 446 |
| 415 void InitWithDtmfCodec() { | 447 void InitWithDtmfCodec() { |
| 416 // Add kTelephoneEventCodec for dtmf test. | 448 // Add kTelephoneEventCodec for dtmf test. |
| 417 const cricket::AudioCodec kTelephoneEventCodec( | 449 const cricket::AudioCodec kTelephoneEventCodec( |
| 418 106, "telephone-event", 8000, 0, 1, 0); | 450 106, "telephone-event", 8000, 0, 1, 0); |
| 419 std::vector<cricket::AudioCodec> codecs; | 451 std::vector<cricket::AudioCodec> codecs; |
| 420 codecs.push_back(kTelephoneEventCodec); | 452 codecs.push_back(kTelephoneEventCodec); |
| 421 media_engine_->SetAudioCodecs(codecs); | 453 media_engine_->SetAudioCodecs(codecs); |
| 422 desc_factory_->set_audio_codecs(codecs); | 454 desc_factory_->set_audio_codecs(codecs); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 EXPECT_EQ(std::string(cricket::kMediaProtocolAvpf), | 565 EXPECT_EQ(std::string(cricket::kMediaProtocolAvpf), |
| 534 video_content->protocol()); | 566 video_content->protocol()); |
| 535 } | 567 } |
| 536 } | 568 } |
| 537 | 569 |
| 538 // Set the internal fake description factories to do DTLS-SRTP. | 570 // Set the internal fake description factories to do DTLS-SRTP. |
| 539 void SetFactoryDtlsSrtp() { | 571 void SetFactoryDtlsSrtp() { |
| 540 desc_factory_->set_secure(cricket::SEC_DISABLED); | 572 desc_factory_->set_secure(cricket::SEC_DISABLED); |
| 541 std::string identity_name = "WebRTC" + | 573 std::string identity_name = "WebRTC" + |
| 542 rtc::ToString(rtc::CreateRandomId()); | 574 rtc::ToString(rtc::CreateRandomId()); |
| 543 // Confirmed to work with KT_RSA and KT_ECDSA. | 575 certificate_ = webrtc::DtlsCertificate::Create( |
| 544 identity_.reset(rtc::SSLIdentity::Generate(identity_name, rtc::KT_DEFAULT)); | 576 rtc::scoped_ptr<rtc::SSLIdentity>( |
| 545 tdesc_factory_->set_identity(identity_.get()); | 577 rtc::SSLIdentity::Generate(identity_name, rtc::KT_DEFAULT)).Pass()); |
| 578 tdesc_factory_->set_certificate(certificate_); |
| 546 tdesc_factory_->set_secure(cricket::SEC_REQUIRED); | 579 tdesc_factory_->set_secure(cricket::SEC_REQUIRED); |
| 547 } | 580 } |
| 548 | 581 |
| 549 void VerifyFingerprintStatus(const cricket::SessionDescription* sdp, | 582 void VerifyFingerprintStatus(const cricket::SessionDescription* sdp, |
| 550 bool expected) { | 583 bool expected) { |
| 551 const TransportInfo* audio = sdp->GetTransportInfoByName("audio"); | 584 const TransportInfo* audio = sdp->GetTransportInfoByName("audio"); |
| 552 ASSERT_TRUE(audio != NULL); | 585 ASSERT_TRUE(audio != NULL); |
| 553 ASSERT_EQ(expected, audio->description.identity_fingerprint.get() != NULL); | 586 ASSERT_EQ(expected, audio->description.identity_fingerprint.get() != NULL); |
| 554 const TransportInfo* video = sdp->GetTransportInfoByName("video"); | 587 const TransportInfo* video = sdp->GetTransportInfoByName("video"); |
| 555 ASSERT_TRUE(video != NULL); | 588 ASSERT_TRUE(video != NULL); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 void SetLocalDescriptionWithDataChannel() { | 1212 void SetLocalDescriptionWithDataChannel() { |
| 1180 webrtc::InternalDataChannelInit dci; | 1213 webrtc::InternalDataChannelInit dci; |
| 1181 dci.reliable = false; | 1214 dci.reliable = false; |
| 1182 session_->CreateDataChannel("datachannel", &dci); | 1215 session_->CreateDataChannel("datachannel", &dci); |
| 1183 SessionDescriptionInterface* offer = CreateOffer(); | 1216 SessionDescriptionInterface* offer = CreateOffer(); |
| 1184 SetLocalDescriptionWithoutError(offer); | 1217 SetLocalDescriptionWithoutError(offer); |
| 1185 } | 1218 } |
| 1186 | 1219 |
| 1187 void VerifyMultipleAsyncCreateDescription( | 1220 void VerifyMultipleAsyncCreateDescription( |
| 1188 bool success, CreateSessionDescriptionRequest::Type type) { | 1221 bool success, CreateSessionDescriptionRequest::Type type) { |
| 1189 InitWithDtls(!success); | 1222 if (success) |
| 1223 InitWithDtlsCertSuccess(DTLS_IDENTITY_STORE); |
| 1224 else |
| 1225 InitWithDtlsCertGenFailure(); |
| 1190 SetFactoryDtlsSrtp(); | 1226 SetFactoryDtlsSrtp(); |
| 1191 if (type == CreateSessionDescriptionRequest::kAnswer) { | 1227 if (type == CreateSessionDescriptionRequest::kAnswer) { |
| 1192 cricket::MediaSessionOptions options; | 1228 cricket::MediaSessionOptions options; |
| 1193 scoped_ptr<JsepSessionDescription> offer( | 1229 scoped_ptr<JsepSessionDescription> offer( |
| 1194 CreateRemoteOffer(options, cricket::SEC_DISABLED)); | 1230 CreateRemoteOffer(options, cricket::SEC_DISABLED)); |
| 1195 ASSERT_TRUE(offer.get() != NULL); | 1231 ASSERT_TRUE(offer.get() != NULL); |
| 1196 SetRemoteDescriptionWithoutError(offer.release()); | 1232 SetRemoteDescriptionWithoutError(offer.release()); |
| 1197 } | 1233 } |
| 1198 | 1234 |
| 1199 PeerConnectionInterface::RTCOfferAnswerOptions options; | 1235 PeerConnectionInterface::RTCOfferAnswerOptions options; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 allocator_->set_step_delay(cricket::kMinimumStepDelay); | 1269 allocator_->set_step_delay(cricket::kMinimumStepDelay); |
| 1234 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | | 1270 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | |
| 1235 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); | 1271 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); |
| 1236 } | 1272 } |
| 1237 | 1273 |
| 1238 cricket::FakeMediaEngine* media_engine_; | 1274 cricket::FakeMediaEngine* media_engine_; |
| 1239 cricket::FakeDataEngine* data_engine_; | 1275 cricket::FakeDataEngine* data_engine_; |
| 1240 cricket::FakeDeviceManager* device_manager_; | 1276 cricket::FakeDeviceManager* device_manager_; |
| 1241 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; | 1277 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; |
| 1242 rtc::scoped_ptr<cricket::TransportDescriptionFactory> tdesc_factory_; | 1278 rtc::scoped_ptr<cricket::TransportDescriptionFactory> tdesc_factory_; |
| 1243 rtc::scoped_ptr<rtc::SSLIdentity> identity_; | 1279 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate_; |
| 1244 rtc::scoped_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_; | 1280 rtc::scoped_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_; |
| 1245 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; | 1281 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; |
| 1246 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; | 1282 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; |
| 1247 rtc::scoped_ptr<rtc::FirewallSocketServer> fss_; | 1283 rtc::scoped_ptr<rtc::FirewallSocketServer> fss_; |
| 1248 rtc::SocketServerScope ss_scope_; | 1284 rtc::SocketServerScope ss_scope_; |
| 1249 rtc::SocketAddress stun_socket_addr_; | 1285 rtc::SocketAddress stun_socket_addr_; |
| 1250 rtc::scoped_ptr<cricket::TestStunServer> stun_server_; | 1286 rtc::scoped_ptr<cricket::TestStunServer> stun_server_; |
| 1251 cricket::TestTurnServer turn_server_; | 1287 cricket::TestTurnServer turn_server_; |
| 1252 rtc::FakeNetworkManager network_manager_; | 1288 rtc::FakeNetworkManager network_manager_; |
| 1253 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; | 1289 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; |
| 1254 PeerConnectionFactoryInterface::Options options_; | 1290 PeerConnectionFactoryInterface::Options options_; |
| 1255 rtc::scoped_ptr<FakeConstraints> constraints_; | 1291 rtc::scoped_ptr<FakeConstraints> constraints_; |
| 1256 FakeMediaStreamSignaling mediastream_signaling_; | 1292 FakeMediaStreamSignaling mediastream_signaling_; |
| 1257 rtc::scoped_ptr<WebRtcSessionForTest> session_; | 1293 rtc::scoped_ptr<WebRtcSessionForTest> session_; |
| 1258 MockIceObserver observer_; | 1294 MockIceObserver observer_; |
| 1259 cricket::FakeVideoMediaChannel* video_channel_; | 1295 cricket::FakeVideoMediaChannel* video_channel_; |
| 1260 cricket::FakeVoiceMediaChannel* voice_channel_; | 1296 cricket::FakeVoiceMediaChannel* voice_channel_; |
| 1261 rtc::scoped_refptr<FakeMetricsObserver> metrics_observer_; | 1297 rtc::scoped_refptr<FakeMetricsObserver> metrics_observer_; |
| 1262 }; | 1298 }; |
| 1263 | 1299 |
| 1264 TEST_F(WebRtcSessionTest, TestInitializeWithDtls) { | 1300 TEST_P(WebRtcSessionTest, TestInitializeWithDtls) { |
| 1265 InitWithDtls(); | 1301 InitWithDtlsCertSuccess(GetParam()); |
| 1266 // SDES is disabled when DTLS is on. | 1302 // SDES is disabled when DTLS is on. |
| 1267 EXPECT_EQ(cricket::SEC_DISABLED, session_->SdesPolicy()); | 1303 EXPECT_EQ(cricket::SEC_DISABLED, session_->SdesPolicy()); |
| 1268 } | 1304 } |
| 1269 | 1305 |
| 1270 TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) { | 1306 TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) { |
| 1271 Init(); | 1307 Init(); |
| 1272 // SDES is required if DTLS is off. | 1308 // SDES is required if DTLS is off. |
| 1273 EXPECT_EQ(cricket::SEC_REQUIRED, session_->SdesPolicy()); | 1309 EXPECT_EQ(cricket::SEC_REQUIRED, session_->SdesPolicy()); |
| 1274 } | 1310 } |
| 1275 | 1311 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 SessionDescriptionInterface* answer = NULL; | 1598 SessionDescriptionInterface* answer = NULL; |
| 1563 CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer); | 1599 CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer); |
| 1564 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1600 // SetRemoteDescription and SetLocalDescription will take the ownership of |
| 1565 // the offer. | 1601 // the offer. |
| 1566 SetLocalDescriptionWithoutError(offer); | 1602 SetLocalDescriptionWithoutError(offer); |
| 1567 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer); | 1603 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer); |
| 1568 } | 1604 } |
| 1569 | 1605 |
| 1570 // Test that we accept an offer with a DTLS fingerprint when DTLS is on | 1606 // Test that we accept an offer with a DTLS fingerprint when DTLS is on |
| 1571 // and that we return an answer with a DTLS fingerprint. | 1607 // and that we return an answer with a DTLS fingerprint. |
| 1572 TEST_F(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) { | 1608 TEST_P(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) { |
| 1573 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1609 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1574 mediastream_signaling_.SendAudioVideoStream1(); | 1610 mediastream_signaling_.SendAudioVideoStream1(); |
| 1575 InitWithDtls(); | 1611 InitWithDtlsCertSuccess(GetParam()); |
| 1576 SetFactoryDtlsSrtp(); | 1612 SetFactoryDtlsSrtp(); |
| 1577 cricket::MediaSessionOptions options; | 1613 cricket::MediaSessionOptions options; |
| 1578 options.recv_video = true; | 1614 options.recv_video = true; |
| 1579 JsepSessionDescription* offer = | 1615 JsepSessionDescription* offer = |
| 1580 CreateRemoteOffer(options, cricket::SEC_DISABLED); | 1616 CreateRemoteOffer(options, cricket::SEC_DISABLED); |
| 1581 ASSERT_TRUE(offer != NULL); | 1617 ASSERT_TRUE(offer != NULL); |
| 1582 VerifyFingerprintStatus(offer->description(), true); | 1618 VerifyFingerprintStatus(offer->description(), true); |
| 1583 VerifyNoCryptoParams(offer->description(), true); | 1619 VerifyNoCryptoParams(offer->description(), true); |
| 1584 | 1620 |
| 1585 // SetRemoteDescription will take the ownership of the offer. | 1621 // SetRemoteDescription will take the ownership of the offer. |
| 1586 SetRemoteDescriptionWithoutError(offer); | 1622 SetRemoteDescriptionWithoutError(offer); |
| 1587 | 1623 |
| 1588 // Verify that we get a crypto fingerprint in the answer. | 1624 // Verify that we get a crypto fingerprint in the answer. |
| 1589 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 1625 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
| 1590 ASSERT_TRUE(answer != NULL); | 1626 ASSERT_TRUE(answer != NULL); |
| 1591 VerifyFingerprintStatus(answer->description(), true); | 1627 VerifyFingerprintStatus(answer->description(), true); |
| 1592 // Check that we don't have an a=crypto line in the answer. | 1628 // Check that we don't have an a=crypto line in the answer. |
| 1593 VerifyNoCryptoParams(answer->description(), true); | 1629 VerifyNoCryptoParams(answer->description(), true); |
| 1594 | 1630 |
| 1595 // Now set the local description, which should work, even without a=crypto. | 1631 // Now set the local description, which should work, even without a=crypto. |
| 1596 SetLocalDescriptionWithoutError(answer); | 1632 SetLocalDescriptionWithoutError(answer); |
| 1597 } | 1633 } |
| 1598 | 1634 |
| 1599 // Test that we set a local offer with a DTLS fingerprint when DTLS is on | 1635 // Test that we set a local offer with a DTLS fingerprint when DTLS is on |
| 1600 // and then we accept a remote answer with a DTLS fingerprint successfully. | 1636 // and then we accept a remote answer with a DTLS fingerprint successfully. |
| 1601 TEST_F(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) { | 1637 TEST_P(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) { |
| 1602 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1638 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1603 mediastream_signaling_.SendAudioVideoStream1(); | 1639 mediastream_signaling_.SendAudioVideoStream1(); |
| 1604 InitWithDtls(); | 1640 InitWithDtlsCertSuccess(GetParam()); |
| 1605 SetFactoryDtlsSrtp(); | 1641 SetFactoryDtlsSrtp(); |
| 1606 | 1642 |
| 1607 // Verify that we get a crypto fingerprint in the answer. | 1643 // Verify that we get a crypto fingerprint in the answer. |
| 1608 SessionDescriptionInterface* offer = CreateOffer(); | 1644 SessionDescriptionInterface* offer = CreateOffer(); |
| 1609 ASSERT_TRUE(offer != NULL); | 1645 ASSERT_TRUE(offer != NULL); |
| 1610 VerifyFingerprintStatus(offer->description(), true); | 1646 VerifyFingerprintStatus(offer->description(), true); |
| 1611 // Check that we don't have an a=crypto line in the offer. | 1647 // Check that we don't have an a=crypto line in the offer. |
| 1612 VerifyNoCryptoParams(offer->description(), true); | 1648 VerifyNoCryptoParams(offer->description(), true); |
| 1613 | 1649 |
| 1614 // Now set the local description, which should work, even without a=crypto. | 1650 // Now set the local description, which should work, even without a=crypto. |
| 1615 SetLocalDescriptionWithoutError(offer); | 1651 SetLocalDescriptionWithoutError(offer); |
| 1616 | 1652 |
| 1617 cricket::MediaSessionOptions options; | 1653 cricket::MediaSessionOptions options; |
| 1618 options.recv_video = true; | 1654 options.recv_video = true; |
| 1619 JsepSessionDescription* answer = | 1655 JsepSessionDescription* answer = |
| 1620 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); | 1656 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 1621 ASSERT_TRUE(answer != NULL); | 1657 ASSERT_TRUE(answer != NULL); |
| 1622 VerifyFingerprintStatus(answer->description(), true); | 1658 VerifyFingerprintStatus(answer->description(), true); |
| 1623 VerifyNoCryptoParams(answer->description(), true); | 1659 VerifyNoCryptoParams(answer->description(), true); |
| 1624 | 1660 |
| 1625 // SetRemoteDescription will take the ownership of the answer. | 1661 // SetRemoteDescription will take the ownership of the answer. |
| 1626 SetRemoteDescriptionWithoutError(answer); | 1662 SetRemoteDescriptionWithoutError(answer); |
| 1627 } | 1663 } |
| 1628 | 1664 |
| 1629 // Test that if we support DTLS and the other side didn't offer a fingerprint, | 1665 // Test that if we support DTLS and the other side didn't offer a fingerprint, |
| 1630 // we will fail to set the remote description. | 1666 // we will fail to set the remote description. |
| 1631 TEST_F(WebRtcSessionTest, TestReceiveNonDtlsOfferWhenDtlsOn) { | 1667 TEST_P(WebRtcSessionTest, TestReceiveNonDtlsOfferWhenDtlsOn) { |
| 1632 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1668 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1633 InitWithDtls(); | 1669 InitWithDtlsCertSuccess(GetParam()); |
| 1634 cricket::MediaSessionOptions options; | 1670 cricket::MediaSessionOptions options; |
| 1635 options.recv_video = true; | 1671 options.recv_video = true; |
| 1636 options.bundle_enabled = true; | 1672 options.bundle_enabled = true; |
| 1637 JsepSessionDescription* offer = CreateRemoteOffer( | 1673 JsepSessionDescription* offer = CreateRemoteOffer( |
| 1638 options, cricket::SEC_REQUIRED); | 1674 options, cricket::SEC_REQUIRED); |
| 1639 ASSERT_TRUE(offer != NULL); | 1675 ASSERT_TRUE(offer != NULL); |
| 1640 VerifyFingerprintStatus(offer->description(), false); | 1676 VerifyFingerprintStatus(offer->description(), false); |
| 1641 VerifyCryptoParams(offer->description()); | 1677 VerifyCryptoParams(offer->description()); |
| 1642 | 1678 |
| 1643 // SetRemoteDescription will take the ownership of the offer. | 1679 // SetRemoteDescription will take the ownership of the offer. |
| 1644 SetRemoteDescriptionOfferExpectError( | 1680 SetRemoteDescriptionOfferExpectError( |
| 1645 kSdpWithoutDtlsFingerprint, offer); | 1681 kSdpWithoutDtlsFingerprint, offer); |
| 1646 | 1682 |
| 1647 offer = CreateRemoteOffer(options, cricket::SEC_REQUIRED); | 1683 offer = CreateRemoteOffer(options, cricket::SEC_REQUIRED); |
| 1648 // SetLocalDescription will take the ownership of the offer. | 1684 // SetLocalDescription will take the ownership of the offer. |
| 1649 SetLocalDescriptionOfferExpectError( | 1685 SetLocalDescriptionOfferExpectError( |
| 1650 kSdpWithoutDtlsFingerprint, offer); | 1686 kSdpWithoutDtlsFingerprint, offer); |
| 1651 } | 1687 } |
| 1652 | 1688 |
| 1653 // Test that we return a failure when applying a local answer that doesn't have | 1689 // Test that we return a failure when applying a local answer that doesn't have |
| 1654 // a DTLS fingerprint when DTLS is required. | 1690 // a DTLS fingerprint when DTLS is required. |
| 1655 TEST_F(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) { | 1691 TEST_P(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) { |
| 1656 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1692 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1657 InitWithDtls(); | 1693 InitWithDtlsCertSuccess(GetParam()); |
| 1658 SessionDescriptionInterface* offer = NULL; | 1694 SessionDescriptionInterface* offer = NULL; |
| 1659 SessionDescriptionInterface* answer = NULL; | 1695 SessionDescriptionInterface* answer = NULL; |
| 1660 CreateDtlsOfferAndNonDtlsAnswer(&offer, &answer); | 1696 CreateDtlsOfferAndNonDtlsAnswer(&offer, &answer); |
| 1661 | 1697 |
| 1662 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1698 // SetRemoteDescription and SetLocalDescription will take the ownership of |
| 1663 // the offer and answer. | 1699 // the offer and answer. |
| 1664 SetRemoteDescriptionWithoutError(offer); | 1700 SetRemoteDescriptionWithoutError(offer); |
| 1665 SetLocalDescriptionAnswerExpectError( | 1701 SetLocalDescriptionAnswerExpectError( |
| 1666 kSdpWithoutDtlsFingerprint, answer); | 1702 kSdpWithoutDtlsFingerprint, answer); |
| 1667 } | 1703 } |
| 1668 | 1704 |
| 1669 // Test that we return a failure when applying a remote answer that doesn't have | 1705 // Test that we return a failure when applying a remote answer that doesn't have |
| 1670 // a DTLS fingerprint when DTLS is required. | 1706 // a DTLS fingerprint when DTLS is required. |
| 1671 TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) { | 1707 TEST_P(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) { |
| 1672 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1708 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1673 // Enable both SDES and DTLS, so that offer won't be outright rejected as a | 1709 // Enable both SDES and DTLS, so that offer won't be outright rejected as a |
| 1674 // result of using the "UDP/TLS/RTP/SAVPF" profile. | 1710 // result of using the "UDP/TLS/RTP/SAVPF" profile. |
| 1675 InitWithDtls(); | 1711 InitWithDtlsCertSuccess(GetParam()); |
| 1676 session_->SetSdesPolicy(cricket::SEC_ENABLED); | 1712 session_->SetSdesPolicy(cricket::SEC_ENABLED); |
| 1677 SessionDescriptionInterface* offer = CreateOffer(); | 1713 SessionDescriptionInterface* offer = CreateOffer(); |
| 1678 cricket::MediaSessionOptions options; | 1714 cricket::MediaSessionOptions options; |
| 1679 options.recv_video = true; | 1715 options.recv_video = true; |
| 1680 JsepSessionDescription* answer = | 1716 JsepSessionDescription* answer = |
| 1681 CreateRemoteAnswer(offer, options, cricket::SEC_ENABLED); | 1717 CreateRemoteAnswer(offer, options, cricket::SEC_ENABLED); |
| 1682 | 1718 |
| 1683 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1719 // SetRemoteDescription and SetLocalDescription will take the ownership of |
| 1684 // the offer and answer. | 1720 // the offer and answer. |
| 1685 SetLocalDescriptionWithoutError(offer); | 1721 SetLocalDescriptionWithoutError(offer); |
| 1686 SetRemoteDescriptionAnswerExpectError( | 1722 SetRemoteDescriptionAnswerExpectError( |
| 1687 kSdpWithoutDtlsFingerprint, answer); | 1723 kSdpWithoutDtlsFingerprint, answer); |
| 1688 } | 1724 } |
| 1689 | 1725 |
| 1690 // Test that we create a local offer without SDES or DTLS and accept a remote | 1726 // Test that we create a local offer without SDES or DTLS and accept a remote |
| 1691 // answer without SDES or DTLS when encryption is disabled. | 1727 // answer without SDES or DTLS when encryption is disabled. |
| 1692 TEST_F(WebRtcSessionTest, TestCreateOfferReceiveAnswerWithoutEncryption) { | 1728 TEST_P(WebRtcSessionTest, TestCreateOfferReceiveAnswerWithoutEncryption) { |
| 1693 mediastream_signaling_.SendAudioVideoStream1(); | 1729 mediastream_signaling_.SendAudioVideoStream1(); |
| 1694 options_.disable_encryption = true; | 1730 options_.disable_encryption = true; |
| 1695 InitWithDtls(); | 1731 InitWithDtlsCertSuccess(GetParam()); |
| 1696 | 1732 |
| 1697 // Verify that we get a crypto fingerprint in the answer. | 1733 // Verify that we get a crypto fingerprint in the answer. |
| 1698 SessionDescriptionInterface* offer = CreateOffer(); | 1734 SessionDescriptionInterface* offer = CreateOffer(); |
| 1699 ASSERT_TRUE(offer != NULL); | 1735 ASSERT_TRUE(offer != NULL); |
| 1700 VerifyFingerprintStatus(offer->description(), false); | 1736 VerifyFingerprintStatus(offer->description(), false); |
| 1701 // Check that we don't have an a=crypto line in the offer. | 1737 // Check that we don't have an a=crypto line in the offer. |
| 1702 VerifyNoCryptoParams(offer->description(), false); | 1738 VerifyNoCryptoParams(offer->description(), false); |
| 1703 | 1739 |
| 1704 // Now set the local description, which should work, even without a=crypto. | 1740 // Now set the local description, which should work, even without a=crypto. |
| 1705 SetLocalDescriptionWithoutError(offer); | 1741 SetLocalDescriptionWithoutError(offer); |
| 1706 | 1742 |
| 1707 cricket::MediaSessionOptions options; | 1743 cricket::MediaSessionOptions options; |
| 1708 options.recv_video = true; | 1744 options.recv_video = true; |
| 1709 JsepSessionDescription* answer = | 1745 JsepSessionDescription* answer = |
| 1710 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); | 1746 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 1711 ASSERT_TRUE(answer != NULL); | 1747 ASSERT_TRUE(answer != NULL); |
| 1712 VerifyFingerprintStatus(answer->description(), false); | 1748 VerifyFingerprintStatus(answer->description(), false); |
| 1713 VerifyNoCryptoParams(answer->description(), false); | 1749 VerifyNoCryptoParams(answer->description(), false); |
| 1714 | 1750 |
| 1715 // SetRemoteDescription will take the ownership of the answer. | 1751 // SetRemoteDescription will take the ownership of the answer. |
| 1716 SetRemoteDescriptionWithoutError(answer); | 1752 SetRemoteDescriptionWithoutError(answer); |
| 1717 } | 1753 } |
| 1718 | 1754 |
| 1719 // Test that we create a local answer without SDES or DTLS and accept a remote | 1755 // Test that we create a local answer without SDES or DTLS and accept a remote |
| 1720 // offer without SDES or DTLS when encryption is disabled. | 1756 // offer without SDES or DTLS when encryption is disabled. |
| 1721 TEST_F(WebRtcSessionTest, TestCreateAnswerReceiveOfferWithoutEncryption) { | 1757 TEST_P(WebRtcSessionTest, TestCreateAnswerReceiveOfferWithoutEncryption) { |
| 1722 options_.disable_encryption = true; | 1758 options_.disable_encryption = true; |
| 1723 InitWithDtls(); | 1759 InitWithDtlsCertSuccess(GetParam()); |
| 1724 | 1760 |
| 1725 cricket::MediaSessionOptions options; | 1761 cricket::MediaSessionOptions options; |
| 1726 options.recv_video = true; | 1762 options.recv_video = true; |
| 1727 JsepSessionDescription* offer = | 1763 JsepSessionDescription* offer = |
| 1728 CreateRemoteOffer(options, cricket::SEC_DISABLED); | 1764 CreateRemoteOffer(options, cricket::SEC_DISABLED); |
| 1729 ASSERT_TRUE(offer != NULL); | 1765 ASSERT_TRUE(offer != NULL); |
| 1730 VerifyFingerprintStatus(offer->description(), false); | 1766 VerifyFingerprintStatus(offer->description(), false); |
| 1731 VerifyNoCryptoParams(offer->description(), false); | 1767 VerifyNoCryptoParams(offer->description(), false); |
| 1732 | 1768 |
| 1733 // SetRemoteDescription will take the ownership of the offer. | 1769 // SetRemoteDescription will take the ownership of the offer. |
| (...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3463 TEST_F(WebRtcSessionTest, TestRtpDataChannel) { | 3499 TEST_F(WebRtcSessionTest, TestRtpDataChannel) { |
| 3464 constraints_.reset(new FakeConstraints()); | 3500 constraints_.reset(new FakeConstraints()); |
| 3465 constraints_->AddOptional( | 3501 constraints_->AddOptional( |
| 3466 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); | 3502 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); |
| 3467 Init(); | 3503 Init(); |
| 3468 | 3504 |
| 3469 SetLocalDescriptionWithDataChannel(); | 3505 SetLocalDescriptionWithDataChannel(); |
| 3470 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); | 3506 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); |
| 3471 } | 3507 } |
| 3472 | 3508 |
| 3473 TEST_F(WebRtcSessionTest, TestRtpDataChannelConstraintTakesPrecedence) { | 3509 TEST_P(WebRtcSessionTest, TestRtpDataChannelConstraintTakesPrecedence) { |
| 3474 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3510 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3475 | 3511 |
| 3476 constraints_.reset(new FakeConstraints()); | 3512 constraints_.reset(new FakeConstraints()); |
| 3477 constraints_->AddOptional( | 3513 constraints_->AddOptional( |
| 3478 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); | 3514 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); |
| 3479 options_.disable_sctp_data_channels = false; | 3515 options_.disable_sctp_data_channels = false; |
| 3480 | 3516 |
| 3481 InitWithDtls(); | 3517 InitWithDtlsCertSuccess(GetParam()); |
| 3482 | 3518 |
| 3483 SetLocalDescriptionWithDataChannel(); | 3519 SetLocalDescriptionWithDataChannel(); |
| 3484 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); | 3520 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); |
| 3485 } | 3521 } |
| 3486 | 3522 |
| 3487 TEST_F(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) { | 3523 TEST_P(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) { |
| 3488 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3524 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3489 | 3525 |
| 3490 InitWithDtls(); | 3526 InitWithDtlsCertSuccess(GetParam()); |
| 3491 | 3527 |
| 3492 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3528 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
| 3493 EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL); | 3529 EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL); |
| 3494 EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL); | 3530 EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL); |
| 3495 } | 3531 } |
| 3496 | 3532 |
| 3497 TEST_F(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) { | 3533 TEST_P(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) { |
| 3498 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3534 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3499 SetFactoryDtlsSrtp(); | 3535 SetFactoryDtlsSrtp(); |
| 3500 InitWithDtls(); | 3536 InitWithDtlsCertSuccess(GetParam()); |
| 3501 | 3537 |
| 3502 // Create remote offer with SCTP. | 3538 // Create remote offer with SCTP. |
| 3503 cricket::MediaSessionOptions options; | 3539 cricket::MediaSessionOptions options; |
| 3504 options.data_channel_type = cricket::DCT_SCTP; | 3540 options.data_channel_type = cricket::DCT_SCTP; |
| 3505 JsepSessionDescription* offer = | 3541 JsepSessionDescription* offer = |
| 3506 CreateRemoteOffer(options, cricket::SEC_DISABLED); | 3542 CreateRemoteOffer(options, cricket::SEC_DISABLED); |
| 3507 SetRemoteDescriptionWithoutError(offer); | 3543 SetRemoteDescriptionWithoutError(offer); |
| 3508 | 3544 |
| 3509 // Verifies the answer contains SCTP. | 3545 // Verifies the answer contains SCTP. |
| 3510 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); | 3546 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); |
| 3511 EXPECT_TRUE(answer != NULL); | 3547 EXPECT_TRUE(answer != NULL); |
| 3512 EXPECT_TRUE(answer->description()->GetContentByName("data") != NULL); | 3548 EXPECT_TRUE(answer->description()->GetContentByName("data") != NULL); |
| 3513 EXPECT_TRUE(answer->description()->GetTransportInfoByName("data") != NULL); | 3549 EXPECT_TRUE(answer->description()->GetTransportInfoByName("data") != NULL); |
| 3514 } | 3550 } |
| 3515 | 3551 |
| 3516 TEST_F(WebRtcSessionTest, TestSctpDataChannelWithoutDtls) { | 3552 TEST_P(WebRtcSessionTest, TestSctpDataChannelWithoutDtls) { |
| 3517 constraints_.reset(new FakeConstraints()); | 3553 constraints_.reset(new FakeConstraints()); |
| 3518 constraints_->AddOptional( | 3554 constraints_->AddOptional( |
| 3519 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); | 3555 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); |
| 3520 InitWithDtls(); | 3556 InitWithDtlsCertSuccess(GetParam()); |
| 3521 | 3557 |
| 3522 SetLocalDescriptionWithDataChannel(); | 3558 SetLocalDescriptionWithDataChannel(); |
| 3523 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); | 3559 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); |
| 3524 } | 3560 } |
| 3525 | 3561 |
| 3526 TEST_F(WebRtcSessionTest, TestSctpDataChannelWithDtls) { | 3562 TEST_P(WebRtcSessionTest, TestSctpDataChannelWithDtls) { |
| 3527 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3563 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3528 | 3564 |
| 3529 InitWithDtls(); | 3565 InitWithDtlsCertSuccess(GetParam()); |
| 3530 | 3566 |
| 3531 SetLocalDescriptionWithDataChannel(); | 3567 SetLocalDescriptionWithDataChannel(); |
| 3532 EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type()); | 3568 EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type()); |
| 3533 } | 3569 } |
| 3534 | 3570 |
| 3535 TEST_F(WebRtcSessionTest, TestDisableSctpDataChannels) { | 3571 TEST_P(WebRtcSessionTest, TestDisableSctpDataChannels) { |
| 3536 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3572 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3537 options_.disable_sctp_data_channels = true; | 3573 options_.disable_sctp_data_channels = true; |
| 3538 InitWithDtls(); | 3574 InitWithDtlsCertSuccess(GetParam()); |
| 3539 | 3575 |
| 3540 SetLocalDescriptionWithDataChannel(); | 3576 SetLocalDescriptionWithDataChannel(); |
| 3541 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); | 3577 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); |
| 3542 } | 3578 } |
| 3543 | 3579 |
| 3544 TEST_F(WebRtcSessionTest, TestSctpDataChannelSendPortParsing) { | 3580 TEST_P(WebRtcSessionTest, TestSctpDataChannelSendPortParsing) { |
| 3545 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3581 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3546 const int new_send_port = 9998; | 3582 const int new_send_port = 9998; |
| 3547 const int new_recv_port = 7775; | 3583 const int new_recv_port = 7775; |
| 3548 | 3584 |
| 3549 InitWithDtls(); | 3585 InitWithDtlsCertSuccess(GetParam()); |
| 3550 SetFactoryDtlsSrtp(); | 3586 SetFactoryDtlsSrtp(); |
| 3551 | 3587 |
| 3552 // By default, don't actually add the codecs to desc_factory_; they don't | 3588 // By default, don't actually add the codecs to desc_factory_; they don't |
| 3553 // actually get serialized for SCTP in BuildMediaDescription(). Instead, | 3589 // actually get serialized for SCTP in BuildMediaDescription(). Instead, |
| 3554 // let the session description get parsed. That'll get the proper codecs | 3590 // let the session description get parsed. That'll get the proper codecs |
| 3555 // into the stream. | 3591 // into the stream. |
| 3556 cricket::MediaSessionOptions options; | 3592 cricket::MediaSessionOptions options; |
| 3557 JsepSessionDescription* offer = CreateRemoteOfferWithSctpPort( | 3593 JsepSessionDescription* offer = CreateRemoteOfferWithSctpPort( |
| 3558 "stream1", new_send_port, options); | 3594 "stream1", new_send_port, options); |
| 3559 | 3595 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3588 | 3624 |
| 3589 ASSERT_EQ(1UL, ch->recv_codecs().size()); | 3625 ASSERT_EQ(1UL, ch->recv_codecs().size()); |
| 3590 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); | 3626 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); |
| 3591 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, | 3627 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, |
| 3592 ch->recv_codecs()[0].name.c_str())); | 3628 ch->recv_codecs()[0].name.c_str())); |
| 3593 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, | 3629 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, |
| 3594 &portnum)); | 3630 &portnum)); |
| 3595 EXPECT_EQ(new_recv_port, portnum); | 3631 EXPECT_EQ(new_recv_port, portnum); |
| 3596 } | 3632 } |
| 3597 | 3633 |
| 3634 // Verifies that if a certificate is provided it is the one that will be used. |
| 3635 TEST_F(WebRtcSessionTest, TestUsesProvidedCertificate) { |
| 3636 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate = |
| 3637 FakeDtlsIdentityStore::GenerateCertificate(); |
| 3638 |
| 3639 PeerConnectionInterface::RTCConfiguration configuration; |
| 3640 Init(nullptr, certificate, configuration); |
| 3641 EXPECT_TRUE_WAIT(!session_->IsWaitingForCertificate(), 1000); |
| 3642 |
| 3643 EXPECT_EQ(session_->certificate(), certificate); |
| 3644 } |
| 3645 |
| 3598 // Verifies that CreateOffer succeeds when CreateOffer is called before async | 3646 // Verifies that CreateOffer succeeds when CreateOffer is called before async |
| 3599 // identity generation is finished. | 3647 // identity generation is finished (even if a certificate is provided this is |
| 3600 TEST_F(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { | 3648 // an async op). |
| 3649 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { |
| 3601 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3650 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3602 InitWithDtls(); | 3651 InitWithDtlsCertSuccess(GetParam()); |
| 3603 | 3652 |
| 3604 EXPECT_TRUE(session_->waiting_for_identity()); | 3653 EXPECT_TRUE(session_->IsWaitingForCertificate()); |
| 3605 mediastream_signaling_.SendAudioVideoStream1(); | 3654 mediastream_signaling_.SendAudioVideoStream1(); |
| 3606 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3655 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
| 3607 | 3656 |
| 3608 EXPECT_TRUE(offer != NULL); | 3657 EXPECT_TRUE(offer != NULL); |
| 3609 VerifyNoCryptoParams(offer->description(), true); | 3658 VerifyNoCryptoParams(offer->description(), true); |
| 3610 VerifyFingerprintStatus(offer->description(), true); | 3659 VerifyFingerprintStatus(offer->description(), true); |
| 3611 } | 3660 } |
| 3612 | 3661 |
| 3613 // Verifies that CreateAnswer succeeds when CreateOffer is called before async | 3662 // Verifies that CreateAnswer succeeds when CreateOffer is called before async |
| 3614 // identity generation is finished. | 3663 // identity generation is finished (even if a certificate is provided this is |
| 3615 TEST_F(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) { | 3664 // an async op). |
| 3665 TEST_P(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) { |
| 3616 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3666 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3617 InitWithDtls(); | 3667 InitWithDtlsCertSuccess(GetParam()); |
| 3618 SetFactoryDtlsSrtp(); | 3668 SetFactoryDtlsSrtp(); |
| 3619 | 3669 |
| 3620 cricket::MediaSessionOptions options; | 3670 cricket::MediaSessionOptions options; |
| 3621 options.recv_video = true; | 3671 options.recv_video = true; |
| 3622 scoped_ptr<JsepSessionDescription> offer( | 3672 scoped_ptr<JsepSessionDescription> offer( |
| 3623 CreateRemoteOffer(options, cricket::SEC_DISABLED)); | 3673 CreateRemoteOffer(options, cricket::SEC_DISABLED)); |
| 3624 ASSERT_TRUE(offer.get() != NULL); | 3674 ASSERT_TRUE(offer.get() != NULL); |
| 3625 SetRemoteDescriptionWithoutError(offer.release()); | 3675 SetRemoteDescriptionWithoutError(offer.release()); |
| 3626 | 3676 |
| 3627 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); | 3677 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); |
| 3628 EXPECT_TRUE(answer != NULL); | 3678 EXPECT_TRUE(answer != NULL); |
| 3629 VerifyNoCryptoParams(answer->description(), true); | 3679 VerifyNoCryptoParams(answer->description(), true); |
| 3630 VerifyFingerprintStatus(answer->description(), true); | 3680 VerifyFingerprintStatus(answer->description(), true); |
| 3631 } | 3681 } |
| 3632 | 3682 |
| 3633 // Verifies that CreateOffer succeeds when CreateOffer is called after async | 3683 // Verifies that CreateOffer succeeds when CreateOffer is called after async |
| 3634 // identity generation is finished. | 3684 // identity generation is finished (even if a certificate is provided this is |
| 3635 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { | 3685 // an async op). |
| 3686 TEST_P(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { |
| 3636 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3687 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3637 InitWithDtls(); | 3688 InitWithDtlsCertSuccess(GetParam()); |
| 3638 | 3689 |
| 3639 EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000); | 3690 EXPECT_TRUE_WAIT(!session_->IsWaitingForCertificate(), 1000); |
| 3640 | 3691 |
| 3641 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3692 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
| 3642 EXPECT_TRUE(offer != NULL); | 3693 EXPECT_TRUE(offer != NULL); |
| 3643 } | 3694 } |
| 3644 | 3695 |
| 3645 // Verifies that CreateOffer fails when CreateOffer is called after async | 3696 // Verifies that CreateOffer fails when CreateOffer is called after async |
| 3646 // identity generation fails. | 3697 // identity generation fails. |
| 3647 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { | 3698 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { |
| 3648 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3699 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3649 InitWithDtls(true); | 3700 InitWithDtlsCertGenFailure(); |
| 3650 | 3701 |
| 3651 EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000); | 3702 EXPECT_TRUE_WAIT(!session_->IsWaitingForCertificate(), 1000); |
| 3652 | 3703 |
| 3653 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3704 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
| 3654 EXPECT_TRUE(offer == NULL); | 3705 EXPECT_TRUE(offer == NULL); |
| 3655 } | 3706 } |
| 3656 | 3707 |
| 3657 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made | 3708 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made |
| 3658 // before async identity generation is finished. | 3709 // before async identity generation is finished. |
| 3659 TEST_F(WebRtcSessionTest, | 3710 TEST_F(WebRtcSessionTest, |
| 3660 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) { | 3711 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) { |
| 3661 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3712 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3781 | 3832 |
| 3782 ASSERT_TRUE(voice_channel_ != NULL); | 3833 ASSERT_TRUE(voice_channel_ != NULL); |
| 3783 cricket::AudioOptions audio_options; | 3834 cricket::AudioOptions audio_options; |
| 3784 EXPECT_TRUE(voice_channel_->GetOptions(&audio_options)); | 3835 EXPECT_TRUE(voice_channel_->GetOptions(&audio_options)); |
| 3785 EXPECT_TRUE( | 3836 EXPECT_TRUE( |
| 3786 audio_options.combined_audio_video_bwe.GetWithDefaultIfUnset(false)); | 3837 audio_options.combined_audio_video_bwe.GetWithDefaultIfUnset(false)); |
| 3787 } | 3838 } |
| 3788 | 3839 |
| 3789 // Tests that we can renegotiate new media content with ICE candidates in the | 3840 // Tests that we can renegotiate new media content with ICE candidates in the |
| 3790 // new remote SDP. | 3841 // new remote SDP. |
| 3791 TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { | 3842 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { |
| 3792 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3843 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3793 InitWithDtls(); | 3844 InitWithDtlsCertSuccess(GetParam()); |
| 3794 SetFactoryDtlsSrtp(); | 3845 SetFactoryDtlsSrtp(); |
| 3795 | 3846 |
| 3796 mediastream_signaling_.UseOptionsAudioOnly(); | 3847 mediastream_signaling_.UseOptionsAudioOnly(); |
| 3797 SessionDescriptionInterface* offer = CreateOffer(); | 3848 SessionDescriptionInterface* offer = CreateOffer(); |
| 3798 SetLocalDescriptionWithoutError(offer); | 3849 SetLocalDescriptionWithoutError(offer); |
| 3799 | 3850 |
| 3800 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); | 3851 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); |
| 3801 SetRemoteDescriptionWithoutError(answer); | 3852 SetRemoteDescriptionWithoutError(answer); |
| 3802 | 3853 |
| 3803 cricket::MediaSessionOptions options; | 3854 cricket::MediaSessionOptions options; |
| 3804 options.recv_video = true; | 3855 options.recv_video = true; |
| 3805 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); | 3856 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); |
| 3806 | 3857 |
| 3807 cricket::Candidate candidate1; | 3858 cricket::Candidate candidate1; |
| 3808 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 3859 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
| 3809 candidate1.set_component(1); | 3860 candidate1.set_component(1); |
| 3810 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 3861 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
| 3811 candidate1); | 3862 candidate1); |
| 3812 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); | 3863 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); |
| 3813 SetRemoteDescriptionWithoutError(offer); | 3864 SetRemoteDescriptionWithoutError(offer); |
| 3814 | 3865 |
| 3815 answer = CreateAnswer(NULL); | 3866 answer = CreateAnswer(NULL); |
| 3816 SetLocalDescriptionWithoutError(answer); | 3867 SetLocalDescriptionWithoutError(answer); |
| 3817 } | 3868 } |
| 3818 | 3869 |
| 3819 // Tests that we can renegotiate new media content with ICE candidates separated | 3870 // Tests that we can renegotiate new media content with ICE candidates separated |
| 3820 // from the remote SDP. | 3871 // from the remote SDP. |
| 3821 TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) { | 3872 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) { |
| 3822 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3873 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3823 InitWithDtls(); | 3874 InitWithDtlsCertSuccess(GetParam()); |
| 3824 SetFactoryDtlsSrtp(); | 3875 SetFactoryDtlsSrtp(); |
| 3825 | 3876 |
| 3826 mediastream_signaling_.UseOptionsAudioOnly(); | 3877 mediastream_signaling_.UseOptionsAudioOnly(); |
| 3827 SessionDescriptionInterface* offer = CreateOffer(); | 3878 SessionDescriptionInterface* offer = CreateOffer(); |
| 3828 SetLocalDescriptionWithoutError(offer); | 3879 SetLocalDescriptionWithoutError(offer); |
| 3829 | 3880 |
| 3830 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); | 3881 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); |
| 3831 SetRemoteDescriptionWithoutError(answer); | 3882 SetRemoteDescriptionWithoutError(answer); |
| 3832 | 3883 |
| 3833 cricket::MediaSessionOptions options; | 3884 cricket::MediaSessionOptions options; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3927 options.offer_to_receive_audio = | 3978 options.offer_to_receive_audio = |
| 3928 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; | 3979 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; |
| 3929 | 3980 |
| 3930 for (auto& o : observers) { | 3981 for (auto& o : observers) { |
| 3931 o = new WebRtcSessionCreateSDPObserverForTest(); | 3982 o = new WebRtcSessionCreateSDPObserverForTest(); |
| 3932 session_->CreateOffer(o, options); | 3983 session_->CreateOffer(o, options); |
| 3933 } | 3984 } |
| 3934 | 3985 |
| 3935 session_.reset(); | 3986 session_.reset(); |
| 3936 | 3987 |
| 3937 // Make sure we process pending messages on the current (signaling) thread | |
| 3938 // before checking we we got our callbacks. Quit() will do this and then | |
| 3939 // immediately exit. We won't need the queue after this point anyway. | |
| 3940 rtc::Thread::Current()->Quit(); | |
| 3941 | |
| 3942 for (auto& o : observers) { | 3988 for (auto& o : observers) { |
| 3943 // We expect to have received a notification now even if the session was | 3989 // We expect to have received a notification now even if the session was |
| 3944 // terminated. The offer creation may or may not have succeeded, but we | 3990 // terminated. The offer creation may or may not have succeeded, but we |
| 3945 // must have received a notification which, so the only invalid state | 3991 // must have received a notification which, so the only invalid state |
| 3946 // is kInit. | 3992 // is kInit. |
| 3947 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); | 3993 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); |
| 3948 } | 3994 } |
| 3949 } | 3995 } |
| 3950 | 3996 |
| 3951 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 3997 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 3952 // currently fails because upon disconnection and reconnection OnIceComplete is | 3998 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 3953 // called more than once without returning to IceGatheringGathering. | 3999 // called more than once without returning to IceGatheringGathering. |
| 4000 |
| 4001 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
| 4002 WebRtcSessionTest, |
| 4003 testing::Values(PRE_GENERATED, DTLS_IDENTITY_STORE)); |
| OLD | NEW |