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

Unified Diff: webrtc/pc/peerconnectioninterface_unittest.cc

Issue 2985653003: Add "max_ipv6_networks" field to RTCConfiguration. (Closed)
Patch Set: Rebase Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnectioninterface_unittest.cc
diff --git a/webrtc/pc/peerconnectioninterface_unittest.cc b/webrtc/pc/peerconnectioninterface_unittest.cc
index 1a26a4352277fa5aa616f80d5725f82707bcce1b..114ffd75e215206d7df47aaf0fb14bd45565689c 100644
--- a/webrtc/pc/peerconnectioninterface_unittest.cc
+++ b/webrtc/pc/peerconnectioninterface_unittest.cc
@@ -1285,10 +1285,58 @@ TEST_F(PeerConnectionInterfaceTest, CreatePeerConnectionWithPooledCandidates) {
session->flags() & cricket::PORTALLOCATOR_DISABLE_COSTLY_NETWORKS);
}
+// Test that network-related RTCConfiguration members are applied to the
+// PortAllocator when CreatePeerConnection is called. Specifically:
+// - disable_ipv6_on_wifi
+// - max_ipv6_networks
+// - tcp_candidate_policy
+// - candidate_network_policy
+// - prune_turn_ports
+//
+// Note that the candidate filter (RTCConfiguration::type) is already tested
+// above.
+TEST_F(PeerConnectionInterfaceTest,
+ CreatePeerConnectionAppliesNetworkConfigToPortAllocator) {
+ // Create fake port allocator.
+ std::unique_ptr<cricket::FakePortAllocator> port_allocator(
+ new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
+ cricket::FakePortAllocator* raw_port_allocator = port_allocator.get();
+
+ // Create RTCConfiguration with some network-related fields relevant to
+ // PortAllocator populated.
+ PeerConnectionInterface::RTCConfiguration config;
+ config.disable_ipv6_on_wifi = true;
+ config.max_ipv6_networks = 10;
+ config.tcp_candidate_policy =
+ PeerConnectionInterface::kTcpCandidatePolicyDisabled;
+ config.candidate_network_policy =
+ PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
+ config.prune_turn_ports = true;
+
+ // Create the PC factory and PC with the above config.
+ rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory(
+ webrtc::CreatePeerConnectionFactory(
+ rtc::Thread::Current(), rtc::Thread::Current(),
+ rtc::Thread::Current(), nullptr, nullptr, nullptr));
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
+ pc_factory->CreatePeerConnection(
+ config, nullptr, std::move(port_allocator), nullptr, &observer_));
+
+ // Now validate that the config fields set above were applied to the
+ // PortAllocator, as flags or otherwise.
+ EXPECT_FALSE(raw_port_allocator->flags() &
+ cricket::PORTALLOCATOR_ENABLE_IPV6_ON_WIFI);
+ EXPECT_EQ(10, raw_port_allocator->max_ipv6_networks());
+ EXPECT_TRUE(raw_port_allocator->flags() & cricket::PORTALLOCATOR_DISABLE_TCP);
+ EXPECT_TRUE(raw_port_allocator->flags() &
+ cricket::PORTALLOCATOR_DISABLE_COSTLY_NETWORKS);
+ EXPECT_TRUE(raw_port_allocator->prune_turn_ports());
+}
+
// Test that the PeerConnection initializes the port allocator passed into it,
// and on the correct thread.
TEST_F(PeerConnectionInterfaceTest,
- CreatePeerConnectionInitializesPortAllocator) {
+ CreatePeerConnectionInitializesPortAllocatorOnNetworkThread) {
std::unique_ptr<rtc::Thread> network_thread(
rtc::Thread::CreateWithSocketServer());
network_thread->Start();
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698