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 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 static_cast<const cricket::FakePortAllocatorSession*>( | 1059 static_cast<const cricket::FakePortAllocatorSession*>( |
1060 port_allocator_->GetPooledSession()); | 1060 port_allocator_->GetPooledSession()); |
1061 ASSERT_NE(nullptr, session); | 1061 ASSERT_NE(nullptr, session); |
1062 EXPECT_EQ(1UL, session->stun_servers().size()); | 1062 EXPECT_EQ(1UL, session->stun_servers().size()); |
1063 EXPECT_EQ(0U, session->flags() & cricket::PORTALLOCATOR_ENABLE_IPV6); | 1063 EXPECT_EQ(0U, session->flags() & cricket::PORTALLOCATOR_ENABLE_IPV6); |
1064 EXPECT_LT(0U, session->flags() & cricket::PORTALLOCATOR_DISABLE_TCP); | 1064 EXPECT_LT(0U, session->flags() & cricket::PORTALLOCATOR_DISABLE_TCP); |
1065 EXPECT_LT(0U, | 1065 EXPECT_LT(0U, |
1066 session->flags() & cricket::PORTALLOCATOR_DISABLE_COSTLY_NETWORKS); | 1066 session->flags() & cricket::PORTALLOCATOR_DISABLE_COSTLY_NETWORKS); |
1067 } | 1067 } |
1068 | 1068 |
| 1069 // Test that the PeerConnection initializes the port allocator passed into it, |
| 1070 // and on the correct thread. |
| 1071 TEST_F(PeerConnectionInterfaceTest, |
| 1072 CreatePeerConnectionInitializesPortAllocator) { |
| 1073 rtc::Thread network_thread; |
| 1074 network_thread.Start(); |
| 1075 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory( |
| 1076 webrtc::CreatePeerConnectionFactory( |
| 1077 &network_thread, rtc::Thread::Current(), rtc::Thread::Current(), |
| 1078 nullptr, nullptr, nullptr)); |
| 1079 std::unique_ptr<cricket::FakePortAllocator> port_allocator( |
| 1080 new cricket::FakePortAllocator(&network_thread, nullptr)); |
| 1081 cricket::FakePortAllocator* raw_port_allocator = port_allocator.get(); |
| 1082 PeerConnectionInterface::RTCConfiguration config; |
| 1083 rtc::scoped_refptr<PeerConnectionInterface> pc( |
| 1084 pc_factory->CreatePeerConnection( |
| 1085 config, nullptr, std::move(port_allocator), nullptr, &observer_)); |
| 1086 // FakePortAllocator RTC_CHECKs that it's initialized on the right thread, |
| 1087 // so all we have to do here is check that it's initialized. |
| 1088 EXPECT_TRUE(raw_port_allocator->initialized()); |
| 1089 } |
| 1090 |
1069 TEST_F(PeerConnectionInterfaceTest, AddStreams) { | 1091 TEST_F(PeerConnectionInterfaceTest, AddStreams) { |
1070 CreatePeerConnection(); | 1092 CreatePeerConnection(); |
1071 AddVideoStream(kStreamLabel1); | 1093 AddVideoStream(kStreamLabel1); |
1072 AddVoiceStream(kStreamLabel2); | 1094 AddVoiceStream(kStreamLabel2); |
1073 ASSERT_EQ(2u, pc_->local_streams()->count()); | 1095 ASSERT_EQ(2u, pc_->local_streams()->count()); |
1074 | 1096 |
1075 // Test we can add multiple local streams to one peerconnection. | 1097 // Test we can add multiple local streams to one peerconnection. |
1076 scoped_refptr<MediaStreamInterface> stream( | 1098 scoped_refptr<MediaStreamInterface> stream( |
1077 pc_factory_->CreateLocalMediaStream(kStreamLabel3)); | 1099 pc_factory_->CreateLocalMediaStream(kStreamLabel3)); |
1078 scoped_refptr<AudioTrackInterface> audio_track( | 1100 scoped_refptr<AudioTrackInterface> audio_track( |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 FakeConstraints updated_answer_c; | 2834 FakeConstraints updated_answer_c; |
2813 answer_c.SetMandatoryReceiveAudio(false); | 2835 answer_c.SetMandatoryReceiveAudio(false); |
2814 answer_c.SetMandatoryReceiveVideo(false); | 2836 answer_c.SetMandatoryReceiveVideo(false); |
2815 | 2837 |
2816 cricket::MediaSessionOptions updated_answer_options; | 2838 cricket::MediaSessionOptions updated_answer_options; |
2817 EXPECT_TRUE( | 2839 EXPECT_TRUE( |
2818 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2840 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2819 EXPECT_TRUE(updated_answer_options.has_audio()); | 2841 EXPECT_TRUE(updated_answer_options.has_audio()); |
2820 EXPECT_TRUE(updated_answer_options.has_video()); | 2842 EXPECT_TRUE(updated_answer_options.has_video()); |
2821 } | 2843 } |
OLD | NEW |