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

Side by Side Diff: talk/app/webrtc/webrtcsession_unittest.cc

Issue 1460043002: Don't call the Pass methods of rtc::Buffer, rtc::scoped_ptr, and rtc::ScopedVector (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Restore the Pass methods Created 5 years 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
« no previous file with comments | « talk/app/webrtc/webrtcsession.cc ('k') | talk/app/webrtc/webrtcsessiondescriptionfactory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility>
28 #include <vector> 29 #include <vector>
29 30
30 #include "talk/app/webrtc/audiotrack.h" 31 #include "talk/app/webrtc/audiotrack.h"
31 #include "talk/app/webrtc/fakemediacontroller.h" 32 #include "talk/app/webrtc/fakemediacontroller.h"
32 #include "talk/app/webrtc/fakemetricsobserver.h" 33 #include "talk/app/webrtc/fakemetricsobserver.h"
33 #include "talk/app/webrtc/jsepicecandidate.h" 34 #include "talk/app/webrtc/jsepicecandidate.h"
34 #include "talk/app/webrtc/jsepsessiondescription.h" 35 #include "talk/app/webrtc/jsepsessiondescription.h"
35 #include "talk/app/webrtc/peerconnection.h" 36 #include "talk/app/webrtc/peerconnection.h"
36 #include "talk/app/webrtc/sctputils.h" 37 #include "talk/app/webrtc/sctputils.h"
37 #include "talk/app/webrtc/streamcollection.h" 38 #include "talk/app/webrtc/streamcollection.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 allocator_.get(), &observer_)); 419 allocator_.get(), &observer_));
419 session_->SignalDataChannelOpenMessage.connect( 420 session_->SignalDataChannelOpenMessage.connect(
420 this, &WebRtcSessionTest::OnDataChannelOpenMessage); 421 this, &WebRtcSessionTest::OnDataChannelOpenMessage);
421 422
422 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, 423 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew,
423 observer_.ice_connection_state_); 424 observer_.ice_connection_state_);
424 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, 425 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
425 observer_.ice_gathering_state_); 426 observer_.ice_gathering_state_);
426 427
427 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), 428 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(),
428 dtls_identity_store.Pass(), 429 std::move(dtls_identity_store),
429 rtc_configuration)); 430 rtc_configuration));
430 session_->set_metrics_observer(metrics_observer_); 431 session_->set_metrics_observer(metrics_observer_);
431 } 432 }
432 433
433 void OnDataChannelOpenMessage(const std::string& label, 434 void OnDataChannelOpenMessage(const std::string& label,
434 const InternalDataChannelInit& config) { 435 const InternalDataChannelInit& config) {
435 last_data_channel_label_ = label; 436 last_data_channel_label_ = label;
436 last_data_channel_config_ = config; 437 last_data_channel_config_ = config;
437 } 438 }
438 439
(...skipping 30 matching lines...) Expand all
469 PeerConnectionInterface::RTCConfiguration configuration; 470 PeerConnectionInterface::RTCConfiguration configuration;
470 if (cert_gen_method == ALREADY_GENERATED) { 471 if (cert_gen_method == ALREADY_GENERATED) {
471 configuration.certificates.push_back( 472 configuration.certificates.push_back(
472 FakeDtlsIdentityStore::GenerateCertificate()); 473 FakeDtlsIdentityStore::GenerateCertificate());
473 } else if (cert_gen_method == DTLS_IDENTITY_STORE) { 474 } else if (cert_gen_method == DTLS_IDENTITY_STORE) {
474 dtls_identity_store.reset(new FakeDtlsIdentityStore()); 475 dtls_identity_store.reset(new FakeDtlsIdentityStore());
475 dtls_identity_store->set_should_fail(false); 476 dtls_identity_store->set_should_fail(false);
476 } else { 477 } else {
477 RTC_CHECK(false); 478 RTC_CHECK(false);
478 } 479 }
479 Init(dtls_identity_store.Pass(), configuration); 480 Init(std::move(dtls_identity_store), configuration);
480 } 481 }
481 482
482 // Init with DTLS with a store that will fail to generate a certificate. 483 // Init with DTLS with a store that will fail to generate a certificate.
483 void InitWithDtlsIdentityGenFail() { 484 void InitWithDtlsIdentityGenFail() {
484 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( 485 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
485 new FakeDtlsIdentityStore()); 486 new FakeDtlsIdentityStore());
486 dtls_identity_store->set_should_fail(true); 487 dtls_identity_store->set_should_fail(true);
487 PeerConnectionInterface::RTCConfiguration configuration; 488 PeerConnectionInterface::RTCConfiguration configuration;
488 Init(dtls_identity_store.Pass(), configuration); 489 Init(std::move(dtls_identity_store), configuration);
489 } 490 }
490 491
491 void InitWithDtmfCodec() { 492 void InitWithDtmfCodec() {
492 // Add kTelephoneEventCodec for dtmf test. 493 // Add kTelephoneEventCodec for dtmf test.
493 const cricket::AudioCodec kTelephoneEventCodec( 494 const cricket::AudioCodec kTelephoneEventCodec(
494 106, "telephone-event", 8000, 0, 1, 0); 495 106, "telephone-event", 8000, 0, 1, 0);
495 std::vector<cricket::AudioCodec> codecs; 496 std::vector<cricket::AudioCodec> codecs;
496 codecs.push_back(kTelephoneEventCodec); 497 codecs.push_back(kTelephoneEventCodec);
497 media_engine_->SetAudioCodecs(codecs); 498 media_engine_->SetAudioCodecs(codecs);
498 desc_factory_->set_audio_codecs(codecs); 499 desc_factory_->set_audio_codecs(codecs);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 video_content->protocol()); 717 video_content->protocol());
717 } 718 }
718 } 719 }
719 720
720 // Set the internal fake description factories to do DTLS-SRTP. 721 // Set the internal fake description factories to do DTLS-SRTP.
721 void SetFactoryDtlsSrtp() { 722 void SetFactoryDtlsSrtp() {
722 desc_factory_->set_secure(cricket::SEC_DISABLED); 723 desc_factory_->set_secure(cricket::SEC_DISABLED);
723 std::string identity_name = "WebRTC" + 724 std::string identity_name = "WebRTC" +
724 rtc::ToString(rtc::CreateRandomId()); 725 rtc::ToString(rtc::CreateRandomId());
725 // Confirmed to work with KT_RSA and KT_ECDSA. 726 // Confirmed to work with KT_RSA and KT_ECDSA.
726 tdesc_factory_->set_certificate(rtc::RTCCertificate::Create( 727 tdesc_factory_->set_certificate(
727 rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate( 728 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
728 identity_name, rtc::KT_DEFAULT)).Pass())); 729 rtc::SSLIdentity::Generate(identity_name, rtc::KT_DEFAULT))));
729 tdesc_factory_->set_secure(cricket::SEC_REQUIRED); 730 tdesc_factory_->set_secure(cricket::SEC_REQUIRED);
730 } 731 }
731 732
732 void VerifyFingerprintStatus(const cricket::SessionDescription* sdp, 733 void VerifyFingerprintStatus(const cricket::SessionDescription* sdp,
733 bool expected) { 734 bool expected) {
734 const TransportInfo* audio = sdp->GetTransportInfoByName("audio"); 735 const TransportInfo* audio = sdp->GetTransportInfoByName("audio");
735 ASSERT_TRUE(audio != NULL); 736 ASSERT_TRUE(audio != NULL);
736 ASSERT_EQ(expected, audio->description.identity_fingerprint.get() != NULL); 737 ASSERT_EQ(expected, audio->description.identity_fingerprint.get() != NULL);
737 const TransportInfo* video = sdp->GetTransportInfoByName("video"); 738 const TransportInfo* video = sdp->GetTransportInfoByName("video");
738 ASSERT_TRUE(video != NULL); 739 ASSERT_TRUE(video != NULL);
(...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after
4257 } 4258 }
4258 4259
4259 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4260 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4260 // currently fails because upon disconnection and reconnection OnIceComplete is 4261 // currently fails because upon disconnection and reconnection OnIceComplete is
4261 // called more than once without returning to IceGatheringGathering. 4262 // called more than once without returning to IceGatheringGathering.
4262 4263
4263 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4264 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4264 WebRtcSessionTest, 4265 WebRtcSessionTest,
4265 testing::Values(ALREADY_GENERATED, 4266 testing::Values(ALREADY_GENERATED,
4266 DTLS_IDENTITY_STORE)); 4267 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession.cc ('k') | talk/app/webrtc/webrtcsessiondescriptionfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698