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

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 1717583002: Non-constraint interfaces for all constrainable interfaces (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix an ambiguous function Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * 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
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/02/23 11:40:18 replace all use of constraints in this file since
hta-webrtc 2016/02/23 14:30:34 Unfortunately there's an awful lot of constraints
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
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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 PeerConnectionInterface::RTCOfferAnswerOptions options; 1357 PeerConnectionInterface::RTCOfferAnswerOptions options;
1356 cricket::MediaSessionOptions session_options; 1358 cricket::MediaSessionOptions session_options;
1357 const int kNumber = 3; 1359 const int kNumber = 3;
1358 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> 1360 rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
1359 observers[kNumber]; 1361 observers[kNumber];
1360 for (int i = 0; i < kNumber; ++i) { 1362 for (int i = 0; i < kNumber; ++i) {
1361 observers[i] = new WebRtcSessionCreateSDPObserverForTest(); 1363 observers[i] = new WebRtcSessionCreateSDPObserverForTest();
1362 if (type == CreateSessionDescriptionRequest::kOffer) { 1364 if (type == CreateSessionDescriptionRequest::kOffer) {
1363 session_->CreateOffer(observers[i], options, session_options); 1365 session_->CreateOffer(observers[i], options, session_options);
1364 } else { 1366 } else {
1365 session_->CreateAnswer(observers[i], nullptr, session_options); 1367 session_->CreateAnswer(observers[i], session_options);
1366 } 1368 }
1367 } 1369 }
1368 1370
1369 WebRtcSessionCreateSDPObserverForTest::State expected_state = 1371 WebRtcSessionCreateSDPObserverForTest::State expected_state =
1370 success ? WebRtcSessionCreateSDPObserverForTest::kSucceeded : 1372 success ? WebRtcSessionCreateSDPObserverForTest::kSucceeded :
1371 WebRtcSessionCreateSDPObserverForTest::kFailed; 1373 WebRtcSessionCreateSDPObserverForTest::kFailed;
1372 1374
1373 for (int i = 0; i < kNumber; ++i) { 1375 for (int i = 0; i < kNumber; ++i) {
1374 EXPECT_EQ_WAIT(expected_state, observers[i]->state(), 1000); 1376 EXPECT_EQ_WAIT(expected_state, observers[i]->state(), 1000);
1375 if (success) { 1377 if (success) {
(...skipping 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after
4255 } 4257 }
4256 4258
4257 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4259 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4258 // currently fails because upon disconnection and reconnection OnIceComplete is 4260 // currently fails because upon disconnection and reconnection OnIceComplete is
4259 // called more than once without returning to IceGatheringGathering. 4261 // called more than once without returning to IceGatheringGathering.
4260 4262
4261 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4263 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4262 WebRtcSessionTest, 4264 WebRtcSessionTest,
4263 testing::Values(ALREADY_GENERATED, 4265 testing::Values(ALREADY_GENERATED,
4264 DTLS_IDENTITY_STORE)); 4266 DTLS_IDENTITY_STORE));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698