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 identity_.reset(rtc::SSLIdentity::Generate(identity_name)); | 575 certificate_ = webrtc::DtlsCertificate::Create( |
544 tdesc_factory_->set_identity(identity_.get()); | 576 rtc::scoped_ptr<rtc::SSLIdentity>( |
577 rtc::SSLIdentity::Generate(identity_name)).Pass()); | |
578 tdesc_factory_->set_certificate(certificate_); | |
545 tdesc_factory_->set_secure(cricket::SEC_REQUIRED); | 579 tdesc_factory_->set_secure(cricket::SEC_REQUIRED); |
546 } | 580 } |
547 | 581 |
548 void VerifyFingerprintStatus(const cricket::SessionDescription* sdp, | 582 void VerifyFingerprintStatus(const cricket::SessionDescription* sdp, |
549 bool expected) { | 583 bool expected) { |
550 const TransportInfo* audio = sdp->GetTransportInfoByName("audio"); | 584 const TransportInfo* audio = sdp->GetTransportInfoByName("audio"); |
551 ASSERT_TRUE(audio != NULL); | 585 ASSERT_TRUE(audio != NULL); |
552 ASSERT_EQ(expected, audio->description.identity_fingerprint.get() != NULL); | 586 ASSERT_EQ(expected, audio->description.identity_fingerprint.get() != NULL); |
553 const TransportInfo* video = sdp->GetTransportInfoByName("video"); | 587 const TransportInfo* video = sdp->GetTransportInfoByName("video"); |
554 ASSERT_TRUE(video != NULL); | 588 ASSERT_TRUE(video != NULL); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1178 void SetLocalDescriptionWithDataChannel() { | 1212 void SetLocalDescriptionWithDataChannel() { |
1179 webrtc::InternalDataChannelInit dci; | 1213 webrtc::InternalDataChannelInit dci; |
1180 dci.reliable = false; | 1214 dci.reliable = false; |
1181 session_->CreateDataChannel("datachannel", &dci); | 1215 session_->CreateDataChannel("datachannel", &dci); |
1182 SessionDescriptionInterface* offer = CreateOffer(); | 1216 SessionDescriptionInterface* offer = CreateOffer(); |
1183 SetLocalDescriptionWithoutError(offer); | 1217 SetLocalDescriptionWithoutError(offer); |
1184 } | 1218 } |
1185 | 1219 |
1186 void VerifyMultipleAsyncCreateDescription( | 1220 void VerifyMultipleAsyncCreateDescription( |
1187 bool success, CreateSessionDescriptionRequest::Type type) { | 1221 bool success, CreateSessionDescriptionRequest::Type type) { |
1188 InitWithDtls(!success); | 1222 if (success) |
1223 InitWithDtlsCertSuccess(DTLS_IDENTITY_STORE); | |
1224 else | |
1225 InitWithDtlsCertGenFailure(); | |
1189 SetFactoryDtlsSrtp(); | 1226 SetFactoryDtlsSrtp(); |
1190 if (type == CreateSessionDescriptionRequest::kAnswer) { | 1227 if (type == CreateSessionDescriptionRequest::kAnswer) { |
1191 cricket::MediaSessionOptions options; | 1228 cricket::MediaSessionOptions options; |
1192 scoped_ptr<JsepSessionDescription> offer( | 1229 scoped_ptr<JsepSessionDescription> offer( |
1193 CreateRemoteOffer(options, cricket::SEC_DISABLED)); | 1230 CreateRemoteOffer(options, cricket::SEC_DISABLED)); |
1194 ASSERT_TRUE(offer.get() != NULL); | 1231 ASSERT_TRUE(offer.get() != NULL); |
1195 SetRemoteDescriptionWithoutError(offer.release()); | 1232 SetRemoteDescriptionWithoutError(offer.release()); |
1196 } | 1233 } |
1197 | 1234 |
1198 PeerConnectionInterface::RTCOfferAnswerOptions options; | 1235 PeerConnectionInterface::RTCOfferAnswerOptions options; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1232 allocator_->set_step_delay(cricket::kMinimumStepDelay); | 1269 allocator_->set_step_delay(cricket::kMinimumStepDelay); |
1233 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | | 1270 allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | |
1234 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); | 1271 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); |
1235 } | 1272 } |
1236 | 1273 |
1237 cricket::FakeMediaEngine* media_engine_; | 1274 cricket::FakeMediaEngine* media_engine_; |
1238 cricket::FakeDataEngine* data_engine_; | 1275 cricket::FakeDataEngine* data_engine_; |
1239 cricket::FakeDeviceManager* device_manager_; | 1276 cricket::FakeDeviceManager* device_manager_; |
1240 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; | 1277 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; |
1241 rtc::scoped_ptr<cricket::TransportDescriptionFactory> tdesc_factory_; | 1278 rtc::scoped_ptr<cricket::TransportDescriptionFactory> tdesc_factory_; |
1242 rtc::scoped_ptr<rtc::SSLIdentity> identity_; | 1279 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate_; |
1243 rtc::scoped_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_; | 1280 rtc::scoped_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_; |
1244 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; | 1281 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; |
1245 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; | 1282 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; |
1246 rtc::scoped_ptr<rtc::FirewallSocketServer> fss_; | 1283 rtc::scoped_ptr<rtc::FirewallSocketServer> fss_; |
1247 rtc::SocketServerScope ss_scope_; | 1284 rtc::SocketServerScope ss_scope_; |
1248 rtc::SocketAddress stun_socket_addr_; | 1285 rtc::SocketAddress stun_socket_addr_; |
1249 rtc::scoped_ptr<cricket::TestStunServer> stun_server_; | 1286 rtc::scoped_ptr<cricket::TestStunServer> stun_server_; |
1250 cricket::TestTurnServer turn_server_; | 1287 cricket::TestTurnServer turn_server_; |
1251 rtc::FakeNetworkManager network_manager_; | 1288 rtc::FakeNetworkManager network_manager_; |
1252 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; | 1289 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; |
1253 PeerConnectionFactoryInterface::Options options_; | 1290 PeerConnectionFactoryInterface::Options options_; |
1254 rtc::scoped_ptr<FakeConstraints> constraints_; | 1291 rtc::scoped_ptr<FakeConstraints> constraints_; |
1255 FakeMediaStreamSignaling mediastream_signaling_; | 1292 FakeMediaStreamSignaling mediastream_signaling_; |
1256 rtc::scoped_ptr<WebRtcSessionForTest> session_; | 1293 rtc::scoped_ptr<WebRtcSessionForTest> session_; |
1257 MockIceObserver observer_; | 1294 MockIceObserver observer_; |
1258 cricket::FakeVideoMediaChannel* video_channel_; | 1295 cricket::FakeVideoMediaChannel* video_channel_; |
1259 cricket::FakeVoiceMediaChannel* voice_channel_; | 1296 cricket::FakeVoiceMediaChannel* voice_channel_; |
1260 rtc::scoped_refptr<FakeMetricsObserver> metrics_observer_; | 1297 rtc::scoped_refptr<FakeMetricsObserver> metrics_observer_; |
1261 }; | 1298 }; |
1262 | 1299 |
1263 TEST_F(WebRtcSessionTest, TestInitializeWithDtls) { | 1300 TEST_P(WebRtcSessionTest, TestInitializeWithDtls) { |
1264 InitWithDtls(); | 1301 InitWithDtlsCertSuccess(GetParam()); |
1265 // SDES is disabled when DTLS is on. | 1302 // SDES is disabled when DTLS is on. |
1266 EXPECT_EQ(cricket::SEC_DISABLED, session_->SdesPolicy()); | 1303 EXPECT_EQ(cricket::SEC_DISABLED, session_->SdesPolicy()); |
1267 } | 1304 } |
1268 | 1305 |
1269 TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) { | 1306 TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) { |
1270 Init(); | 1307 Init(); |
1271 // SDES is required if DTLS is off. | 1308 // SDES is required if DTLS is off. |
1272 EXPECT_EQ(cricket::SEC_REQUIRED, session_->SdesPolicy()); | 1309 EXPECT_EQ(cricket::SEC_REQUIRED, session_->SdesPolicy()); |
1273 } | 1310 } |
1274 | 1311 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1561 SessionDescriptionInterface* answer = NULL; | 1598 SessionDescriptionInterface* answer = NULL; |
1562 CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer); | 1599 CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer); |
1563 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1600 // SetRemoteDescription and SetLocalDescription will take the ownership of |
1564 // the offer. | 1601 // the offer. |
1565 SetLocalDescriptionWithoutError(offer); | 1602 SetLocalDescriptionWithoutError(offer); |
1566 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer); | 1603 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer); |
1567 } | 1604 } |
1568 | 1605 |
1569 // 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 |
1570 // and that we return an answer with a DTLS fingerprint. | 1607 // and that we return an answer with a DTLS fingerprint. |
1571 TEST_F(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) { | 1608 TEST_P(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) { |
1572 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1609 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1573 mediastream_signaling_.SendAudioVideoStream1(); | 1610 mediastream_signaling_.SendAudioVideoStream1(); |
1574 InitWithDtls(); | 1611 InitWithDtlsCertSuccess(GetParam()); |
1575 SetFactoryDtlsSrtp(); | 1612 SetFactoryDtlsSrtp(); |
1576 cricket::MediaSessionOptions options; | 1613 cricket::MediaSessionOptions options; |
1577 options.recv_video = true; | 1614 options.recv_video = true; |
1578 JsepSessionDescription* offer = | 1615 JsepSessionDescription* offer = |
1579 CreateRemoteOffer(options, cricket::SEC_DISABLED); | 1616 CreateRemoteOffer(options, cricket::SEC_DISABLED); |
1580 ASSERT_TRUE(offer != NULL); | 1617 ASSERT_TRUE(offer != NULL); |
1581 VerifyFingerprintStatus(offer->description(), true); | 1618 VerifyFingerprintStatus(offer->description(), true); |
1582 VerifyNoCryptoParams(offer->description(), true); | 1619 VerifyNoCryptoParams(offer->description(), true); |
1583 | 1620 |
1584 // SetRemoteDescription will take the ownership of the offer. | 1621 // SetRemoteDescription will take the ownership of the offer. |
1585 SetRemoteDescriptionWithoutError(offer); | 1622 SetRemoteDescriptionWithoutError(offer); |
1586 | 1623 |
1587 // Verify that we get a crypto fingerprint in the answer. | 1624 // Verify that we get a crypto fingerprint in the answer. |
1588 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 1625 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
1589 ASSERT_TRUE(answer != NULL); | 1626 ASSERT_TRUE(answer != NULL); |
1590 VerifyFingerprintStatus(answer->description(), true); | 1627 VerifyFingerprintStatus(answer->description(), true); |
1591 // 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. |
1592 VerifyNoCryptoParams(answer->description(), true); | 1629 VerifyNoCryptoParams(answer->description(), true); |
1593 | 1630 |
1594 // 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. |
1595 SetLocalDescriptionWithoutError(answer); | 1632 SetLocalDescriptionWithoutError(answer); |
1596 } | 1633 } |
1597 | 1634 |
1598 // 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 |
1599 // 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. |
1600 TEST_F(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) { | 1637 TEST_P(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) { |
1601 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1638 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1602 mediastream_signaling_.SendAudioVideoStream1(); | 1639 mediastream_signaling_.SendAudioVideoStream1(); |
1603 InitWithDtls(); | 1640 InitWithDtlsCertSuccess(GetParam()); |
1604 SetFactoryDtlsSrtp(); | 1641 SetFactoryDtlsSrtp(); |
1605 | 1642 |
1606 // Verify that we get a crypto fingerprint in the answer. | 1643 // Verify that we get a crypto fingerprint in the answer. |
1607 SessionDescriptionInterface* offer = CreateOffer(); | 1644 SessionDescriptionInterface* offer = CreateOffer(); |
1608 ASSERT_TRUE(offer != NULL); | 1645 ASSERT_TRUE(offer != NULL); |
1609 VerifyFingerprintStatus(offer->description(), true); | 1646 VerifyFingerprintStatus(offer->description(), true); |
1610 // 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. |
1611 VerifyNoCryptoParams(offer->description(), true); | 1648 VerifyNoCryptoParams(offer->description(), true); |
1612 | 1649 |
1613 // 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. |
1614 SetLocalDescriptionWithoutError(offer); | 1651 SetLocalDescriptionWithoutError(offer); |
1615 | 1652 |
1616 cricket::MediaSessionOptions options; | 1653 cricket::MediaSessionOptions options; |
1617 options.recv_video = true; | 1654 options.recv_video = true; |
1618 JsepSessionDescription* answer = | 1655 JsepSessionDescription* answer = |
1619 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); | 1656 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
1620 ASSERT_TRUE(answer != NULL); | 1657 ASSERT_TRUE(answer != NULL); |
1621 VerifyFingerprintStatus(answer->description(), true); | 1658 VerifyFingerprintStatus(answer->description(), true); |
1622 VerifyNoCryptoParams(answer->description(), true); | 1659 VerifyNoCryptoParams(answer->description(), true); |
1623 | 1660 |
1624 // SetRemoteDescription will take the ownership of the answer. | 1661 // SetRemoteDescription will take the ownership of the answer. |
1625 SetRemoteDescriptionWithoutError(answer); | 1662 SetRemoteDescriptionWithoutError(answer); |
1626 } | 1663 } |
1627 | 1664 |
1628 // 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, |
1629 // we will fail to set the remote description. | 1666 // we will fail to set the remote description. |
1630 TEST_F(WebRtcSessionTest, TestReceiveNonDtlsOfferWhenDtlsOn) { | 1667 TEST_P(WebRtcSessionTest, TestReceiveNonDtlsOfferWhenDtlsOn) { |
1631 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1668 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1632 InitWithDtls(); | 1669 InitWithDtlsCertSuccess(GetParam()); |
1633 cricket::MediaSessionOptions options; | 1670 cricket::MediaSessionOptions options; |
1634 options.recv_video = true; | 1671 options.recv_video = true; |
1635 options.bundle_enabled = true; | 1672 options.bundle_enabled = true; |
1636 JsepSessionDescription* offer = CreateRemoteOffer( | 1673 JsepSessionDescription* offer = CreateRemoteOffer( |
1637 options, cricket::SEC_REQUIRED); | 1674 options, cricket::SEC_REQUIRED); |
1638 ASSERT_TRUE(offer != NULL); | 1675 ASSERT_TRUE(offer != NULL); |
1639 VerifyFingerprintStatus(offer->description(), false); | 1676 VerifyFingerprintStatus(offer->description(), false); |
1640 VerifyCryptoParams(offer->description()); | 1677 VerifyCryptoParams(offer->description()); |
1641 | 1678 |
1642 // SetRemoteDescription will take the ownership of the offer. | 1679 // SetRemoteDescription will take the ownership of the offer. |
1643 SetRemoteDescriptionOfferExpectError( | 1680 SetRemoteDescriptionOfferExpectError( |
1644 kSdpWithoutDtlsFingerprint, offer); | 1681 kSdpWithoutDtlsFingerprint, offer); |
1645 | 1682 |
1646 offer = CreateRemoteOffer(options, cricket::SEC_REQUIRED); | 1683 offer = CreateRemoteOffer(options, cricket::SEC_REQUIRED); |
1647 // SetLocalDescription will take the ownership of the offer. | 1684 // SetLocalDescription will take the ownership of the offer. |
1648 SetLocalDescriptionOfferExpectError( | 1685 SetLocalDescriptionOfferExpectError( |
1649 kSdpWithoutDtlsFingerprint, offer); | 1686 kSdpWithoutDtlsFingerprint, offer); |
1650 } | 1687 } |
1651 | 1688 |
1652 // 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 |
1653 // a DTLS fingerprint when DTLS is required. | 1690 // a DTLS fingerprint when DTLS is required. |
1654 TEST_F(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) { | 1691 TEST_P(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) { |
1655 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1692 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1656 InitWithDtls(); | 1693 InitWithDtlsCertSuccess(GetParam()); |
1657 SessionDescriptionInterface* offer = NULL; | 1694 SessionDescriptionInterface* offer = NULL; |
1658 SessionDescriptionInterface* answer = NULL; | 1695 SessionDescriptionInterface* answer = NULL; |
1659 CreateDtlsOfferAndNonDtlsAnswer(&offer, &answer); | 1696 CreateDtlsOfferAndNonDtlsAnswer(&offer, &answer); |
1660 | 1697 |
1661 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1698 // SetRemoteDescription and SetLocalDescription will take the ownership of |
1662 // the offer and answer. | 1699 // the offer and answer. |
1663 SetRemoteDescriptionWithoutError(offer); | 1700 SetRemoteDescriptionWithoutError(offer); |
1664 SetLocalDescriptionAnswerExpectError( | 1701 SetLocalDescriptionAnswerExpectError( |
1665 kSdpWithoutDtlsFingerprint, answer); | 1702 kSdpWithoutDtlsFingerprint, answer); |
1666 } | 1703 } |
1667 | 1704 |
1668 // 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 |
1669 // a DTLS fingerprint when DTLS is required. | 1706 // a DTLS fingerprint when DTLS is required. |
1670 TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) { | 1707 TEST_P(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) { |
1671 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1708 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1672 // 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 |
1673 // result of using the "UDP/TLS/RTP/SAVPF" profile. | 1710 // result of using the "UDP/TLS/RTP/SAVPF" profile. |
1674 InitWithDtls(); | 1711 InitWithDtlsCertSuccess(GetParam()); |
1675 session_->SetSdesPolicy(cricket::SEC_ENABLED); | 1712 session_->SetSdesPolicy(cricket::SEC_ENABLED); |
1676 SessionDescriptionInterface* offer = CreateOffer(); | 1713 SessionDescriptionInterface* offer = CreateOffer(); |
1677 cricket::MediaSessionOptions options; | 1714 cricket::MediaSessionOptions options; |
1678 options.recv_video = true; | 1715 options.recv_video = true; |
1679 JsepSessionDescription* answer = | 1716 JsepSessionDescription* answer = |
1680 CreateRemoteAnswer(offer, options, cricket::SEC_ENABLED); | 1717 CreateRemoteAnswer(offer, options, cricket::SEC_ENABLED); |
1681 | 1718 |
1682 // SetRemoteDescription and SetLocalDescription will take the ownership of | 1719 // SetRemoteDescription and SetLocalDescription will take the ownership of |
1683 // the offer and answer. | 1720 // the offer and answer. |
1684 SetLocalDescriptionWithoutError(offer); | 1721 SetLocalDescriptionWithoutError(offer); |
1685 SetRemoteDescriptionAnswerExpectError( | 1722 SetRemoteDescriptionAnswerExpectError( |
1686 kSdpWithoutDtlsFingerprint, answer); | 1723 kSdpWithoutDtlsFingerprint, answer); |
1687 } | 1724 } |
1688 | 1725 |
1689 // 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 |
1690 // answer without SDES or DTLS when encryption is disabled. | 1727 // answer without SDES or DTLS when encryption is disabled. |
1691 TEST_F(WebRtcSessionTest, TestCreateOfferReceiveAnswerWithoutEncryption) { | 1728 TEST_P(WebRtcSessionTest, TestCreateOfferReceiveAnswerWithoutEncryption) { |
1692 mediastream_signaling_.SendAudioVideoStream1(); | 1729 mediastream_signaling_.SendAudioVideoStream1(); |
1693 options_.disable_encryption = true; | 1730 options_.disable_encryption = true; |
1694 InitWithDtls(); | 1731 InitWithDtlsCertSuccess(GetParam()); |
1695 | 1732 |
1696 // Verify that we get a crypto fingerprint in the answer. | 1733 // Verify that we get a crypto fingerprint in the answer. |
1697 SessionDescriptionInterface* offer = CreateOffer(); | 1734 SessionDescriptionInterface* offer = CreateOffer(); |
1698 ASSERT_TRUE(offer != NULL); | 1735 ASSERT_TRUE(offer != NULL); |
1699 VerifyFingerprintStatus(offer->description(), false); | 1736 VerifyFingerprintStatus(offer->description(), false); |
1700 // 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. |
1701 VerifyNoCryptoParams(offer->description(), false); | 1738 VerifyNoCryptoParams(offer->description(), false); |
1702 | 1739 |
1703 // 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. |
1704 SetLocalDescriptionWithoutError(offer); | 1741 SetLocalDescriptionWithoutError(offer); |
1705 | 1742 |
1706 cricket::MediaSessionOptions options; | 1743 cricket::MediaSessionOptions options; |
1707 options.recv_video = true; | 1744 options.recv_video = true; |
1708 JsepSessionDescription* answer = | 1745 JsepSessionDescription* answer = |
1709 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); | 1746 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
1710 ASSERT_TRUE(answer != NULL); | 1747 ASSERT_TRUE(answer != NULL); |
1711 VerifyFingerprintStatus(answer->description(), false); | 1748 VerifyFingerprintStatus(answer->description(), false); |
1712 VerifyNoCryptoParams(answer->description(), false); | 1749 VerifyNoCryptoParams(answer->description(), false); |
1713 | 1750 |
1714 // SetRemoteDescription will take the ownership of the answer. | 1751 // SetRemoteDescription will take the ownership of the answer. |
1715 SetRemoteDescriptionWithoutError(answer); | 1752 SetRemoteDescriptionWithoutError(answer); |
1716 } | 1753 } |
1717 | 1754 |
1718 // 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 |
1719 // offer without SDES or DTLS when encryption is disabled. | 1756 // offer without SDES or DTLS when encryption is disabled. |
1720 TEST_F(WebRtcSessionTest, TestCreateAnswerReceiveOfferWithoutEncryption) { | 1757 TEST_P(WebRtcSessionTest, TestCreateAnswerReceiveOfferWithoutEncryption) { |
1721 options_.disable_encryption = true; | 1758 options_.disable_encryption = true; |
1722 InitWithDtls(); | 1759 InitWithDtlsCertSuccess(GetParam()); |
1723 | 1760 |
1724 cricket::MediaSessionOptions options; | 1761 cricket::MediaSessionOptions options; |
1725 options.recv_video = true; | 1762 options.recv_video = true; |
1726 JsepSessionDescription* offer = | 1763 JsepSessionDescription* offer = |
1727 CreateRemoteOffer(options, cricket::SEC_DISABLED); | 1764 CreateRemoteOffer(options, cricket::SEC_DISABLED); |
1728 ASSERT_TRUE(offer != NULL); | 1765 ASSERT_TRUE(offer != NULL); |
1729 VerifyFingerprintStatus(offer->description(), false); | 1766 VerifyFingerprintStatus(offer->description(), false); |
1730 VerifyNoCryptoParams(offer->description(), false); | 1767 VerifyNoCryptoParams(offer->description(), false); |
1731 | 1768 |
1732 // 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... | |
3462 TEST_F(WebRtcSessionTest, TestRtpDataChannel) { | 3499 TEST_F(WebRtcSessionTest, TestRtpDataChannel) { |
3463 constraints_.reset(new FakeConstraints()); | 3500 constraints_.reset(new FakeConstraints()); |
3464 constraints_->AddOptional( | 3501 constraints_->AddOptional( |
3465 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); | 3502 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); |
3466 Init(); | 3503 Init(); |
3467 | 3504 |
3468 SetLocalDescriptionWithDataChannel(); | 3505 SetLocalDescriptionWithDataChannel(); |
3469 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); | 3506 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); |
3470 } | 3507 } |
3471 | 3508 |
3472 TEST_F(WebRtcSessionTest, TestRtpDataChannelConstraintTakesPrecedence) { | 3509 TEST_P(WebRtcSessionTest, TestRtpDataChannelConstraintTakesPrecedence) { |
3473 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3510 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3474 | 3511 |
3475 constraints_.reset(new FakeConstraints()); | 3512 constraints_.reset(new FakeConstraints()); |
3476 constraints_->AddOptional( | 3513 constraints_->AddOptional( |
3477 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); | 3514 webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); |
3478 options_.disable_sctp_data_channels = false; | 3515 options_.disable_sctp_data_channels = false; |
3479 | 3516 |
3480 InitWithDtls(); | 3517 InitWithDtlsCertSuccess(GetParam()); |
3481 | 3518 |
3482 SetLocalDescriptionWithDataChannel(); | 3519 SetLocalDescriptionWithDataChannel(); |
3483 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); | 3520 EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); |
3484 } | 3521 } |
3485 | 3522 |
3486 TEST_F(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) { | 3523 TEST_P(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) { |
3487 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3524 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3488 | 3525 |
3489 InitWithDtls(); | 3526 InitWithDtlsCertSuccess(GetParam()); |
3490 | 3527 |
3491 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3528 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
3492 EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL); | 3529 EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL); |
3493 EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL); | 3530 EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL); |
3494 } | 3531 } |
3495 | 3532 |
3496 TEST_F(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) { | 3533 TEST_P(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) { |
3497 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3534 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3498 SetFactoryDtlsSrtp(); | 3535 SetFactoryDtlsSrtp(); |
3499 InitWithDtls(); | 3536 InitWithDtlsCertSuccess(GetParam()); |
3500 | 3537 |
3501 // Create remote offer with SCTP. | 3538 // Create remote offer with SCTP. |
3502 cricket::MediaSessionOptions options; | 3539 cricket::MediaSessionOptions options; |
3503 options.data_channel_type = cricket::DCT_SCTP; | 3540 options.data_channel_type = cricket::DCT_SCTP; |
3504 JsepSessionDescription* offer = | 3541 JsepSessionDescription* offer = |
3505 CreateRemoteOffer(options, cricket::SEC_DISABLED); | 3542 CreateRemoteOffer(options, cricket::SEC_DISABLED); |
3506 SetRemoteDescriptionWithoutError(offer); | 3543 SetRemoteDescriptionWithoutError(offer); |
3507 | 3544 |
3508 // Verifies the answer contains SCTP. | 3545 // Verifies the answer contains SCTP. |
3509 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); | 3546 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); |
3510 EXPECT_TRUE(answer != NULL); | 3547 EXPECT_TRUE(answer != NULL); |
3511 EXPECT_TRUE(answer->description()->GetContentByName("data") != NULL); | 3548 EXPECT_TRUE(answer->description()->GetContentByName("data") != NULL); |
3512 EXPECT_TRUE(answer->description()->GetTransportInfoByName("data") != NULL); | 3549 EXPECT_TRUE(answer->description()->GetTransportInfoByName("data") != NULL); |
3513 } | 3550 } |
3514 | 3551 |
3515 TEST_F(WebRtcSessionTest, TestSctpDataChannelWithoutDtls) { | 3552 TEST_P(WebRtcSessionTest, TestSctpDataChannelWithoutDtls) { |
3516 constraints_.reset(new FakeConstraints()); | 3553 constraints_.reset(new FakeConstraints()); |
3517 constraints_->AddOptional( | 3554 constraints_->AddOptional( |
3518 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); | 3555 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); |
3519 InitWithDtls(); | 3556 InitWithDtlsCertSuccess(GetParam()); |
3520 | 3557 |
3521 SetLocalDescriptionWithDataChannel(); | 3558 SetLocalDescriptionWithDataChannel(); |
3522 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); | 3559 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); |
3523 } | 3560 } |
3524 | 3561 |
3525 TEST_F(WebRtcSessionTest, TestSctpDataChannelWithDtls) { | 3562 TEST_P(WebRtcSessionTest, TestSctpDataChannelWithDtls) { |
3526 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3563 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3527 | 3564 |
3528 InitWithDtls(); | 3565 InitWithDtlsCertSuccess(GetParam()); |
3529 | 3566 |
3530 SetLocalDescriptionWithDataChannel(); | 3567 SetLocalDescriptionWithDataChannel(); |
3531 EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type()); | 3568 EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type()); |
3532 } | 3569 } |
3533 | 3570 |
3534 TEST_F(WebRtcSessionTest, TestDisableSctpDataChannels) { | 3571 TEST_P(WebRtcSessionTest, TestDisableSctpDataChannels) { |
3535 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3572 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3536 options_.disable_sctp_data_channels = true; | 3573 options_.disable_sctp_data_channels = true; |
3537 InitWithDtls(); | 3574 InitWithDtlsCertSuccess(GetParam()); |
3538 | 3575 |
3539 SetLocalDescriptionWithDataChannel(); | 3576 SetLocalDescriptionWithDataChannel(); |
3540 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); | 3577 EXPECT_EQ(cricket::DCT_NONE, data_engine_->last_channel_type()); |
3541 } | 3578 } |
3542 | 3579 |
3543 TEST_F(WebRtcSessionTest, TestSctpDataChannelSendPortParsing) { | 3580 TEST_P(WebRtcSessionTest, TestSctpDataChannelSendPortParsing) { |
3544 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3581 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3545 const int new_send_port = 9998; | 3582 const int new_send_port = 9998; |
3546 const int new_recv_port = 7775; | 3583 const int new_recv_port = 7775; |
3547 | 3584 |
3548 InitWithDtls(); | 3585 InitWithDtlsCertSuccess(GetParam()); |
3549 SetFactoryDtlsSrtp(); | 3586 SetFactoryDtlsSrtp(); |
3550 | 3587 |
3551 // 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 |
3552 // actually get serialized for SCTP in BuildMediaDescription(). Instead, | 3589 // actually get serialized for SCTP in BuildMediaDescription(). Instead, |
3553 // 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 |
3554 // into the stream. | 3591 // into the stream. |
3555 cricket::MediaSessionOptions options; | 3592 cricket::MediaSessionOptions options; |
3556 JsepSessionDescription* offer = CreateRemoteOfferWithSctpPort( | 3593 JsepSessionDescription* offer = CreateRemoteOfferWithSctpPort( |
3557 "stream1", new_send_port, options); | 3594 "stream1", new_send_port, options); |
3558 | 3595 |
(...skipping 28 matching lines...) Expand all Loading... | |
3587 | 3624 |
3588 ASSERT_EQ(1UL, ch->recv_codecs().size()); | 3625 ASSERT_EQ(1UL, ch->recv_codecs().size()); |
3589 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); | 3626 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); |
3590 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, | 3627 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, |
3591 ch->recv_codecs()[0].name.c_str())); | 3628 ch->recv_codecs()[0].name.c_str())); |
3592 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, | 3629 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, |
3593 &portnum)); | 3630 &portnum)); |
3594 EXPECT_EQ(new_recv_port, portnum); | 3631 EXPECT_EQ(new_recv_port, portnum); |
3595 } | 3632 } |
3596 | 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 | |
3597 // Verifies that CreateOffer succeeds when CreateOffer is called before async | 3646 // Verifies that CreateOffer succeeds when CreateOffer is called before async |
3598 // identity generation is finished. | 3647 // identity generation is finished (even if a certificate is provided this is |
3599 TEST_F(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { | 3648 // an async op). |
3649 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { | |
3600 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3650 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3601 InitWithDtls(); | 3651 InitWithDtlsCertSuccess(GetParam()); |
3602 | 3652 |
3603 EXPECT_TRUE(session_->waiting_for_identity()); | 3653 EXPECT_TRUE(session_->IsWaitingForCertificate()); |
3604 mediastream_signaling_.SendAudioVideoStream1(); | 3654 mediastream_signaling_.SendAudioVideoStream1(); |
3605 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3655 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
3606 | 3656 |
3607 EXPECT_TRUE(offer != NULL); | 3657 EXPECT_TRUE(offer != NULL); |
3608 VerifyNoCryptoParams(offer->description(), true); | 3658 VerifyNoCryptoParams(offer->description(), true); |
3609 VerifyFingerprintStatus(offer->description(), true); | 3659 VerifyFingerprintStatus(offer->description(), true); |
3610 } | 3660 } |
3611 | 3661 |
3612 // Verifies that CreateAnswer succeeds when CreateOffer is called before async | 3662 // Verifies that CreateAnswer succeeds when CreateOffer is called before async |
3613 // identity generation is finished. | 3663 // identity generation is finished (even if a certificate is provided this is |
3614 TEST_F(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) { | 3664 // an async op). |
3665 TEST_P(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) { | |
3615 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3666 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3616 InitWithDtls(); | 3667 InitWithDtlsCertSuccess(GetParam()); |
3617 SetFactoryDtlsSrtp(); | 3668 SetFactoryDtlsSrtp(); |
3618 | 3669 |
3619 cricket::MediaSessionOptions options; | 3670 cricket::MediaSessionOptions options; |
3620 options.recv_video = true; | 3671 options.recv_video = true; |
3621 scoped_ptr<JsepSessionDescription> offer( | 3672 scoped_ptr<JsepSessionDescription> offer( |
3622 CreateRemoteOffer(options, cricket::SEC_DISABLED)); | 3673 CreateRemoteOffer(options, cricket::SEC_DISABLED)); |
3623 ASSERT_TRUE(offer.get() != NULL); | 3674 ASSERT_TRUE(offer.get() != NULL); |
3624 SetRemoteDescriptionWithoutError(offer.release()); | 3675 SetRemoteDescriptionWithoutError(offer.release()); |
3625 | 3676 |
3626 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); | 3677 rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); |
3627 EXPECT_TRUE(answer != NULL); | 3678 EXPECT_TRUE(answer != NULL); |
3628 VerifyNoCryptoParams(answer->description(), true); | 3679 VerifyNoCryptoParams(answer->description(), true); |
3629 VerifyFingerprintStatus(answer->description(), true); | 3680 VerifyFingerprintStatus(answer->description(), true); |
3630 } | 3681 } |
3631 | 3682 |
3632 // Verifies that CreateOffer succeeds when CreateOffer is called after async | 3683 // Verifies that CreateOffer succeeds when CreateOffer is called after async |
3633 // identity generation is finished. | 3684 // identity generation is finished (even if a certificate is provided this is |
3634 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { | 3685 // an async op). |
3686 TEST_P(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { | |
3635 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3687 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3636 InitWithDtls(); | 3688 InitWithDtlsCertSuccess(GetParam()); |
3637 | 3689 |
3638 EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000); | 3690 EXPECT_TRUE_WAIT(!session_->IsWaitingForCertificate(), 1000); |
3639 | 3691 |
3640 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3692 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
3641 EXPECT_TRUE(offer != NULL); | 3693 EXPECT_TRUE(offer != NULL); |
3642 } | 3694 } |
3643 | 3695 |
3644 // Verifies that CreateOffer fails when CreateOffer is called after async | 3696 // Verifies that CreateOffer fails when CreateOffer is called after async |
3645 // identity generation fails. | 3697 // identity generation fails. |
3646 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { | 3698 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { |
3647 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3699 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3648 InitWithDtls(true); | 3700 InitWithDtlsCertGenFailure(); |
3649 | 3701 |
3650 EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000); | 3702 EXPECT_TRUE_WAIT(!session_->IsWaitingForCertificate(), 1000); |
3651 | 3703 |
3652 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3704 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
3653 EXPECT_TRUE(offer == NULL); | 3705 EXPECT_TRUE(offer == NULL); |
3654 } | 3706 } |
3655 | 3707 |
3656 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made | 3708 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made |
3657 // before async identity generation is finished. | 3709 // before async identity generation is finished. |
3658 TEST_F(WebRtcSessionTest, | 3710 TEST_F(WebRtcSessionTest, |
3659 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) { | 3711 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) { |
3660 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... | |
3780 | 3832 |
3781 ASSERT_TRUE(voice_channel_ != NULL); | 3833 ASSERT_TRUE(voice_channel_ != NULL); |
3782 cricket::AudioOptions audio_options; | 3834 cricket::AudioOptions audio_options; |
3783 EXPECT_TRUE(voice_channel_->GetOptions(&audio_options)); | 3835 EXPECT_TRUE(voice_channel_->GetOptions(&audio_options)); |
3784 EXPECT_TRUE( | 3836 EXPECT_TRUE( |
3785 audio_options.combined_audio_video_bwe.GetWithDefaultIfUnset(false)); | 3837 audio_options.combined_audio_video_bwe.GetWithDefaultIfUnset(false)); |
3786 } | 3838 } |
3787 | 3839 |
3788 // 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 |
3789 // new remote SDP. | 3841 // new remote SDP. |
3790 TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { | 3842 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { |
3791 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3843 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3792 InitWithDtls(); | 3844 InitWithDtlsCertSuccess(GetParam()); |
3793 SetFactoryDtlsSrtp(); | 3845 SetFactoryDtlsSrtp(); |
3794 | 3846 |
3795 mediastream_signaling_.UseOptionsAudioOnly(); | 3847 mediastream_signaling_.UseOptionsAudioOnly(); |
3796 SessionDescriptionInterface* offer = CreateOffer(); | 3848 SessionDescriptionInterface* offer = CreateOffer(); |
3797 SetLocalDescriptionWithoutError(offer); | 3849 SetLocalDescriptionWithoutError(offer); |
3798 | 3850 |
3799 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); | 3851 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); |
3800 SetRemoteDescriptionWithoutError(answer); | 3852 SetRemoteDescriptionWithoutError(answer); |
3801 | 3853 |
3802 cricket::MediaSessionOptions options; | 3854 cricket::MediaSessionOptions options; |
3803 options.recv_video = true; | 3855 options.recv_video = true; |
3804 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); | 3856 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); |
3805 | 3857 |
3806 cricket::Candidate candidate1; | 3858 cricket::Candidate candidate1; |
3807 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); | 3859 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); |
3808 candidate1.set_component(1); | 3860 candidate1.set_component(1); |
3809 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, | 3861 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, |
3810 candidate1); | 3862 candidate1); |
3811 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); | 3863 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); |
3812 SetRemoteDescriptionWithoutError(offer); | 3864 SetRemoteDescriptionWithoutError(offer); |
3813 | 3865 |
3814 answer = CreateAnswer(NULL); | 3866 answer = CreateAnswer(NULL); |
3815 SetLocalDescriptionWithoutError(answer); | 3867 SetLocalDescriptionWithoutError(answer); |
3816 } | 3868 } |
3817 | 3869 |
3818 // 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 |
3819 // from the remote SDP. | 3871 // from the remote SDP. |
3820 TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) { | 3872 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) { |
3821 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3873 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
3822 InitWithDtls(); | 3874 InitWithDtlsCertSuccess(GetParam()); |
3823 SetFactoryDtlsSrtp(); | 3875 SetFactoryDtlsSrtp(); |
3824 | 3876 |
3825 mediastream_signaling_.UseOptionsAudioOnly(); | 3877 mediastream_signaling_.UseOptionsAudioOnly(); |
3826 SessionDescriptionInterface* offer = CreateOffer(); | 3878 SessionDescriptionInterface* offer = CreateOffer(); |
3827 SetLocalDescriptionWithoutError(offer); | 3879 SetLocalDescriptionWithoutError(offer); |
3828 | 3880 |
3829 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); | 3881 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); |
3830 SetRemoteDescriptionWithoutError(answer); | 3882 SetRemoteDescriptionWithoutError(answer); |
3831 | 3883 |
3832 cricket::MediaSessionOptions options; | 3884 cricket::MediaSessionOptions options; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3926 options.offer_to_receive_audio = | 3978 options.offer_to_receive_audio = |
3927 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; | 3979 RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; |
3928 | 3980 |
3929 for (auto& o : observers) { | 3981 for (auto& o : observers) { |
3930 o = new WebRtcSessionCreateSDPObserverForTest(); | 3982 o = new WebRtcSessionCreateSDPObserverForTest(); |
3931 session_->CreateOffer(o, options); | 3983 session_->CreateOffer(o, options); |
3932 } | 3984 } |
3933 | 3985 |
3934 session_.reset(); | 3986 session_.reset(); |
3935 | 3987 |
3936 // Make sure we process pending messages on the current (signaling) thread | |
3937 // before checking we we got our callbacks. Quit() will do this and then | |
3938 // immediately exit. We won't need the queue after this point anyway. | |
3939 rtc::Thread::Current()->Quit(); | |
3940 | |
hbos
2015/08/18 08:56:35
Two things wrong with this, which is why I removed
| |
3941 for (auto& o : observers) { | 3988 for (auto& o : observers) { |
3942 // 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 |
3943 // 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 |
3944 // must have received a notification which, so the only invalid state | 3991 // must have received a notification which, so the only invalid state |
3945 // is kInit. | 3992 // is kInit. |
3946 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); | 3993 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); |
3947 } | 3994 } |
3948 } | 3995 } |
3949 | 3996 |
3950 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 3997 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
3951 // currently fails because upon disconnection and reconnection OnIceComplete is | 3998 // currently fails because upon disconnection and reconnection OnIceComplete is |
3952 // 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 |