Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: webrtc/ortc/ortcfactory_integrationtest.cc

Issue 2883313003: Remove VirtualSocketServer's dependency on PhysicalSocketServer. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/virtualsocketserver.cc ('k') | webrtc/ortc/ortcfactory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 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 <utility> // For std::pair, std::move. 12 #include <utility> // For std::pair, std::move.
13 13
14 #include "webrtc/api/ortc/ortcfactoryinterface.h" 14 #include "webrtc/api/ortc/ortcfactoryinterface.h"
15 #include "webrtc/base/criticalsection.h" 15 #include "webrtc/base/criticalsection.h"
16 #include "webrtc/base/fakenetwork.h" 16 #include "webrtc/base/fakenetwork.h"
17 #include "webrtc/base/gunit.h" 17 #include "webrtc/base/gunit.h"
18 #include "webrtc/base/physicalsocketserver.h"
19 #include "webrtc/base/virtualsocketserver.h" 18 #include "webrtc/base/virtualsocketserver.h"
20 #include "webrtc/ortc/testrtpparameters.h" 19 #include "webrtc/ortc/testrtpparameters.h"
21 #include "webrtc/p2p/base/udptransport.h" 20 #include "webrtc/p2p/base/udptransport.h"
22 #include "webrtc/pc/test/fakeaudiocapturemodule.h" 21 #include "webrtc/pc/test/fakeaudiocapturemodule.h"
23 #include "webrtc/pc/test/fakeperiodicvideocapturer.h" 22 #include "webrtc/pc/test/fakeperiodicvideocapturer.h"
24 #include "webrtc/pc/test/fakevideotrackrenderer.h" 23 #include "webrtc/pc/test/fakevideotrackrenderer.h"
25 24
26 namespace { 25 namespace {
27 26
28 const int kDefaultTimeout = 10000; // 10 seconds. 27 const int kDefaultTimeout = 10000; // 10 seconds.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 62
64 // Used to test that things work end-to-end when using the default 63 // Used to test that things work end-to-end when using the default
65 // implementations of threads/etc. provided by OrtcFactory, with the exception 64 // implementations of threads/etc. provided by OrtcFactory, with the exception
66 // of using a virtual network. 65 // of using a virtual network.
67 // 66 //
68 // By default, the virtual network manager doesn't enumerate any networks, but 67 // By default, the virtual network manager doesn't enumerate any networks, but
69 // sockets can still be created in this state. 68 // sockets can still be created in this state.
70 class OrtcFactoryIntegrationTest : public testing::Test { 69 class OrtcFactoryIntegrationTest : public testing::Test {
71 public: 70 public:
72 OrtcFactoryIntegrationTest() 71 OrtcFactoryIntegrationTest()
73 : virtual_socket_server_(&physical_socket_server_), 72 : network_thread_(&virtual_socket_server_),
74 network_thread_(&virtual_socket_server_),
75 fake_audio_capture_module1_(FakeAudioCaptureModule::Create()), 73 fake_audio_capture_module1_(FakeAudioCaptureModule::Create()),
76 fake_audio_capture_module2_(FakeAudioCaptureModule::Create()) { 74 fake_audio_capture_module2_(FakeAudioCaptureModule::Create()) {
77 // Sockets are bound to the ANY address, so this is needed to tell the 75 // Sockets are bound to the ANY address, so this is needed to tell the
78 // virtual network which address to use in this case. 76 // virtual network which address to use in this case.
79 virtual_socket_server_.SetDefaultRoute(kIPv4LocalHostAddress); 77 virtual_socket_server_.SetDefaultRoute(kIPv4LocalHostAddress);
80 network_thread_.Start(); 78 network_thread_.Start();
81 // Need to create after network thread is started. 79 // Need to create after network thread is started.
82 ortc_factory1_ = OrtcFactoryInterface::Create( 80 ortc_factory1_ = OrtcFactoryInterface::Create(
83 &network_thread_, nullptr, &fake_network_manager_, 81 &network_thread_, nullptr, &fake_network_manager_,
84 nullptr, fake_audio_capture_module1_) 82 nullptr, fake_audio_capture_module1_)
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 kDefaultTimeout); 321 kDefaultTimeout);
324 } else { 322 } else {
325 WAIT(false, kReceivingDuration); 323 WAIT(false, kReceivingDuration);
326 rendered_video_frames1_ = fake_video_renderer1.num_rendered_frames(); 324 rendered_video_frames1_ = fake_video_renderer1.num_rendered_frames();
327 rendered_video_frames2_ = fake_video_renderer2.num_rendered_frames(); 325 rendered_video_frames2_ = fake_video_renderer2.num_rendered_frames();
328 received_audio_frames1_ = fake_audio_capture_module1_->frames_received(); 326 received_audio_frames1_ = fake_audio_capture_module1_->frames_received();
329 received_audio_frames2_ = fake_audio_capture_module2_->frames_received(); 327 received_audio_frames2_ = fake_audio_capture_module2_->frames_received();
330 } 328 }
331 } 329 }
332 330
333 rtc::PhysicalSocketServer physical_socket_server_;
334 rtc::VirtualSocketServer virtual_socket_server_; 331 rtc::VirtualSocketServer virtual_socket_server_;
335 rtc::Thread network_thread_; 332 rtc::Thread network_thread_;
336 rtc::FakeNetworkManager fake_network_manager_; 333 rtc::FakeNetworkManager fake_network_manager_;
337 rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module1_; 334 rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module1_;
338 rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module2_; 335 rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module2_;
339 std::unique_ptr<OrtcFactoryInterface> ortc_factory1_; 336 std::unique_ptr<OrtcFactoryInterface> ortc_factory1_;
340 std::unique_ptr<OrtcFactoryInterface> ortc_factory2_; 337 std::unique_ptr<OrtcFactoryInterface> ortc_factory2_;
341 // Actually owned by video tracks. 338 // Actually owned by video tracks.
342 std::vector<cricket::FakeVideoCapturer*> fake_video_capturers_; 339 std::vector<cricket::FakeVideoCapturer*> fake_video_capturers_;
343 int received_audio_frames1_ = 0; 340 int received_audio_frames1_ = 0;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // BaseChannel model relies on there being a single VoiceChannel and 672 // BaseChannel model relies on there being a single VoiceChannel and
676 // VideoChannel, and these only support a single set of codecs/etc. per 673 // VideoChannel, and these only support a single set of codecs/etc. per
677 // send/receive direction. 674 // send/receive direction.
678 675
679 // TODO(deadbeef): End-to-end test for simulcast, once that's supported by this 676 // TODO(deadbeef): End-to-end test for simulcast, once that's supported by this
680 // API. 677 // API.
681 678
682 #endif // if !defined(THREAD_SANITIZER) 679 #endif // if !defined(THREAD_SANITIZER)
683 680
684 } // namespace webrtc 681 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/base/virtualsocketserver.cc ('k') | webrtc/ortc/ortcfactory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698