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" |
25 #include "webrtc/base/ssladapter.h" | 26 #include "webrtc/base/ssladapter.h" |
26 #include "webrtc/base/sslstreamadapter.h" | 27 #include "webrtc/base/sslstreamadapter.h" |
27 #include "webrtc/base/stringutils.h" | 28 #include "webrtc/base/stringutils.h" |
28 #include "webrtc/base/thread.h" | 29 #include "webrtc/base/thread.h" |
| 30 #include "webrtc/base/virtualsocketserver.h" |
29 #include "webrtc/media/base/fakevideocapturer.h" | 31 #include "webrtc/media/base/fakevideocapturer.h" |
30 #include "webrtc/media/sctp/sctptransportinternal.h" | 32 #include "webrtc/media/sctp/sctptransportinternal.h" |
31 #include "webrtc/p2p/base/fakeportallocator.h" | 33 #include "webrtc/p2p/base/fakeportallocator.h" |
32 #include "webrtc/pc/audiotrack.h" | 34 #include "webrtc/pc/audiotrack.h" |
33 #include "webrtc/pc/mediasession.h" | 35 #include "webrtc/pc/mediasession.h" |
34 #include "webrtc/pc/mediastream.h" | 36 #include "webrtc/pc/mediastream.h" |
35 #include "webrtc/pc/peerconnection.h" | 37 #include "webrtc/pc/peerconnection.h" |
36 #include "webrtc/pc/streamcollection.h" | 38 #include "webrtc/pc/streamcollection.h" |
37 #include "webrtc/pc/test/fakertccertificategenerator.h" | 39 #include "webrtc/pc/test/fakertccertificategenerator.h" |
38 #include "webrtc/pc/test/fakevideotracksource.h" | 40 #include "webrtc/pc/test/fakevideotracksource.h" |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 rtc::Thread::Current(), rtc::Thread::Current(), port_allocator, | 654 rtc::Thread::Current(), rtc::Thread::Current(), port_allocator, |
653 redetermine_role_on_ice_restart, rtc::CryptoOptions()); | 655 redetermine_role_on_ice_restart, rtc::CryptoOptions()); |
654 return transport_controller; | 656 return transport_controller; |
655 } | 657 } |
656 | 658 |
657 cricket::TransportController* transport_controller; | 659 cricket::TransportController* transport_controller; |
658 }; | 660 }; |
659 | 661 |
660 class PeerConnectionInterfaceTest : public testing::Test { | 662 class PeerConnectionInterfaceTest : public testing::Test { |
661 protected: | 663 protected: |
662 PeerConnectionInterfaceTest() { | 664 PeerConnectionInterfaceTest() |
| 665 : pss_(new rtc::PhysicalSocketServer), |
| 666 vss_(new rtc::VirtualSocketServer(pss_.get())), |
| 667 main_(vss_.get()) { |
663 #ifdef WEBRTC_ANDROID | 668 #ifdef WEBRTC_ANDROID |
664 webrtc::InitializeAndroidObjects(); | 669 webrtc::InitializeAndroidObjects(); |
665 #endif | 670 #endif |
666 } | 671 } |
667 | 672 |
668 virtual void SetUp() { | 673 virtual void SetUp() { |
669 pc_factory_ = webrtc::CreatePeerConnectionFactory( | 674 pc_factory_ = webrtc::CreatePeerConnectionFactory( |
670 rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(), | 675 rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(), |
671 nullptr, nullptr, nullptr); | 676 nullptr, nullptr, nullptr); |
672 ASSERT_TRUE(pc_factory_); | 677 ASSERT_TRUE(pc_factory_); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 const std::string& GetFirstAudioStreamCname( | 1121 const std::string& GetFirstAudioStreamCname( |
1117 const SessionDescriptionInterface* desc) { | 1122 const SessionDescriptionInterface* desc) { |
1118 const cricket::ContentInfo* audio_content = | 1123 const cricket::ContentInfo* audio_content = |
1119 cricket::GetFirstAudioContent(desc->description()); | 1124 cricket::GetFirstAudioContent(desc->description()); |
1120 const cricket::AudioContentDescription* audio_desc = | 1125 const cricket::AudioContentDescription* audio_desc = |
1121 static_cast<const cricket::AudioContentDescription*>( | 1126 static_cast<const cricket::AudioContentDescription*>( |
1122 audio_content->description); | 1127 audio_content->description); |
1123 return audio_desc->streams()[0].cname; | 1128 return audio_desc->streams()[0].cname; |
1124 } | 1129 } |
1125 | 1130 |
| 1131 std::unique_ptr<rtc::PhysicalSocketServer> pss_; |
| 1132 std::unique_ptr<rtc::VirtualSocketServer> vss_; |
| 1133 rtc::AutoSocketServerThread main_; |
1126 cricket::FakePortAllocator* port_allocator_ = nullptr; | 1134 cricket::FakePortAllocator* port_allocator_ = nullptr; |
1127 FakeRTCCertificateGenerator* fake_certificate_generator_ = nullptr; | 1135 FakeRTCCertificateGenerator* fake_certificate_generator_ = nullptr; |
1128 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; | 1136 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; |
1129 rtc::scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_; | 1137 rtc::scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_; |
1130 rtc::scoped_refptr<PeerConnectionInterface> pc_; | 1138 rtc::scoped_refptr<PeerConnectionInterface> pc_; |
1131 MockPeerConnectionObserver observer_; | 1139 MockPeerConnectionObserver observer_; |
1132 rtc::scoped_refptr<StreamCollection> reference_collection_; | 1140 rtc::scoped_refptr<StreamCollection> reference_collection_; |
1133 }; | 1141 }; |
1134 | 1142 |
1135 // Test that no callbacks on the PeerConnectionObserver are called after the | 1143 // Test that no callbacks on the PeerConnectionObserver are called after the |
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 EXPECT_NE(a, f); | 3590 EXPECT_NE(a, f); |
3583 | 3591 |
3584 PeerConnectionInterface::RTCConfiguration g; | 3592 PeerConnectionInterface::RTCConfiguration g; |
3585 g.disable_ipv6 = true; | 3593 g.disable_ipv6 = true; |
3586 EXPECT_NE(a, g); | 3594 EXPECT_NE(a, g); |
3587 | 3595 |
3588 PeerConnectionInterface::RTCConfiguration h( | 3596 PeerConnectionInterface::RTCConfiguration h( |
3589 PeerConnectionInterface::RTCConfigurationType::kAggressive); | 3597 PeerConnectionInterface::RTCConfigurationType::kAggressive); |
3590 EXPECT_NE(a, h); | 3598 EXPECT_NE(a, h); |
3591 } | 3599 } |
OLD | NEW |