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