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

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

Issue 1966423002: Remove webrtc/base/scoped_ptr.h (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove new scoped_ptr uses Created 4 years, 7 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
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/api/rtpsender.h » ('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 * 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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 } 955 }
956 956
957 void AddVideoTrack(const std::string& track_id, 957 void AddVideoTrack(const std::string& track_id,
958 MediaStreamInterface* stream) { 958 MediaStreamInterface* stream) {
959 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track( 959 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
960 webrtc::VideoTrack::Create(track_id, 960 webrtc::VideoTrack::Create(track_id,
961 webrtc::FakeVideoTrackSource::Create())); 961 webrtc::FakeVideoTrackSource::Create()));
962 ASSERT_TRUE(stream->AddTrack(video_track)); 962 ASSERT_TRUE(stream->AddTrack(video_track));
963 } 963 }
964 964
965 rtc::scoped_ptr<SessionDescriptionInterface> CreateOfferWithOneAudioStream() { 965 std::unique_ptr<SessionDescriptionInterface> CreateOfferWithOneAudioStream() {
966 CreatePeerConnection(); 966 CreatePeerConnection();
967 AddVoiceStream(kStreamLabel1); 967 AddVoiceStream(kStreamLabel1);
968 rtc::scoped_ptr<SessionDescriptionInterface> offer; 968 std::unique_ptr<SessionDescriptionInterface> offer;
969 EXPECT_TRUE(DoCreateOffer(&offer, nullptr)); 969 EXPECT_TRUE(DoCreateOffer(&offer, nullptr));
970 return offer; 970 return offer;
971 } 971 }
972 972
973 rtc::scoped_ptr<SessionDescriptionInterface> 973 std::unique_ptr<SessionDescriptionInterface>
974 CreateAnswerWithOneAudioStream() { 974 CreateAnswerWithOneAudioStream() {
975 rtc::scoped_ptr<SessionDescriptionInterface> offer = 975 std::unique_ptr<SessionDescriptionInterface> offer =
976 CreateOfferWithOneAudioStream(); 976 CreateOfferWithOneAudioStream();
977 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); 977 EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
978 rtc::scoped_ptr<SessionDescriptionInterface> answer; 978 std::unique_ptr<SessionDescriptionInterface> answer;
979 EXPECT_TRUE(DoCreateAnswer(&answer, nullptr)); 979 EXPECT_TRUE(DoCreateAnswer(&answer, nullptr));
980 return answer; 980 return answer;
981 } 981 }
982 982
983 const std::string& GetFirstAudioStreamCname( 983 const std::string& GetFirstAudioStreamCname(
984 const SessionDescriptionInterface* desc) { 984 const SessionDescriptionInterface* desc) {
985 const cricket::ContentInfo* audio_content = 985 const cricket::ContentInfo* audio_content =
986 cricket::GetFirstAudioContent(desc->description()); 986 cricket::GetFirstAudioContent(desc->description());
987 const cricket::AudioContentDescription* audio_desc = 987 const cricket::AudioContentDescription* audio_desc =
988 static_cast<const cricket::AudioContentDescription*>( 988 static_cast<const cricket::AudioContentDescription*>(
989 audio_content->description); 989 audio_content->description);
990 return audio_desc->streams()[0].cname; 990 return audio_desc->streams()[0].cname;
991 } 991 }
992 992
993 cricket::FakePortAllocator* port_allocator_ = nullptr; 993 cricket::FakePortAllocator* port_allocator_ = nullptr;
994 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; 994 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
995 scoped_refptr<PeerConnectionInterface> pc_; 995 scoped_refptr<PeerConnectionInterface> pc_;
996 MockPeerConnectionObserver observer_; 996 MockPeerConnectionObserver observer_;
997 rtc::scoped_refptr<StreamCollection> reference_collection_; 997 rtc::scoped_refptr<StreamCollection> reference_collection_;
998 }; 998 };
999 999
1000 // Generate different CNAMEs when PeerConnections are created. 1000 // Generate different CNAMEs when PeerConnections are created.
1001 // The CNAMEs are expected to be generated randomly. It is possible 1001 // The CNAMEs are expected to be generated randomly. It is possible
1002 // that the test fails, though the possibility is very low. 1002 // that the test fails, though the possibility is very low.
1003 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInOffer) { 1003 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInOffer) {
1004 rtc::scoped_ptr<SessionDescriptionInterface> offer1 = 1004 std::unique_ptr<SessionDescriptionInterface> offer1 =
1005 CreateOfferWithOneAudioStream(); 1005 CreateOfferWithOneAudioStream();
1006 rtc::scoped_ptr<SessionDescriptionInterface> offer2 = 1006 std::unique_ptr<SessionDescriptionInterface> offer2 =
1007 CreateOfferWithOneAudioStream(); 1007 CreateOfferWithOneAudioStream();
1008 EXPECT_NE(GetFirstAudioStreamCname(offer1.get()), 1008 EXPECT_NE(GetFirstAudioStreamCname(offer1.get()),
1009 GetFirstAudioStreamCname(offer2.get())); 1009 GetFirstAudioStreamCname(offer2.get()));
1010 } 1010 }
1011 1011
1012 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInAnswer) { 1012 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInAnswer) {
1013 rtc::scoped_ptr<SessionDescriptionInterface> answer1 = 1013 std::unique_ptr<SessionDescriptionInterface> answer1 =
1014 CreateAnswerWithOneAudioStream(); 1014 CreateAnswerWithOneAudioStream();
1015 rtc::scoped_ptr<SessionDescriptionInterface> answer2 = 1015 std::unique_ptr<SessionDescriptionInterface> answer2 =
1016 CreateAnswerWithOneAudioStream(); 1016 CreateAnswerWithOneAudioStream();
1017 EXPECT_NE(GetFirstAudioStreamCname(answer1.get()), 1017 EXPECT_NE(GetFirstAudioStreamCname(answer1.get()),
1018 GetFirstAudioStreamCname(answer2.get())); 1018 GetFirstAudioStreamCname(answer2.get()));
1019 } 1019 }
1020 1020
1021 TEST_F(PeerConnectionInterfaceTest, 1021 TEST_F(PeerConnectionInterfaceTest,
1022 CreatePeerConnectionWithDifferentConfigurations) { 1022 CreatePeerConnectionWithDifferentConfigurations) {
1023 CreatePeerConnectionWithDifferentConfigurations(); 1023 CreatePeerConnectionWithDifferentConfigurations();
1024 } 1024 }
1025 1025
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 FakeConstraints updated_answer_c; 2806 FakeConstraints updated_answer_c;
2807 answer_c.SetMandatoryReceiveAudio(false); 2807 answer_c.SetMandatoryReceiveAudio(false);
2808 answer_c.SetMandatoryReceiveVideo(false); 2808 answer_c.SetMandatoryReceiveVideo(false);
2809 2809
2810 cricket::MediaSessionOptions updated_answer_options; 2810 cricket::MediaSessionOptions updated_answer_options;
2811 EXPECT_TRUE( 2811 EXPECT_TRUE(
2812 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); 2812 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options));
2813 EXPECT_TRUE(updated_answer_options.has_audio()); 2813 EXPECT_TRUE(updated_answer_options.has_audio());
2814 EXPECT_TRUE(updated_answer_options.has_video()); 2814 EXPECT_TRUE(updated_answer_options.has_video());
2815 } 2815 }
OLDNEW
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/api/rtpsender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698