Always inject PacketSocketFactory in FakePortAllocator

This CL removes the use of the rtc::Thread::socketserver() method
in one place.

Bug: webrtc:13145
Change-Id: I1a1b2501450788263d5280c43e4328ade46f4146
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/263320
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Cr-Commit-Position: refs/heads/main@{#37340}
This commit is contained in:
Byoungchan Lee
2022-06-27 18:05:22 +09:00
committed by WebRTC LUCI CQ
parent fe053426e2
commit d58f526384
17 changed files with 172 additions and 89 deletions

View File

@ -728,7 +728,9 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
pc_ = nullptr;
}
std::unique_ptr<cricket::FakePortAllocator> port_allocator(
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
new cricket::FakePortAllocator(
rtc::Thread::Current(),
std::make_unique<rtc::BasicPacketSocketFactory>(vss_.get())));
port_allocator_ = port_allocator.get();
// Create certificate generator unless DTLS constraint is explicitly set to
@ -1250,6 +1252,8 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
}
}
rtc::SocketServer* socket_server() const { return vss_.get(); }
std::unique_ptr<rtc::VirtualSocketServer> vss_;
rtc::AutoSocketServerThread main_;
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
@ -1358,8 +1362,11 @@ TEST_P(PeerConnectionInterfaceTest, CreatePeerConnectionWithPooledCandidates) {
TEST_P(PeerConnectionInterfaceTest,
CreatePeerConnectionAppliesNetworkConfigToPortAllocator) {
// Create fake port allocator.
std::unique_ptr<rtc::PacketSocketFactory> packet_socket_factory(
new rtc::BasicPacketSocketFactory(socket_server()));
std::unique_ptr<cricket::FakePortAllocator> port_allocator(
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
new cricket::FakePortAllocator(rtc::Thread::Current(),
packet_socket_factory.get()));
cricket::FakePortAllocator* raw_port_allocator = port_allocator.get();
// Create RTCConfiguration with some network-related fields relevant to