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 12 matching lines...) Expand all Loading... |
23 #include <vector> | 23 #include <vector> |
24 | 24 |
25 #include "webrtc/api/fakemetricsobserver.h" | 25 #include "webrtc/api/fakemetricsobserver.h" |
26 #include "webrtc/api/mediastreaminterface.h" | 26 #include "webrtc/api/mediastreaminterface.h" |
27 #include "webrtc/api/peerconnectioninterface.h" | 27 #include "webrtc/api/peerconnectioninterface.h" |
28 #include "webrtc/api/test/fakeconstraints.h" | 28 #include "webrtc/api/test/fakeconstraints.h" |
29 #include "webrtc/base/asyncinvoker.h" | 29 #include "webrtc/base/asyncinvoker.h" |
30 #include "webrtc/base/fakenetwork.h" | 30 #include "webrtc/base/fakenetwork.h" |
31 #include "webrtc/base/gunit.h" | 31 #include "webrtc/base/gunit.h" |
32 #include "webrtc/base/helpers.h" | 32 #include "webrtc/base/helpers.h" |
33 #include "webrtc/base/physicalsocketserver.h" | |
34 #include "webrtc/base/ssladapter.h" | 33 #include "webrtc/base/ssladapter.h" |
35 #include "webrtc/base/sslstreamadapter.h" | 34 #include "webrtc/base/sslstreamadapter.h" |
36 #include "webrtc/base/thread.h" | 35 #include "webrtc/base/thread.h" |
37 #include "webrtc/base/virtualsocketserver.h" | 36 #include "webrtc/base/virtualsocketserver.h" |
38 #include "webrtc/media/engine/fakewebrtcvideoengine.h" | 37 #include "webrtc/media/engine/fakewebrtcvideoengine.h" |
39 #include "webrtc/p2p/base/p2pconstants.h" | 38 #include "webrtc/p2p/base/p2pconstants.h" |
40 #include "webrtc/p2p/base/portinterface.h" | 39 #include "webrtc/p2p/base/portinterface.h" |
41 #include "webrtc/p2p/base/sessiondescription.h" | 40 #include "webrtc/p2p/base/sessiondescription.h" |
42 #include "webrtc/p2p/base/testturnserver.h" | 41 #include "webrtc/p2p/base/testturnserver.h" |
43 #include "webrtc/p2p/client/basicportallocator.h" | 42 #include "webrtc/p2p/client/basicportallocator.h" |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 friend class PeerConnectionIntegrationTest; | 929 friend class PeerConnectionIntegrationTest; |
931 }; | 930 }; |
932 | 931 |
933 // Tests two PeerConnections connecting to each other end-to-end, using a | 932 // Tests two PeerConnections connecting to each other end-to-end, using a |
934 // virtual network, fake A/V capture and fake encoder/decoders. The | 933 // virtual network, fake A/V capture and fake encoder/decoders. The |
935 // PeerConnections share the threads/socket servers, but use separate versions | 934 // PeerConnections share the threads/socket servers, but use separate versions |
936 // of everything else (including "PeerConnectionFactory"s). | 935 // of everything else (including "PeerConnectionFactory"s). |
937 class PeerConnectionIntegrationTest : public testing::Test { | 936 class PeerConnectionIntegrationTest : public testing::Test { |
938 public: | 937 public: |
939 PeerConnectionIntegrationTest() | 938 PeerConnectionIntegrationTest() |
940 : pss_(new rtc::PhysicalSocketServer), | 939 : ss_(new rtc::VirtualSocketServer()), |
941 ss_(new rtc::VirtualSocketServer(pss_.get())), | |
942 network_thread_(new rtc::Thread(ss_.get())), | 940 network_thread_(new rtc::Thread(ss_.get())), |
943 worker_thread_(rtc::Thread::Create()) { | 941 worker_thread_(rtc::Thread::Create()) { |
944 RTC_CHECK(network_thread_->Start()); | 942 RTC_CHECK(network_thread_->Start()); |
945 RTC_CHECK(worker_thread_->Start()); | 943 RTC_CHECK(worker_thread_->Start()); |
946 } | 944 } |
947 | 945 |
948 ~PeerConnectionIntegrationTest() { | 946 ~PeerConnectionIntegrationTest() { |
949 if (caller_) { | 947 if (caller_) { |
950 caller_->set_signaling_message_receiver(nullptr); | 948 caller_->set_signaling_message_receiver(nullptr); |
951 } | 949 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(expected_cipher_suite), | 1134 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(expected_cipher_suite), |
1137 caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout); | 1135 caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout); |
1138 EXPECT_EQ( | 1136 EXPECT_EQ( |
1139 1, caller_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, | 1137 1, caller_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, |
1140 expected_cipher_suite)); | 1138 expected_cipher_suite)); |
1141 caller()->pc()->RegisterUMAObserver(nullptr); | 1139 caller()->pc()->RegisterUMAObserver(nullptr); |
1142 } | 1140 } |
1143 | 1141 |
1144 private: | 1142 private: |
1145 // |ss_| is used by |network_thread_| so it must be destroyed later. | 1143 // |ss_| is used by |network_thread_| so it must be destroyed later. |
1146 std::unique_ptr<rtc::PhysicalSocketServer> pss_; | |
1147 std::unique_ptr<rtc::VirtualSocketServer> ss_; | 1144 std::unique_ptr<rtc::VirtualSocketServer> ss_; |
1148 // |network_thread_| and |worker_thread_| are used by both | 1145 // |network_thread_| and |worker_thread_| are used by both |
1149 // |caller_| and |callee_| so they must be destroyed | 1146 // |caller_| and |callee_| so they must be destroyed |
1150 // later. | 1147 // later. |
1151 std::unique_ptr<rtc::Thread> network_thread_; | 1148 std::unique_ptr<rtc::Thread> network_thread_; |
1152 std::unique_ptr<rtc::Thread> worker_thread_; | 1149 std::unique_ptr<rtc::Thread> worker_thread_; |
1153 std::unique_ptr<PeerConnectionWrapper> caller_; | 1150 std::unique_ptr<PeerConnectionWrapper> caller_; |
1154 std::unique_ptr<PeerConnectionWrapper> callee_; | 1151 std::unique_ptr<PeerConnectionWrapper> callee_; |
1155 }; | 1152 }; |
1156 | 1153 |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2905 caller()->CreateAndSetAndSignalOffer(); | 2902 caller()->CreateAndSetAndSignalOffer(); |
2906 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); | 2903 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
2907 // Wait for additional audio frames to be received by the callee. | 2904 // Wait for additional audio frames to be received by the callee. |
2908 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, | 2905 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, |
2909 kMaxWaitForFramesMs); | 2906 kMaxWaitForFramesMs); |
2910 } | 2907 } |
2911 | 2908 |
2912 } // namespace | 2909 } // namespace |
2913 | 2910 |
2914 #endif // if !defined(THREAD_SANITIZER) | 2911 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |