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

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 2568833002: Refactor "secure bool" into explicit PROTO_TLS. (Closed)
Patch Set: GetRelayPreference(): Add RTC_DCHECK(proto == PROTO_UDP). Created 4 years 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/api/webrtcsession_unittest.cc ('k') | webrtc/p2p/base/port.h » ('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 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 cricket::BasicPortAllocator* CreateBasicPortAllocator( 136 cricket::BasicPortAllocator* CreateBasicPortAllocator(
137 rtc::NetworkManager* network_manager, 137 rtc::NetworkManager* network_manager,
138 const cricket::ServerAddresses& stun_servers, 138 const cricket::ServerAddresses& stun_servers,
139 const rtc::SocketAddress& turn_server_udp, 139 const rtc::SocketAddress& turn_server_udp,
140 const rtc::SocketAddress& turn_server_tcp) { 140 const rtc::SocketAddress& turn_server_tcp) {
141 cricket::RelayServerConfig turn_server(cricket::RELAY_TURN); 141 cricket::RelayServerConfig turn_server(cricket::RELAY_TURN);
142 turn_server.credentials = kRelayCredentials; 142 turn_server.credentials = kRelayCredentials;
143 if (!turn_server_udp.IsNil()) { 143 if (!turn_server_udp.IsNil()) {
144 turn_server.ports.push_back( 144 turn_server.ports.push_back(
145 cricket::ProtocolAddress(turn_server_udp, cricket::PROTO_UDP, false)); 145 cricket::ProtocolAddress(turn_server_udp, cricket::PROTO_UDP));
146 } 146 }
147 if (!turn_server_tcp.IsNil()) { 147 if (!turn_server_tcp.IsNil()) {
148 turn_server.ports.push_back( 148 turn_server.ports.push_back(
149 cricket::ProtocolAddress(turn_server_tcp, cricket::PROTO_TCP, false)); 149 cricket::ProtocolAddress(turn_server_tcp, cricket::PROTO_TCP));
150 } 150 }
151 std::vector<cricket::RelayServerConfig> turn_servers(1, turn_server); 151 std::vector<cricket::RelayServerConfig> turn_servers(1, turn_server);
152 152
153 cricket::BasicPortAllocator* allocator = 153 cricket::BasicPortAllocator* allocator =
154 new cricket::BasicPortAllocator(network_manager); 154 new cricket::BasicPortAllocator(network_manager);
155 allocator->SetConfiguration(stun_servers, turn_servers, 0, false); 155 allocator->SetConfiguration(stun_servers, turn_servers, 0, false);
156 return allocator; 156 return allocator;
157 } 157 }
158 } // namespace 158 } // namespace
159 159
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 DestroyChannels(); 2246 DestroyChannels();
2247 } 2247 }
2248 2248
2249 // Tests that we can quickly switch links if an interface goes down when 2249 // Tests that we can quickly switch links if an interface goes down when
2250 // there are many connections. 2250 // there are many connections.
2251 TEST_F(P2PTransportChannelMultihomedTest, TestFailoverWithManyConnections) { 2251 TEST_F(P2PTransportChannelMultihomedTest, TestFailoverWithManyConnections) {
2252 rtc::ScopedFakeClock clock; 2252 rtc::ScopedFakeClock clock;
2253 test_turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); 2253 test_turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
2254 RelayServerConfig turn_server(RELAY_TURN); 2254 RelayServerConfig turn_server(RELAY_TURN);
2255 turn_server.credentials = kRelayCredentials; 2255 turn_server.credentials = kRelayCredentials;
2256 turn_server.ports.push_back( 2256 turn_server.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP));
2257 ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP, false));
2258 GetAllocator(0)->AddTurnServer(turn_server); 2257 GetAllocator(0)->AddTurnServer(turn_server);
2259 GetAllocator(1)->AddTurnServer(turn_server); 2258 GetAllocator(1)->AddTurnServer(turn_server);
2260 // Enable IPv6 2259 // Enable IPv6
2261 SetAllocatorFlags(0, PORTALLOCATOR_ENABLE_IPV6); 2260 SetAllocatorFlags(0, PORTALLOCATOR_ENABLE_IPV6);
2262 SetAllocatorFlags(1, PORTALLOCATOR_ENABLE_IPV6); 2261 SetAllocatorFlags(1, PORTALLOCATOR_ENABLE_IPV6);
2263 SetAllocationStepDelay(0, kMinimumStepDelay); 2262 SetAllocationStepDelay(0, kMinimumStepDelay);
2264 SetAllocationStepDelay(1, kMinimumStepDelay); 2263 SetAllocationStepDelay(1, kMinimumStepDelay);
2265 2264
2266 auto& wifi = kPublicAddrs; 2265 auto& wifi = kPublicAddrs;
2267 auto& cellular = kAlternateAddrs; 2266 auto& cellular = kAlternateAddrs;
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after
4360 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE); 4359 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE);
4361 } 4360 }
4362 4361
4363 // Test the ping sequence is UDP Relay/Relay followed by TCP Relay/Relay, 4362 // Test the ping sequence is UDP Relay/Relay followed by TCP Relay/Relay,
4364 // followed by the rest. 4363 // followed by the rest.
4365 TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest, TestTcpTurn) { 4364 TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest, TestTcpTurn) {
4366 // Add a Tcp Turn server. 4365 // Add a Tcp Turn server.
4367 turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); 4366 turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
4368 RelayServerConfig config(RELAY_TURN); 4367 RelayServerConfig config(RELAY_TURN);
4369 config.credentials = kRelayCredentials; 4368 config.credentials = kRelayCredentials;
4370 config.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP, false)); 4369 config.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP));
4371 allocator()->AddTurnServer(config); 4370 allocator()->AddTurnServer(config);
4372 4371
4373 P2PTransportChannel& ch = StartTransportChannel(true, 100); 4372 P2PTransportChannel& ch = StartTransportChannel(true, 100);
4374 EXPECT_TRUE_WAIT(ch.ports().size() == 3, kDefaultTimeout); 4373 EXPECT_TRUE_WAIT(ch.ports().size() == 3, kDefaultTimeout);
4375 EXPECT_EQ(ch.ports()[0]->Type(), LOCAL_PORT_TYPE); 4374 EXPECT_EQ(ch.ports()[0]->Type(), LOCAL_PORT_TYPE);
4376 EXPECT_EQ(ch.ports()[1]->Type(), RELAY_PORT_TYPE); 4375 EXPECT_EQ(ch.ports()[1]->Type(), RELAY_PORT_TYPE);
4377 EXPECT_EQ(ch.ports()[2]->Type(), RELAY_PORT_TYPE); 4376 EXPECT_EQ(ch.ports()[2]->Type(), RELAY_PORT_TYPE);
4378 4377
4379 // Remote Relay candidate arrives. 4378 // Remote Relay candidate arrives.
4380 ch.AddRemoteCandidate(CreateUdpCandidate(RELAY_PORT_TYPE, "1.1.1.1", 1, 1)); 4379 ch.AddRemoteCandidate(CreateUdpCandidate(RELAY_PORT_TYPE, "1.1.1.1", 1, 1));
4381 EXPECT_TRUE_WAIT(ch.connections().size() == 3, kDefaultTimeout); 4380 EXPECT_TRUE_WAIT(ch.connections().size() == 3, kDefaultTimeout);
4382 4381
4383 // UDP Relay/Relay should be pinged first. 4382 // UDP Relay/Relay should be pinged first.
4384 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE); 4383 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE);
4385 4384
4386 // TCP Relay/Relay is the next. 4385 // TCP Relay/Relay is the next.
4387 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, 4386 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE,
4388 TCP_PROTOCOL_NAME); 4387 TCP_PROTOCOL_NAME);
4389 4388
4390 // Finally, Local/Relay will be pinged. 4389 // Finally, Local/Relay will be pinged.
4391 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); 4390 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE);
4392 } 4391 }
4393 4392
4394 } // namespace cricket { 4393 } // namespace cricket {
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession_unittest.cc ('k') | webrtc/p2p/base/port.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698