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

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

Issue 2766063005: Revert of Removing HTTPS and SOCKS proxy server code. (Closed)
Patch Set: Merge with master Created 3 years, 9 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/p2p/base/basicpacketsocketfactory.cc ('k') | webrtc/p2p/base/packetsocketfactory.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
11 #include <algorithm> 11 #include <algorithm>
12 #include <memory> 12 #include <memory>
13 13
14 #include "webrtc/api/fakemetricsobserver.h" 14 #include "webrtc/api/fakemetricsobserver.h"
15 #include "webrtc/base/checks.h" 15 #include "webrtc/base/checks.h"
16 #include "webrtc/base/dscp.h" 16 #include "webrtc/base/dscp.h"
17 #include "webrtc/base/fakeclock.h" 17 #include "webrtc/base/fakeclock.h"
18 #include "webrtc/base/fakenetwork.h" 18 #include "webrtc/base/fakenetwork.h"
19 #include "webrtc/base/firewallsocketserver.h" 19 #include "webrtc/base/firewallsocketserver.h"
20 #include "webrtc/base/gunit.h" 20 #include "webrtc/base/gunit.h"
21 #include "webrtc/base/helpers.h" 21 #include "webrtc/base/helpers.h"
22 #include "webrtc/base/logging.h" 22 #include "webrtc/base/logging.h"
23 #include "webrtc/base/natserver.h" 23 #include "webrtc/base/natserver.h"
24 #include "webrtc/base/natsocketfactory.h" 24 #include "webrtc/base/natsocketfactory.h"
25 #include "webrtc/base/physicalsocketserver.h" 25 #include "webrtc/base/physicalsocketserver.h"
26 #include "webrtc/base/proxyserver.h"
26 #include "webrtc/base/socketaddress.h" 27 #include "webrtc/base/socketaddress.h"
27 #include "webrtc/base/ssladapter.h" 28 #include "webrtc/base/ssladapter.h"
28 #include "webrtc/base/thread.h" 29 #include "webrtc/base/thread.h"
29 #include "webrtc/base/virtualsocketserver.h" 30 #include "webrtc/base/virtualsocketserver.h"
30 #include "webrtc/p2p/base/icetransportinternal.h" 31 #include "webrtc/p2p/base/icetransportinternal.h"
31 #include "webrtc/p2p/base/fakeportallocator.h" 32 #include "webrtc/p2p/base/fakeportallocator.h"
32 #include "webrtc/p2p/base/p2ptransportchannel.h" 33 #include "webrtc/p2p/base/p2ptransportchannel.h"
33 #include "webrtc/p2p/base/packettransportinternal.h" 34 #include "webrtc/p2p/base/packettransportinternal.h"
34 #include "webrtc/p2p/base/testrelayserver.h" 35 #include "webrtc/p2p/base/testrelayserver.h"
35 #include "webrtc/p2p/base/teststunserver.h" 36 #include "webrtc/p2p/base/teststunserver.h"
(...skipping 20 matching lines...) Expand all
56 // IPv6 Addresses on the public internet. 57 // IPv6 Addresses on the public internet.
57 static const SocketAddress kIPv6PublicAddrs[2] = { 58 static const SocketAddress kIPv6PublicAddrs[2] = {
58 SocketAddress("2400:4030:1:2c00:be30:abcd:efab:cdef", 0), 59 SocketAddress("2400:4030:1:2c00:be30:abcd:efab:cdef", 0),
59 SocketAddress("2600:0:1000:1b03:2e41:38ff:fea6:f2a4", 0)}; 60 SocketAddress("2600:0:1000:1b03:2e41:38ff:fea6:f2a4", 0)};
60 // For configuring multihomed clients. 61 // For configuring multihomed clients.
61 static const SocketAddress kAlternateAddrs[2] = { 62 static const SocketAddress kAlternateAddrs[2] = {
62 SocketAddress("101.101.101.101", 0), SocketAddress("202.202.202.202", 0)}; 63 SocketAddress("101.101.101.101", 0), SocketAddress("202.202.202.202", 0)};
63 static const SocketAddress kIPv6AlternateAddrs[2] = { 64 static const SocketAddress kIPv6AlternateAddrs[2] = {
64 SocketAddress("2401:4030:1:2c00:be30:abcd:efab:cdef", 0), 65 SocketAddress("2401:4030:1:2c00:be30:abcd:efab:cdef", 0),
65 SocketAddress("2601:0:1000:1b03:2e41:38ff:fea6:f2a4", 0)}; 66 SocketAddress("2601:0:1000:1b03:2e41:38ff:fea6:f2a4", 0)};
67 // Addresses for HTTP proxy servers.
68 static const SocketAddress kHttpsProxyAddrs[2] =
69 { SocketAddress("11.11.11.1", 443), SocketAddress("22.22.22.1", 443) };
70 // Addresses for SOCKS proxy servers.
71 static const SocketAddress kSocksProxyAddrs[2] =
72 { SocketAddress("11.11.11.1", 1080), SocketAddress("22.22.22.1", 1080) };
66 // Internal addresses for NAT boxes. 73 // Internal addresses for NAT boxes.
67 static const SocketAddress kNatAddrs[2] = 74 static const SocketAddress kNatAddrs[2] =
68 { SocketAddress("192.168.1.1", 0), SocketAddress("192.168.2.1", 0) }; 75 { SocketAddress("192.168.1.1", 0), SocketAddress("192.168.2.1", 0) };
69 // Private addresses inside the NAT private networks. 76 // Private addresses inside the NAT private networks.
70 static const SocketAddress kPrivateAddrs[2] = 77 static const SocketAddress kPrivateAddrs[2] =
71 { SocketAddress("192.168.1.11", 0), SocketAddress("192.168.2.22", 0) }; 78 { SocketAddress("192.168.1.11", 0), SocketAddress("192.168.2.22", 0) };
72 // For cascaded NATs, the internal addresses of the inner NAT boxes. 79 // For cascaded NATs, the internal addresses of the inner NAT boxes.
73 static const SocketAddress kCascadedNatAddrs[2] = 80 static const SocketAddress kCascadedNatAddrs[2] =
74 { SocketAddress("192.168.10.1", 0), SocketAddress("192.168.20.1", 0) }; 81 { SocketAddress("192.168.10.1", 0), SocketAddress("192.168.20.1", 0) };
75 // For cascaded NATs, private addresses inside the inner private networks. 82 // For cascaded NATs, private addresses inside the inner private networks.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 public: 182 public:
176 P2PTransportChannelTestBase() 183 P2PTransportChannelTestBase()
177 : main_(rtc::Thread::Current()), 184 : main_(rtc::Thread::Current()),
178 pss_(new rtc::PhysicalSocketServer), 185 pss_(new rtc::PhysicalSocketServer),
179 vss_(new rtc::VirtualSocketServer(pss_.get())), 186 vss_(new rtc::VirtualSocketServer(pss_.get())),
180 nss_(new rtc::NATSocketServer(vss_.get())), 187 nss_(new rtc::NATSocketServer(vss_.get())),
181 ss_(new rtc::FirewallSocketServer(nss_.get())), 188 ss_(new rtc::FirewallSocketServer(nss_.get())),
182 ss_scope_(ss_.get()), 189 ss_scope_(ss_.get()),
183 stun_server_(TestStunServer::Create(main_, kStunAddr)), 190 stun_server_(TestStunServer::Create(main_, kStunAddr)),
184 turn_server_(main_, kTurnUdpIntAddr, kTurnUdpExtAddr), 191 turn_server_(main_, kTurnUdpIntAddr, kTurnUdpExtAddr),
192 socks_server1_(ss_.get(),
193 kSocksProxyAddrs[0],
194 ss_.get(),
195 kSocksProxyAddrs[0]),
196 socks_server2_(ss_.get(),
197 kSocksProxyAddrs[1],
198 ss_.get(),
199 kSocksProxyAddrs[1]),
185 force_relay_(false) { 200 force_relay_(false) {
186 ep1_.role_ = ICEROLE_CONTROLLING; 201 ep1_.role_ = ICEROLE_CONTROLLING;
187 ep2_.role_ = ICEROLE_CONTROLLED; 202 ep2_.role_ = ICEROLE_CONTROLLED;
188 203
189 ServerAddresses stun_servers; 204 ServerAddresses stun_servers;
190 stun_servers.insert(kStunAddr); 205 stun_servers.insert(kStunAddr);
191 ep1_.allocator_.reset( 206 ep1_.allocator_.reset(
192 CreateBasicPortAllocator(&ep1_.network_manager_, stun_servers, 207 CreateBasicPortAllocator(&ep1_.network_manager_, stun_servers,
193 kTurnUdpIntAddr, rtc::SocketAddress())); 208 kTurnUdpIntAddr, rtc::SocketAddress()));
194 ep1_.metrics_observer_ = 209 ep1_.metrics_observer_ =
(...skipping 11 matching lines...) Expand all
206 enum Config { 221 enum Config {
207 OPEN, // Open to the Internet 222 OPEN, // Open to the Internet
208 NAT_FULL_CONE, // NAT, no filtering 223 NAT_FULL_CONE, // NAT, no filtering
209 NAT_ADDR_RESTRICTED, // NAT, must send to an addr to recv 224 NAT_ADDR_RESTRICTED, // NAT, must send to an addr to recv
210 NAT_PORT_RESTRICTED, // NAT, must send to an addr+port to recv 225 NAT_PORT_RESTRICTED, // NAT, must send to an addr+port to recv
211 NAT_SYMMETRIC, // NAT, endpoint-dependent bindings 226 NAT_SYMMETRIC, // NAT, endpoint-dependent bindings
212 NAT_DOUBLE_CONE, // Double NAT, both cone 227 NAT_DOUBLE_CONE, // Double NAT, both cone
213 NAT_SYMMETRIC_THEN_CONE, // Double NAT, symmetric outer, cone inner 228 NAT_SYMMETRIC_THEN_CONE, // Double NAT, symmetric outer, cone inner
214 BLOCK_UDP, // Firewall, UDP in/out blocked 229 BLOCK_UDP, // Firewall, UDP in/out blocked
215 BLOCK_UDP_AND_INCOMING_TCP, // Firewall, UDP in/out and TCP in blocked 230 BLOCK_UDP_AND_INCOMING_TCP, // Firewall, UDP in/out and TCP in blocked
231 BLOCK_ALL_BUT_OUTGOING_HTTP, // Firewall, only TCP out on 80/443
232 PROXY_HTTPS, // All traffic through HTTPS proxy
233 PROXY_SOCKS, // All traffic through SOCKS proxy
216 NUM_CONFIGS 234 NUM_CONFIGS
217 }; 235 };
218 236
219 struct Result { 237 struct Result {
220 Result(const std::string& controlling_type, 238 Result(const std::string& controlling_type,
221 const std::string& controlling_protocol, 239 const std::string& controlling_protocol,
222 const std::string& controlled_type, 240 const std::string& controlled_type,
223 const std::string& controlled_protocol, 241 const std::string& controlled_protocol,
224 int wait) 242 int wait)
225 : controlling_type(controlling_type), 243 : controlling_type(controlling_type),
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 const SocketAddress& addr, 446 const SocketAddress& addr,
429 const std::string& ifname, 447 const std::string& ifname,
430 rtc::AdapterType adapter_type) { 448 rtc::AdapterType adapter_type) {
431 GetEndpoint(endpoint)->network_manager_.AddInterface(addr, ifname, 449 GetEndpoint(endpoint)->network_manager_.AddInterface(addr, ifname,
432 adapter_type); 450 adapter_type);
433 } 451 }
434 void RemoveAddress(int endpoint, const SocketAddress& addr) { 452 void RemoveAddress(int endpoint, const SocketAddress& addr) {
435 GetEndpoint(endpoint)->network_manager_.RemoveInterface(addr); 453 GetEndpoint(endpoint)->network_manager_.RemoveInterface(addr);
436 fw()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, addr); 454 fw()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, addr);
437 } 455 }
456 void SetProxy(int endpoint, rtc::ProxyType type) {
457 rtc::ProxyInfo info;
458 info.type = type;
459 info.address = (type == rtc::PROXY_HTTPS) ?
460 kHttpsProxyAddrs[endpoint] : kSocksProxyAddrs[endpoint];
461 GetAllocator(endpoint)->set_proxy("unittest/1.0", info);
462 }
438 void SetAllocatorFlags(int endpoint, int flags) { 463 void SetAllocatorFlags(int endpoint, int flags) {
439 GetAllocator(endpoint)->set_flags(flags); 464 GetAllocator(endpoint)->set_flags(flags);
440 } 465 }
441 void SetIceRole(int endpoint, IceRole role) { 466 void SetIceRole(int endpoint, IceRole role) {
442 GetEndpoint(endpoint)->SetIceRole(role); 467 GetEndpoint(endpoint)->SetIceRole(role);
443 } 468 }
444 void SetIceTiebreaker(int endpoint, uint64_t tiebreaker) { 469 void SetIceTiebreaker(int endpoint, uint64_t tiebreaker) {
445 GetEndpoint(endpoint)->SetIceTiebreaker(tiebreaker); 470 GetEndpoint(endpoint)->SetIceTiebreaker(tiebreaker);
446 } 471 }
447 bool GetRoleConflict(int endpoint) { 472 bool GetRoleConflict(int endpoint) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 875
851 private: 876 private:
852 rtc::Thread* main_; 877 rtc::Thread* main_;
853 std::unique_ptr<rtc::PhysicalSocketServer> pss_; 878 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
854 std::unique_ptr<rtc::VirtualSocketServer> vss_; 879 std::unique_ptr<rtc::VirtualSocketServer> vss_;
855 std::unique_ptr<rtc::NATSocketServer> nss_; 880 std::unique_ptr<rtc::NATSocketServer> nss_;
856 std::unique_ptr<rtc::FirewallSocketServer> ss_; 881 std::unique_ptr<rtc::FirewallSocketServer> ss_;
857 rtc::SocketServerScope ss_scope_; 882 rtc::SocketServerScope ss_scope_;
858 std::unique_ptr<TestStunServer> stun_server_; 883 std::unique_ptr<TestStunServer> stun_server_;
859 TestTurnServer turn_server_; 884 TestTurnServer turn_server_;
885 rtc::SocksProxyServer socks_server1_;
886 rtc::SocksProxyServer socks_server2_;
860 Endpoint ep1_; 887 Endpoint ep1_;
861 Endpoint ep2_; 888 Endpoint ep2_;
862 RemoteIceParameterSource remote_ice_parameter_source_ = FROM_CANDIDATE; 889 RemoteIceParameterSource remote_ice_parameter_source_ = FROM_CANDIDATE;
863 bool force_relay_; 890 bool force_relay_;
864 int selected_candidate_pair_switches_ = 0; 891 int selected_candidate_pair_switches_ = 0;
865 892
866 bool nominated_ = false; 893 bool nominated_ = false;
867 }; 894 };
868 895
869 // The tests have only a few outcomes, which we predefine. 896 // The tests have only a few outcomes, which we predefine.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 // Add a two cascaded NATs of the desired types 1018 // Add a two cascaded NATs of the desired types
992 nat()->AddTranslator(kPublicAddrs[endpoint], kNatAddrs[endpoint], 1019 nat()->AddTranslator(kPublicAddrs[endpoint], kNatAddrs[endpoint],
993 (config == NAT_DOUBLE_CONE) ? 1020 (config == NAT_DOUBLE_CONE) ?
994 rtc::NAT_OPEN_CONE : rtc::NAT_SYMMETRIC)-> 1021 rtc::NAT_OPEN_CONE : rtc::NAT_SYMMETRIC)->
995 AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], 1022 AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint],
996 rtc::NAT_OPEN_CONE)-> 1023 rtc::NAT_OPEN_CONE)->
997 AddClient(kCascadedPrivateAddrs[endpoint]); 1024 AddClient(kCascadedPrivateAddrs[endpoint]);
998 break; 1025 break;
999 case BLOCK_UDP: 1026 case BLOCK_UDP:
1000 case BLOCK_UDP_AND_INCOMING_TCP: 1027 case BLOCK_UDP_AND_INCOMING_TCP:
1028 case BLOCK_ALL_BUT_OUTGOING_HTTP:
1029 case PROXY_HTTPS:
1030 case PROXY_SOCKS:
1001 AddAddress(endpoint, kPublicAddrs[endpoint]); 1031 AddAddress(endpoint, kPublicAddrs[endpoint]);
1002 // Block all UDP 1032 // Block all UDP
1003 fw()->AddRule(false, rtc::FP_UDP, rtc::FD_ANY, 1033 fw()->AddRule(false, rtc::FP_UDP, rtc::FD_ANY,
1004 kPublicAddrs[endpoint]); 1034 kPublicAddrs[endpoint]);
1005 if (config == BLOCK_UDP_AND_INCOMING_TCP) { 1035 if (config == BLOCK_UDP_AND_INCOMING_TCP) {
1006 // Block TCP inbound to the endpoint 1036 // Block TCP inbound to the endpoint
1007 fw()->AddRule(false, rtc::FP_TCP, SocketAddress(), 1037 fw()->AddRule(false, rtc::FP_TCP, SocketAddress(),
1008 kPublicAddrs[endpoint]); 1038 kPublicAddrs[endpoint]);
1039 } else if (config == BLOCK_ALL_BUT_OUTGOING_HTTP) {
1040 // Block all TCP to/from the endpoint except 80/443 out
1041 fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
1042 SocketAddress(rtc::IPAddress(INADDR_ANY), 80));
1043 fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
1044 SocketAddress(rtc::IPAddress(INADDR_ANY), 443));
1045 fw()->AddRule(false, rtc::FP_TCP, rtc::FD_ANY,
1046 kPublicAddrs[endpoint]);
1047 } else if (config == PROXY_HTTPS) {
1048 // Block all TCP to/from the endpoint except to the proxy server
1049 fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
1050 kHttpsProxyAddrs[endpoint]);
1051 fw()->AddRule(false, rtc::FP_TCP, rtc::FD_ANY,
1052 kPublicAddrs[endpoint]);
1053 SetProxy(endpoint, rtc::PROXY_HTTPS);
1054 } else if (config == PROXY_SOCKS) {
1055 // Block all TCP to/from the endpoint except to the proxy server
1056 fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
1057 kSocksProxyAddrs[endpoint]);
1058 fw()->AddRule(false, rtc::FP_TCP, rtc::FD_ANY,
1059 kPublicAddrs[endpoint]);
1060 SetProxy(endpoint, rtc::PROXY_SOCKS5);
1009 } 1061 }
1010 break; 1062 break;
1011 default: 1063 default:
1012 break; 1064 break;
1013 } 1065 }
1014 } 1066 }
1015 }; 1067 };
1016 1068
1017 // Shorthands for use in the test matrix. 1069 // Shorthands for use in the test matrix.
1018 #define LULU &kLocalUdpToLocalUdp 1070 #define LULU &kLocalUdpToLocalUdp
(...skipping 10 matching lines...) Expand all
1029 #define LTLT &kLocalTcpToLocalTcp 1081 #define LTLT &kLocalTcpToLocalTcp
1030 #define LTPT &kLocalTcpToPrflxTcp 1082 #define LTPT &kLocalTcpToPrflxTcp
1031 #define PTLT &kPrflxTcpToLocalTcp 1083 #define PTLT &kPrflxTcpToLocalTcp
1032 // TODO: Enable these once TestRelayServer can accept external TCP. 1084 // TODO: Enable these once TestRelayServer can accept external TCP.
1033 #define LTRT NULL 1085 #define LTRT NULL
1034 #define LSRS NULL 1086 #define LSRS NULL
1035 1087
1036 // Test matrix. Originator behavior defined by rows, receiever by columns. 1088 // Test matrix. Originator behavior defined by rows, receiever by columns.
1037 1089
1038 // TODO: Fix NULLs caused by lack of TCP support in NATSocket. 1090 // TODO: Fix NULLs caused by lack of TCP support in NATSocket.
1091 // TODO: Fix NULLs caused by no HTTP proxy support.
1039 // TODO: Rearrange rows/columns from best to worst. 1092 // TODO: Rearrange rows/columns from best to worst.
1040 const P2PTransportChannelTest::Result* 1093 const P2PTransportChannelTest::Result*
1041 P2PTransportChannelTest::kMatrix[NUM_CONFIGS][NUM_CONFIGS] = { 1094 P2PTransportChannelTest::kMatrix[NUM_CONFIGS][NUM_CONFIGS] = {
1042 // OPEN CONE ADDR PORT SYMM 2CON SCON !UDP !TCP 1095 // OPEN CONE ADDR PORT SYMM 2CON SCON !UDP !TCP HTTP PRXH PRXS
1043 /*OP*/ {LULU, LUSU, LUSU, LUSU, LUPU, LUSU, LUPU, LTPT, LTPT}, 1096 /*OP*/ {LULU, LUSU, LUSU, LUSU, LUPU, LUSU, LUPU, LTPT, LTPT, LSRS, NULL, LTPT},
1044 /*CO*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL}, 1097 /*CO*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT},
1045 /*AD*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL}, 1098 /*AD*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT},
1046 /*PO*/ {SULU, SUSU, SUSU, SUSU, RUPU, SUSU, RUPU, NULL, NULL}, 1099 /*PO*/ {SULU, SUSU, SUSU, SUSU, RUPU, SUSU, RUPU, NULL, NULL, LSRS, NULL, LTRT},
1047 /*SY*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL}, 1100 /*SY*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT},
1048 /*2C*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL}, 1101 /*2C*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT},
1049 /*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL}, 1102 /*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT},
1050 /*!U*/ {LTPT, NULL, NULL, NULL, NULL, NULL, NULL, LTPT, LTPT}, 1103 /*!U*/ {LTPT, NULL, NULL, NULL, NULL, NULL, NULL, LTPT, LTPT, LSRS, NULL, LTRT},
1051 /*!T*/ {PTLT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTRT}, 1104 /*!T*/ {PTLT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTRT, LSRS, NULL, LTRT},
1105 /*HT*/ {LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, NULL, LSRS},
1106 /*PR*/ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
1107 /*PR*/ {LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LSRS, NULL, LTRT},
1052 }; 1108 };
1053 1109
1054 // The actual tests that exercise all the various configurations. 1110 // The actual tests that exercise all the various configurations.
1055 // Test names are of the form P2PTransportChannelTest_TestOPENToNAT_FULL_CONE 1111 // Test names are of the form P2PTransportChannelTest_TestOPENToNAT_FULL_CONE
1056 #define P2P_TEST_DECLARATION(x, y, z) \ 1112 #define P2P_TEST_DECLARATION(x, y, z) \
1057 TEST_F(P2PTransportChannelTest, z##Test##x##To##y) { \ 1113 TEST_F(P2PTransportChannelTest, z##Test##x##To##y) { \
1058 ConfigureEndpoints(x, y, PORTALLOCATOR_ENABLE_SHARED_SOCKET, \ 1114 ConfigureEndpoints(x, y, PORTALLOCATOR_ENABLE_SHARED_SOCKET, \
1059 PORTALLOCATOR_ENABLE_SHARED_SOCKET); \ 1115 PORTALLOCATOR_ENABLE_SHARED_SOCKET); \
1060 if (kMatrix[x][y] != NULL) \ 1116 if (kMatrix[x][y] != NULL) \
1061 Test(*kMatrix[x][y]); \ 1117 Test(*kMatrix[x][y]); \
1062 else \ 1118 else \
1063 LOG(LS_WARNING) << "Not yet implemented"; \ 1119 LOG(LS_WARNING) << "Not yet implemented"; \
1064 } 1120 }
1065 1121
1066 #define P2P_TEST(x, y) \ 1122 #define P2P_TEST(x, y) \
1067 P2P_TEST_DECLARATION(x, y,) 1123 P2P_TEST_DECLARATION(x, y,)
1068 1124
1069 #define P2P_TEST_SET(x) \ 1125 #define P2P_TEST_SET(x) \
1070 P2P_TEST(x, OPEN) \ 1126 P2P_TEST(x, OPEN) \
1071 P2P_TEST(x, NAT_FULL_CONE) \ 1127 P2P_TEST(x, NAT_FULL_CONE) \
1072 P2P_TEST(x, NAT_ADDR_RESTRICTED) \ 1128 P2P_TEST(x, NAT_ADDR_RESTRICTED) \
1073 P2P_TEST(x, NAT_PORT_RESTRICTED) \ 1129 P2P_TEST(x, NAT_PORT_RESTRICTED) \
1074 P2P_TEST(x, NAT_SYMMETRIC) \ 1130 P2P_TEST(x, NAT_SYMMETRIC) \
1075 P2P_TEST(x, NAT_DOUBLE_CONE) \ 1131 P2P_TEST(x, NAT_DOUBLE_CONE) \
1076 P2P_TEST(x, NAT_SYMMETRIC_THEN_CONE) \ 1132 P2P_TEST(x, NAT_SYMMETRIC_THEN_CONE) \
1077 P2P_TEST(x, BLOCK_UDP) \ 1133 P2P_TEST(x, BLOCK_UDP) \
1078 P2P_TEST(x, BLOCK_UDP_AND_INCOMING_TCP) 1134 P2P_TEST(x, BLOCK_UDP_AND_INCOMING_TCP) \
1135 P2P_TEST(x, BLOCK_ALL_BUT_OUTGOING_HTTP) \
1136 P2P_TEST(x, PROXY_HTTPS) \
1137 P2P_TEST(x, PROXY_SOCKS)
1079 1138
1080 P2P_TEST_SET(OPEN) 1139 P2P_TEST_SET(OPEN)
1081 P2P_TEST_SET(NAT_FULL_CONE) 1140 P2P_TEST_SET(NAT_FULL_CONE)
1082 P2P_TEST_SET(NAT_ADDR_RESTRICTED) 1141 P2P_TEST_SET(NAT_ADDR_RESTRICTED)
1083 P2P_TEST_SET(NAT_PORT_RESTRICTED) 1142 P2P_TEST_SET(NAT_PORT_RESTRICTED)
1084 P2P_TEST_SET(NAT_SYMMETRIC) 1143 P2P_TEST_SET(NAT_SYMMETRIC)
1085 P2P_TEST_SET(NAT_DOUBLE_CONE) 1144 P2P_TEST_SET(NAT_DOUBLE_CONE)
1086 P2P_TEST_SET(NAT_SYMMETRIC_THEN_CONE) 1145 P2P_TEST_SET(NAT_SYMMETRIC_THEN_CONE)
1087 P2P_TEST_SET(BLOCK_UDP) 1146 P2P_TEST_SET(BLOCK_UDP)
1088 P2P_TEST_SET(BLOCK_UDP_AND_INCOMING_TCP) 1147 P2P_TEST_SET(BLOCK_UDP_AND_INCOMING_TCP)
1148 P2P_TEST_SET(BLOCK_ALL_BUT_OUTGOING_HTTP)
1149 P2P_TEST_SET(PROXY_HTTPS)
1150 P2P_TEST_SET(PROXY_SOCKS)
1089 1151
1090 // Test that we restart candidate allocation when local ufrag&pwd changed. 1152 // Test that we restart candidate allocation when local ufrag&pwd changed.
1091 // Standard Ice protocol is used. 1153 // Standard Ice protocol is used.
1092 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) { 1154 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) {
1093 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, 1155 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags,
1094 kDefaultPortAllocatorFlags); 1156 kDefaultPortAllocatorFlags);
1095 CreateChannels(); 1157 CreateChannels();
1096 TestHandleIceUfragPasswordChanged(); 1158 TestHandleIceUfragPasswordChanged();
1097 DestroyChannels(); 1159 DestroyChannels();
1098 } 1160 }
(...skipping 3230 matching lines...) Expand 10 before | Expand all | Expand 10 after
4329 4391
4330 // TCP Relay/Relay is the next. 4392 // TCP Relay/Relay is the next.
4331 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, 4393 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE,
4332 TCP_PROTOCOL_NAME); 4394 TCP_PROTOCOL_NAME);
4333 4395
4334 // Finally, Local/Relay will be pinged. 4396 // Finally, Local/Relay will be pinged.
4335 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); 4397 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE);
4336 } 4398 }
4337 4399
4338 } // namespace cricket { 4400 } // namespace cricket {
OLDNEW
« no previous file with comments | « webrtc/p2p/base/basicpacketsocketfactory.cc ('k') | webrtc/p2p/base/packetsocketfactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698