OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 network_manager_.AddInterface(addr); | 363 network_manager_.AddInterface(addr); |
364 } | 364 } |
365 | 365 |
366 // If |dtls_identity_store| != null or |rtc_configuration| contains | 366 // If |dtls_identity_store| != null or |rtc_configuration| contains |
367 // |certificates| then DTLS will be enabled unless explicitly disabled by | 367 // |certificates| then DTLS will be enabled unless explicitly disabled by |
368 // |rtc_configuration| options. When DTLS is enabled a certificate will be | 368 // |rtc_configuration| options. When DTLS is enabled a certificate will be |
369 // used if provided, otherwise one will be generated using the | 369 // used if provided, otherwise one will be generated using the |
370 // |dtls_identity_store|. | 370 // |dtls_identity_store|. |
371 void Init( | 371 void Init( |
372 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, | 372 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, |
373 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { | 373 const PeerConnectionInterface::RTCConfiguration& rtc_configuration_in) { |
374 ASSERT_TRUE(session_.get() == NULL); | 374 ASSERT_TRUE(session_.get() == NULL); |
375 session_.reset(new WebRtcSessionForTest( | 375 session_.reset(new WebRtcSessionForTest( |
376 media_controller_.get(), rtc::Thread::Current(), rtc::Thread::Current(), | 376 media_controller_.get(), rtc::Thread::Current(), rtc::Thread::Current(), |
377 allocator_.get(), &observer_)); | 377 allocator_.get(), &observer_)); |
378 session_->SignalDataChannelOpenMessage.connect( | 378 session_->SignalDataChannelOpenMessage.connect( |
379 this, &WebRtcSessionTest::OnDataChannelOpenMessage); | 379 this, &WebRtcSessionTest::OnDataChannelOpenMessage); |
380 session_->GetOnDestroyedSignal()->connect( | 380 session_->GetOnDestroyedSignal()->connect( |
381 this, &WebRtcSessionTest::OnSessionDestroyed); | 381 this, &WebRtcSessionTest::OnSessionDestroyed); |
382 | 382 |
383 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, | 383 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, |
384 observer_.ice_connection_state_); | 384 observer_.ice_connection_state_); |
385 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, | 385 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, |
386 observer_.ice_gathering_state_); | 386 observer_.ice_gathering_state_); |
387 | 387 |
388 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), | 388 PeerConnectionInterface::RTCConfiguration rtc_configuration = |
389 std::move(dtls_identity_store), | 389 rtc_configuration_in; |
390 CopyConstraintsIntoRtcConfiguration(constraints_.get(), &rtc_configuration); | |
perkj_webrtc
2016/03/01 08:41:26
webrtcsession no longer uses constraints so you sh
| |
391 EXPECT_TRUE(session_->Initialize(options_, std::move(dtls_identity_store), | |
390 rtc_configuration)); | 392 rtc_configuration)); |
391 session_->set_metrics_observer(metrics_observer_); | 393 session_->set_metrics_observer(metrics_observer_); |
392 } | 394 } |
393 | 395 |
394 void OnDataChannelOpenMessage(const std::string& label, | 396 void OnDataChannelOpenMessage(const std::string& label, |
395 const InternalDataChannelInit& config) { | 397 const InternalDataChannelInit& config) { |
396 last_data_channel_label_ = label; | 398 last_data_channel_label_ = label; |
397 last_data_channel_config_ = config; | 399 last_data_channel_config_ = config; |
398 } | 400 } |
399 | 401 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 2000); | 604 2000); |
603 return observer->ReleaseDescription(); | 605 return observer->ReleaseDescription(); |
604 } | 606 } |
605 | 607 |
606 SessionDescriptionInterface* CreateAnswer( | 608 SessionDescriptionInterface* CreateAnswer( |
607 const webrtc::MediaConstraintsInterface* constraints) { | 609 const webrtc::MediaConstraintsInterface* constraints) { |
608 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observer | 610 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observer |
609 = new WebRtcSessionCreateSDPObserverForTest(); | 611 = new WebRtcSessionCreateSDPObserverForTest(); |
610 cricket::MediaSessionOptions session_options; | 612 cricket::MediaSessionOptions session_options; |
611 GetOptionsForAnswer(constraints, &session_options); | 613 GetOptionsForAnswer(constraints, &session_options); |
612 session_->CreateAnswer(observer, constraints, session_options); | 614 session_->CreateAnswer(observer, session_options); |
613 EXPECT_TRUE_WAIT( | 615 EXPECT_TRUE_WAIT( |
614 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit, | 616 observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit, |
615 2000); | 617 2000); |
616 return observer->ReleaseDescription(); | 618 return observer->ReleaseDescription(); |
617 } | 619 } |
618 | 620 |
619 bool ChannelsExist() const { | 621 bool ChannelsExist() const { |
620 return (session_->voice_channel() != NULL && | 622 return (session_->voice_channel() != NULL && |
621 session_->video_channel() != NULL); | 623 session_->video_channel() != NULL); |
622 } | 624 } |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1373 PeerConnectionInterface::RTCOfferAnswerOptions options; | 1375 PeerConnectionInterface::RTCOfferAnswerOptions options; |
1374 cricket::MediaSessionOptions session_options; | 1376 cricket::MediaSessionOptions session_options; |
1375 const int kNumber = 3; | 1377 const int kNumber = 3; |
1376 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> | 1378 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> |
1377 observers[kNumber]; | 1379 observers[kNumber]; |
1378 for (int i = 0; i < kNumber; ++i) { | 1380 for (int i = 0; i < kNumber; ++i) { |
1379 observers[i] = new WebRtcSessionCreateSDPObserverForTest(); | 1381 observers[i] = new WebRtcSessionCreateSDPObserverForTest(); |
1380 if (type == CreateSessionDescriptionRequest::kOffer) { | 1382 if (type == CreateSessionDescriptionRequest::kOffer) { |
1381 session_->CreateOffer(observers[i], options, session_options); | 1383 session_->CreateOffer(observers[i], options, session_options); |
1382 } else { | 1384 } else { |
1383 session_->CreateAnswer(observers[i], nullptr, session_options); | 1385 session_->CreateAnswer(observers[i], session_options); |
1384 } | 1386 } |
1385 } | 1387 } |
1386 | 1388 |
1387 WebRtcSessionCreateSDPObserverForTest::State expected_state = | 1389 WebRtcSessionCreateSDPObserverForTest::State expected_state = |
1388 success ? WebRtcSessionCreateSDPObserverForTest::kSucceeded : | 1390 success ? WebRtcSessionCreateSDPObserverForTest::kSucceeded : |
1389 WebRtcSessionCreateSDPObserverForTest::kFailed; | 1391 WebRtcSessionCreateSDPObserverForTest::kFailed; |
1390 | 1392 |
1391 for (int i = 0; i < kNumber; ++i) { | 1393 for (int i = 0; i < kNumber; ++i) { |
1392 EXPECT_EQ_WAIT(expected_state, observers[i]->state(), 1000); | 1394 EXPECT_EQ_WAIT(expected_state, observers[i]->state(), 1000); |
1393 if (success) { | 1395 if (success) { |
(...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4331 } | 4333 } |
4332 | 4334 |
4333 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4335 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4334 // currently fails because upon disconnection and reconnection OnIceComplete is | 4336 // currently fails because upon disconnection and reconnection OnIceComplete is |
4335 // called more than once without returning to IceGatheringGathering. | 4337 // called more than once without returning to IceGatheringGathering. |
4336 | 4338 |
4337 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4339 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4338 WebRtcSessionTest, | 4340 WebRtcSessionTest, |
4339 testing::Values(ALREADY_GENERATED, | 4341 testing::Values(ALREADY_GENERATED, |
4340 DTLS_IDENTITY_STORE)); | 4342 DTLS_IDENTITY_STORE)); |
OLD | NEW |