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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 } | 927 } |
928 | 928 |
929 void AddVideoTrack(const std::string& track_id, | 929 void AddVideoTrack(const std::string& track_id, |
930 MediaStreamInterface* stream) { | 930 MediaStreamInterface* stream) { |
931 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track( | 931 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track( |
932 webrtc::VideoTrack::Create(track_id, | 932 webrtc::VideoTrack::Create(track_id, |
933 webrtc::FakeVideoTrackSource::Create())); | 933 webrtc::FakeVideoTrackSource::Create())); |
934 ASSERT_TRUE(stream->AddTrack(video_track)); | 934 ASSERT_TRUE(stream->AddTrack(video_track)); |
935 } | 935 } |
936 | 936 |
937 std::unique_ptr<SessionDescriptionInterface> CreateOfferWithOneAudioStream() { | 937 rtc::scoped_ptr<SessionDescriptionInterface> CreateOfferWithOneAudioStream() { |
938 CreatePeerConnection(); | 938 CreatePeerConnection(); |
939 AddVoiceStream(kStreamLabel1); | 939 AddVoiceStream(kStreamLabel1); |
940 std::unique_ptr<SessionDescriptionInterface> offer; | 940 rtc::scoped_ptr<SessionDescriptionInterface> offer; |
941 EXPECT_TRUE(DoCreateOffer(&offer, nullptr)); | 941 EXPECT_TRUE(DoCreateOffer(&offer, nullptr)); |
942 return offer; | 942 return offer; |
943 } | 943 } |
944 | 944 |
945 std::unique_ptr<SessionDescriptionInterface> | 945 rtc::scoped_ptr<SessionDescriptionInterface> |
946 CreateAnswerWithOneAudioStream() { | 946 CreateAnswerWithOneAudioStream() { |
947 std::unique_ptr<SessionDescriptionInterface> offer = | 947 rtc::scoped_ptr<SessionDescriptionInterface> offer = |
948 CreateOfferWithOneAudioStream(); | 948 CreateOfferWithOneAudioStream(); |
949 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); | 949 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); |
950 std::unique_ptr<SessionDescriptionInterface> answer; | 950 rtc::scoped_ptr<SessionDescriptionInterface> answer; |
951 EXPECT_TRUE(DoCreateAnswer(&answer, nullptr)); | 951 EXPECT_TRUE(DoCreateAnswer(&answer, nullptr)); |
952 return answer; | 952 return answer; |
953 } | 953 } |
954 | 954 |
955 const std::string& GetFirstAudioStreamCname( | 955 const std::string& GetFirstAudioStreamCname( |
956 const SessionDescriptionInterface* desc) { | 956 const SessionDescriptionInterface* desc) { |
957 const cricket::ContentInfo* audio_content = | 957 const cricket::ContentInfo* audio_content = |
958 cricket::GetFirstAudioContent(desc->description()); | 958 cricket::GetFirstAudioContent(desc->description()); |
959 const cricket::AudioContentDescription* audio_desc = | 959 const cricket::AudioContentDescription* audio_desc = |
960 static_cast<const cricket::AudioContentDescription*>( | 960 static_cast<const cricket::AudioContentDescription*>( |
961 audio_content->description); | 961 audio_content->description); |
962 return audio_desc->streams()[0].cname; | 962 return audio_desc->streams()[0].cname; |
963 } | 963 } |
964 | 964 |
965 cricket::FakePortAllocator* port_allocator_ = nullptr; | 965 cricket::FakePortAllocator* port_allocator_ = nullptr; |
966 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; | 966 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; |
967 scoped_refptr<PeerConnectionInterface> pc_; | 967 scoped_refptr<PeerConnectionInterface> pc_; |
968 MockPeerConnectionObserver observer_; | 968 MockPeerConnectionObserver observer_; |
969 rtc::scoped_refptr<StreamCollection> reference_collection_; | 969 rtc::scoped_refptr<StreamCollection> reference_collection_; |
970 }; | 970 }; |
971 | 971 |
972 // Generate different CNAMEs when PeerConnections are created. | 972 // Generate different CNAMEs when PeerConnections are created. |
973 // The CNAMEs are expected to be generated randomly. It is possible | 973 // The CNAMEs are expected to be generated randomly. It is possible |
974 // that the test fails, though the possibility is very low. | 974 // that the test fails, though the possibility is very low. |
975 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInOffer) { | 975 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInOffer) { |
976 std::unique_ptr<SessionDescriptionInterface> offer1 = | 976 rtc::scoped_ptr<SessionDescriptionInterface> offer1 = |
977 CreateOfferWithOneAudioStream(); | 977 CreateOfferWithOneAudioStream(); |
978 std::unique_ptr<SessionDescriptionInterface> offer2 = | 978 rtc::scoped_ptr<SessionDescriptionInterface> offer2 = |
979 CreateOfferWithOneAudioStream(); | 979 CreateOfferWithOneAudioStream(); |
980 EXPECT_NE(GetFirstAudioStreamCname(offer1.get()), | 980 EXPECT_NE(GetFirstAudioStreamCname(offer1.get()), |
981 GetFirstAudioStreamCname(offer2.get())); | 981 GetFirstAudioStreamCname(offer2.get())); |
982 } | 982 } |
983 | 983 |
984 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInAnswer) { | 984 TEST_F(PeerConnectionInterfaceTest, CnameGenerationInAnswer) { |
985 std::unique_ptr<SessionDescriptionInterface> answer1 = | 985 rtc::scoped_ptr<SessionDescriptionInterface> answer1 = |
986 CreateAnswerWithOneAudioStream(); | 986 CreateAnswerWithOneAudioStream(); |
987 std::unique_ptr<SessionDescriptionInterface> answer2 = | 987 rtc::scoped_ptr<SessionDescriptionInterface> answer2 = |
988 CreateAnswerWithOneAudioStream(); | 988 CreateAnswerWithOneAudioStream(); |
989 EXPECT_NE(GetFirstAudioStreamCname(answer1.get()), | 989 EXPECT_NE(GetFirstAudioStreamCname(answer1.get()), |
990 GetFirstAudioStreamCname(answer2.get())); | 990 GetFirstAudioStreamCname(answer2.get())); |
991 } | 991 } |
992 | 992 |
993 TEST_F(PeerConnectionInterfaceTest, | 993 TEST_F(PeerConnectionInterfaceTest, |
994 CreatePeerConnectionWithDifferentConfigurations) { | 994 CreatePeerConnectionWithDifferentConfigurations) { |
995 CreatePeerConnectionWithDifferentConfigurations(); | 995 CreatePeerConnectionWithDifferentConfigurations(); |
996 } | 996 } |
997 | 997 |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 FakeConstraints updated_answer_c; | 2710 FakeConstraints updated_answer_c; |
2711 answer_c.SetMandatoryReceiveAudio(false); | 2711 answer_c.SetMandatoryReceiveAudio(false); |
2712 answer_c.SetMandatoryReceiveVideo(false); | 2712 answer_c.SetMandatoryReceiveVideo(false); |
2713 | 2713 |
2714 cricket::MediaSessionOptions updated_answer_options; | 2714 cricket::MediaSessionOptions updated_answer_options; |
2715 EXPECT_TRUE( | 2715 EXPECT_TRUE( |
2716 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2716 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2717 EXPECT_TRUE(updated_answer_options.has_audio()); | 2717 EXPECT_TRUE(updated_answer_options.has_audio()); |
2718 EXPECT_TRUE(updated_answer_options.has_video()); | 2718 EXPECT_TRUE(updated_answer_options.has_video()); |
2719 } | 2719 } |
OLD | NEW |