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 |
11 #include <memory> | 11 #include <memory> |
12 #include <sstream> | 12 #include <sstream> |
13 #include <string> | 13 #include <string> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 16 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
17 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" | 17 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" |
18 #include "webrtc/api/jsepsessiondescription.h" | 18 #include "webrtc/api/jsepsessiondescription.h" |
19 #include "webrtc/api/mediastreaminterface.h" | 19 #include "webrtc/api/mediastreaminterface.h" |
20 #include "webrtc/api/peerconnectioninterface.h" | 20 #include "webrtc/api/peerconnectioninterface.h" |
21 #include "webrtc/api/rtpreceiverinterface.h" | 21 #include "webrtc/api/rtpreceiverinterface.h" |
22 #include "webrtc/api/rtpsenderinterface.h" | 22 #include "webrtc/api/rtpsenderinterface.h" |
23 #include "webrtc/api/test/fakeconstraints.h" | 23 #include "webrtc/api/test/fakeconstraints.h" |
24 #include "webrtc/base/gunit.h" | 24 #include "webrtc/base/gunit.h" |
25 #include "webrtc/base/physicalsocketserver.h" | |
26 #include "webrtc/base/ssladapter.h" | 25 #include "webrtc/base/ssladapter.h" |
27 #include "webrtc/base/sslstreamadapter.h" | 26 #include "webrtc/base/sslstreamadapter.h" |
28 #include "webrtc/base/stringutils.h" | 27 #include "webrtc/base/stringutils.h" |
29 #include "webrtc/base/thread.h" | 28 #include "webrtc/base/thread.h" |
30 #include "webrtc/base/virtualsocketserver.h" | 29 #include "webrtc/base/virtualsocketserver.h" |
31 #include "webrtc/media/base/fakevideocapturer.h" | 30 #include "webrtc/media/base/fakevideocapturer.h" |
32 #include "webrtc/media/sctp/sctptransportinternal.h" | 31 #include "webrtc/media/sctp/sctptransportinternal.h" |
33 #include "webrtc/p2p/base/fakeportallocator.h" | 32 #include "webrtc/p2p/base/fakeportallocator.h" |
34 #include "webrtc/pc/audiotrack.h" | 33 #include "webrtc/pc/audiotrack.h" |
35 #include "webrtc/pc/mediasession.h" | 34 #include "webrtc/pc/mediasession.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 redetermine_role_on_ice_restart, rtc::CryptoOptions()); | 654 redetermine_role_on_ice_restart, rtc::CryptoOptions()); |
656 return transport_controller; | 655 return transport_controller; |
657 } | 656 } |
658 | 657 |
659 cricket::TransportController* transport_controller; | 658 cricket::TransportController* transport_controller; |
660 }; | 659 }; |
661 | 660 |
662 class PeerConnectionInterfaceTest : public testing::Test { | 661 class PeerConnectionInterfaceTest : public testing::Test { |
663 protected: | 662 protected: |
664 PeerConnectionInterfaceTest() | 663 PeerConnectionInterfaceTest() |
665 : pss_(new rtc::PhysicalSocketServer), | 664 : vss_(new rtc::VirtualSocketServer()), main_(vss_.get()) { |
666 vss_(new rtc::VirtualSocketServer(pss_.get())), | |
667 main_(vss_.get()) { | |
668 #ifdef WEBRTC_ANDROID | 665 #ifdef WEBRTC_ANDROID |
669 webrtc::InitializeAndroidObjects(); | 666 webrtc::InitializeAndroidObjects(); |
670 #endif | 667 #endif |
671 } | 668 } |
672 | 669 |
673 virtual void SetUp() { | 670 virtual void SetUp() { |
674 pc_factory_ = webrtc::CreatePeerConnectionFactory( | 671 pc_factory_ = webrtc::CreatePeerConnectionFactory( |
675 rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(), | 672 rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(), |
676 nullptr, nullptr, nullptr); | 673 nullptr, nullptr, nullptr); |
677 ASSERT_TRUE(pc_factory_); | 674 ASSERT_TRUE(pc_factory_); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 const std::string& GetFirstAudioStreamCname( | 1118 const std::string& GetFirstAudioStreamCname( |
1122 const SessionDescriptionInterface* desc) { | 1119 const SessionDescriptionInterface* desc) { |
1123 const cricket::ContentInfo* audio_content = | 1120 const cricket::ContentInfo* audio_content = |
1124 cricket::GetFirstAudioContent(desc->description()); | 1121 cricket::GetFirstAudioContent(desc->description()); |
1125 const cricket::AudioContentDescription* audio_desc = | 1122 const cricket::AudioContentDescription* audio_desc = |
1126 static_cast<const cricket::AudioContentDescription*>( | 1123 static_cast<const cricket::AudioContentDescription*>( |
1127 audio_content->description); | 1124 audio_content->description); |
1128 return audio_desc->streams()[0].cname; | 1125 return audio_desc->streams()[0].cname; |
1129 } | 1126 } |
1130 | 1127 |
1131 std::unique_ptr<rtc::PhysicalSocketServer> pss_; | |
1132 std::unique_ptr<rtc::VirtualSocketServer> vss_; | 1128 std::unique_ptr<rtc::VirtualSocketServer> vss_; |
1133 rtc::AutoSocketServerThread main_; | 1129 rtc::AutoSocketServerThread main_; |
1134 cricket::FakePortAllocator* port_allocator_ = nullptr; | 1130 cricket::FakePortAllocator* port_allocator_ = nullptr; |
1135 FakeRTCCertificateGenerator* fake_certificate_generator_ = nullptr; | 1131 FakeRTCCertificateGenerator* fake_certificate_generator_ = nullptr; |
1136 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; | 1132 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; |
1137 rtc::scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_; | 1133 rtc::scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_; |
1138 rtc::scoped_refptr<PeerConnectionInterface> pc_; | 1134 rtc::scoped_refptr<PeerConnectionInterface> pc_; |
1139 MockPeerConnectionObserver observer_; | 1135 MockPeerConnectionObserver observer_; |
1140 rtc::scoped_refptr<StreamCollection> reference_collection_; | 1136 rtc::scoped_refptr<StreamCollection> reference_collection_; |
1141 }; | 1137 }; |
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3590 EXPECT_NE(a, f); | 3586 EXPECT_NE(a, f); |
3591 | 3587 |
3592 PeerConnectionInterface::RTCConfiguration g; | 3588 PeerConnectionInterface::RTCConfiguration g; |
3593 g.disable_ipv6 = true; | 3589 g.disable_ipv6 = true; |
3594 EXPECT_NE(a, g); | 3590 EXPECT_NE(a, g); |
3595 | 3591 |
3596 PeerConnectionInterface::RTCConfiguration h( | 3592 PeerConnectionInterface::RTCConfiguration h( |
3597 PeerConnectionInterface::RTCConfigurationType::kAggressive); | 3593 PeerConnectionInterface::RTCConfigurationType::kAggressive); |
3598 EXPECT_NE(a, h); | 3594 EXPECT_NE(a, h); |
3599 } | 3595 } |
OLD | NEW |