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/p2p/base/fakeportallocator.h" | 15 #include "webrtc/p2p/base/fakeportallocator.h" |
15 #include "webrtc/p2p/base/p2ptransportchannel.h" | 16 #include "webrtc/p2p/base/p2ptransportchannel.h" |
16 #include "webrtc/p2p/base/testrelayserver.h" | 17 #include "webrtc/p2p/base/testrelayserver.h" |
17 #include "webrtc/p2p/base/teststunserver.h" | 18 #include "webrtc/p2p/base/teststunserver.h" |
18 #include "webrtc/p2p/base/testturnserver.h" | 19 #include "webrtc/p2p/base/testturnserver.h" |
19 #include "webrtc/p2p/client/basicportallocator.h" | 20 #include "webrtc/p2p/client/basicportallocator.h" |
20 #include "webrtc/base/dscp.h" | 21 #include "webrtc/base/dscp.h" |
21 #include "webrtc/base/fakeclock.h" | 22 #include "webrtc/base/fakeclock.h" |
22 #include "webrtc/base/fakenetwork.h" | 23 #include "webrtc/base/fakenetwork.h" |
23 #include "webrtc/base/firewallsocketserver.h" | 24 #include "webrtc/base/firewallsocketserver.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 kSocksProxyAddrs[1]), | 192 kSocksProxyAddrs[1]), |
192 force_relay_(false) { | 193 force_relay_(false) { |
193 ep1_.role_ = ICEROLE_CONTROLLING; | 194 ep1_.role_ = ICEROLE_CONTROLLING; |
194 ep2_.role_ = ICEROLE_CONTROLLED; | 195 ep2_.role_ = ICEROLE_CONTROLLED; |
195 | 196 |
196 ServerAddresses stun_servers; | 197 ServerAddresses stun_servers; |
197 stun_servers.insert(kStunAddr); | 198 stun_servers.insert(kStunAddr); |
198 ep1_.allocator_.reset( | 199 ep1_.allocator_.reset( |
199 CreateBasicPortAllocator(&ep1_.network_manager_, stun_servers, | 200 CreateBasicPortAllocator(&ep1_.network_manager_, stun_servers, |
200 kTurnUdpIntAddr, rtc::SocketAddress())); | 201 kTurnUdpIntAddr, rtc::SocketAddress())); |
| 202 ep1_.metrics_observer_ = |
| 203 new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 204 ep1_.allocator_->SetMetricsObserver(ep1_.metrics_observer_); |
201 ep2_.allocator_.reset( | 205 ep2_.allocator_.reset( |
202 CreateBasicPortAllocator(&ep2_.network_manager_, stun_servers, | 206 CreateBasicPortAllocator(&ep2_.network_manager_, stun_servers, |
203 kTurnUdpIntAddr, rtc::SocketAddress())); | 207 kTurnUdpIntAddr, rtc::SocketAddress())); |
| 208 ep2_.metrics_observer_ = |
| 209 new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 210 ep2_.allocator_->SetMetricsObserver(ep2_.metrics_observer_); |
204 } | 211 } |
205 | 212 |
206 protected: | 213 protected: |
207 enum Config { | 214 enum Config { |
208 OPEN, // Open to the Internet | 215 OPEN, // Open to the Internet |
209 NAT_FULL_CONE, // NAT, no filtering | 216 NAT_FULL_CONE, // NAT, no filtering |
210 NAT_ADDR_RESTRICTED, // NAT, must send to an addr to recv | 217 NAT_ADDR_RESTRICTED, // NAT, must send to an addr to recv |
211 NAT_PORT_RESTRICTED, // NAT, must send to an addr+port to recv | 218 NAT_PORT_RESTRICTED, // NAT, must send to an addr+port to recv |
212 NAT_SYMMETRIC, // NAT, endpoint-dependent bindings | 219 NAT_SYMMETRIC, // NAT, endpoint-dependent bindings |
213 NAT_DOUBLE_CONE, // Double NAT, both cone | 220 NAT_DOUBLE_CONE, // Double NAT, both cone |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 void OnRoleConflict(bool role_conflict) { role_conflict_ = role_conflict; } | 298 void OnRoleConflict(bool role_conflict) { role_conflict_ = role_conflict; } |
292 bool role_conflict() { return role_conflict_; } | 299 bool role_conflict() { return role_conflict_; } |
293 void SetAllocationStepDelay(uint32_t delay) { | 300 void SetAllocationStepDelay(uint32_t delay) { |
294 allocator_->set_step_delay(delay); | 301 allocator_->set_step_delay(delay); |
295 } | 302 } |
296 void SetAllowTcpListen(bool allow_tcp_listen) { | 303 void SetAllowTcpListen(bool allow_tcp_listen) { |
297 allocator_->set_allow_tcp_listen(allow_tcp_listen); | 304 allocator_->set_allow_tcp_listen(allow_tcp_listen); |
298 } | 305 } |
299 | 306 |
300 rtc::FakeNetworkManager network_manager_; | 307 rtc::FakeNetworkManager network_manager_; |
| 308 // |metrics_observer_| should outlive |allocator_| as the former may be |
| 309 // used by the latter. |
| 310 rtc::scoped_refptr<webrtc::FakeMetricsObserver> metrics_observer_; |
301 std::unique_ptr<BasicPortAllocator> allocator_; | 311 std::unique_ptr<BasicPortAllocator> allocator_; |
302 ChannelData cd1_; | 312 ChannelData cd1_; |
303 ChannelData cd2_; | 313 ChannelData cd2_; |
304 IceRole role_; | 314 IceRole role_; |
305 uint64_t tiebreaker_; | 315 uint64_t tiebreaker_; |
306 bool role_conflict_; | 316 bool role_conflict_; |
307 bool save_candidates_; | 317 bool save_candidates_; |
308 std::vector<std::unique_ptr<CandidatesData>> saved_candidates_; | 318 std::vector<std::unique_ptr<CandidatesData>> saved_candidates_; |
309 bool ready_to_send_ = false; | 319 bool ready_to_send_ = false; |
310 }; | 320 }; |
(...skipping 16 matching lines...) Expand all Loading... |
327 const IceConfig& ep2_config, | 337 const IceConfig& ep2_config, |
328 bool renomination = false) { | 338 bool renomination = false) { |
329 IceParameters ice_ep1_cd1_ch = | 339 IceParameters ice_ep1_cd1_ch = |
330 IceParamsWithRenomination(kIceParams[0], renomination); | 340 IceParamsWithRenomination(kIceParams[0], renomination); |
331 IceParameters ice_ep2_cd1_ch = | 341 IceParameters ice_ep2_cd1_ch = |
332 IceParamsWithRenomination(kIceParams[1], renomination); | 342 IceParamsWithRenomination(kIceParams[1], renomination); |
333 ep1_.cd1_.ch_.reset(CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, | 343 ep1_.cd1_.ch_.reset(CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, |
334 ice_ep1_cd1_ch, ice_ep2_cd1_ch)); | 344 ice_ep1_cd1_ch, ice_ep2_cd1_ch)); |
335 ep2_.cd1_.ch_.reset(CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, | 345 ep2_.cd1_.ch_.reset(CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, |
336 ice_ep2_cd1_ch, ice_ep1_cd1_ch)); | 346 ice_ep2_cd1_ch, ice_ep1_cd1_ch)); |
| 347 ep1_.cd1_.ch_->SetMetricsObserver(ep1_.metrics_observer_); |
| 348 ep2_.cd1_.ch_->SetMetricsObserver(ep2_.metrics_observer_); |
337 ep1_.cd1_.ch_->SetIceConfig(ep1_config); | 349 ep1_.cd1_.ch_->SetIceConfig(ep1_config); |
338 ep2_.cd1_.ch_->SetIceConfig(ep2_config); | 350 ep2_.cd1_.ch_->SetIceConfig(ep2_config); |
339 ep1_.cd1_.ch_->MaybeStartGathering(); | 351 ep1_.cd1_.ch_->MaybeStartGathering(); |
340 ep2_.cd1_.ch_->MaybeStartGathering(); | 352 ep2_.cd1_.ch_->MaybeStartGathering(); |
341 } | 353 } |
342 | 354 |
343 void CreateChannels() { | 355 void CreateChannels() { |
344 IceConfig default_config; | 356 IceConfig default_config; |
345 CreateChannels(default_config, default_config, false); | 357 CreateChannels(default_config, default_config, false); |
346 } | 358 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 return &ep1_; | 421 return &ep1_; |
410 } else if (endpoint == 1) { | 422 } else if (endpoint == 1) { |
411 return &ep2_; | 423 return &ep2_; |
412 } else { | 424 } else { |
413 return NULL; | 425 return NULL; |
414 } | 426 } |
415 } | 427 } |
416 PortAllocator* GetAllocator(int endpoint) { | 428 PortAllocator* GetAllocator(int endpoint) { |
417 return GetEndpoint(endpoint)->allocator_.get(); | 429 return GetEndpoint(endpoint)->allocator_.get(); |
418 } | 430 } |
| 431 webrtc::FakeMetricsObserver* GetMetricsObserver(int endpoint) { |
| 432 return GetEndpoint(endpoint)->metrics_observer_; |
| 433 } |
419 void AddAddress(int endpoint, const SocketAddress& addr) { | 434 void AddAddress(int endpoint, const SocketAddress& addr) { |
420 GetEndpoint(endpoint)->network_manager_.AddInterface(addr); | 435 GetEndpoint(endpoint)->network_manager_.AddInterface(addr); |
421 } | 436 } |
422 void AddAddress(int endpoint, | 437 void AddAddress(int endpoint, |
423 const SocketAddress& addr, | 438 const SocketAddress& addr, |
424 const std::string& ifname, | 439 const std::string& ifname, |
425 rtc::AdapterType adapter_type) { | 440 rtc::AdapterType adapter_type) { |
426 GetEndpoint(endpoint)->network_manager_.AddInterface(addr, ifname, | 441 GetEndpoint(endpoint)->network_manager_.AddInterface(addr, ifname, |
427 adapter_type); | 442 adapter_type); |
428 } | 443 } |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 | 966 |
952 // Test the matrix of all the connectivity types we expect to see in the wild. | 967 // Test the matrix of all the connectivity types we expect to see in the wild. |
953 // Just test every combination of the configs in the Config enum. | 968 // Just test every combination of the configs in the Config enum. |
954 class P2PTransportChannelTest : public P2PTransportChannelTestBase { | 969 class P2PTransportChannelTest : public P2PTransportChannelTestBase { |
955 protected: | 970 protected: |
956 static const Result* kMatrix[NUM_CONFIGS][NUM_CONFIGS]; | 971 static const Result* kMatrix[NUM_CONFIGS][NUM_CONFIGS]; |
957 void ConfigureEndpoints(Config config1, | 972 void ConfigureEndpoints(Config config1, |
958 Config config2, | 973 Config config2, |
959 int allocator_flags1, | 974 int allocator_flags1, |
960 int allocator_flags2) { | 975 int allocator_flags2) { |
961 int delay = kMinimumStepDelay; | |
962 ConfigureEndpoint(0, config1); | 976 ConfigureEndpoint(0, config1); |
963 SetAllocatorFlags(0, allocator_flags1); | 977 SetAllocatorFlags(0, allocator_flags1); |
964 SetAllocationStepDelay(0, delay); | 978 SetAllocationStepDelay(0, kMinimumStepDelay); |
965 ConfigureEndpoint(1, config2); | 979 ConfigureEndpoint(1, config2); |
966 SetAllocatorFlags(1, allocator_flags2); | 980 SetAllocatorFlags(1, allocator_flags2); |
967 SetAllocationStepDelay(1, delay); | 981 SetAllocationStepDelay(1, kMinimumStepDelay); |
968 | 982 |
969 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 983 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); |
970 } | 984 } |
971 void ConfigureEndpoint(int endpoint, Config config) { | 985 void ConfigureEndpoint(int endpoint, Config config) { |
972 switch (config) { | 986 switch (config) { |
973 case OPEN: | 987 case OPEN: |
974 AddAddress(endpoint, kPublicAddrs[endpoint]); | 988 AddAddress(endpoint, kPublicAddrs[endpoint]); |
975 break; | 989 break; |
976 case NAT_FULL_CONE: | 990 case NAT_FULL_CONE: |
977 case NAT_ADDR_RESTRICTED: | 991 case NAT_ADDR_RESTRICTED: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 EXPECT_TRUE(best_conn_info->writable); | 1179 EXPECT_TRUE(best_conn_info->writable); |
1166 EXPECT_FALSE(best_conn_info->timeout); | 1180 EXPECT_FALSE(best_conn_info->timeout); |
1167 EXPECT_EQ(10U, best_conn_info->sent_total_packets); | 1181 EXPECT_EQ(10U, best_conn_info->sent_total_packets); |
1168 EXPECT_EQ(0U, best_conn_info->sent_discarded_packets); | 1182 EXPECT_EQ(0U, best_conn_info->sent_discarded_packets); |
1169 EXPECT_EQ(10 * 36U, best_conn_info->sent_total_bytes); | 1183 EXPECT_EQ(10 * 36U, best_conn_info->sent_total_bytes); |
1170 EXPECT_EQ(10 * 36U, best_conn_info->recv_total_bytes); | 1184 EXPECT_EQ(10 * 36U, best_conn_info->recv_total_bytes); |
1171 EXPECT_GT(best_conn_info->rtt, 0U); | 1185 EXPECT_GT(best_conn_info->rtt, 0U); |
1172 DestroyChannels(); | 1186 DestroyChannels(); |
1173 } | 1187 } |
1174 | 1188 |
| 1189 // Tests that UMAs are recorded when ICE restarts while the channel |
| 1190 // is disconnected. |
| 1191 TEST_F(P2PTransportChannelTest, TestUMAIceRestartWhileDisconnected) { |
| 1192 rtc::ScopedFakeClock clock; |
| 1193 ConfigureEndpoints(OPEN, OPEN, kOnlyLocalPorts, kOnlyLocalPorts); |
| 1194 |
| 1195 CreateChannels(); |
| 1196 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
| 1197 ep2_ch1()->receiving() && |
| 1198 ep2_ch1()->writable(), |
| 1199 kDefaultTimeout, clock); |
| 1200 |
| 1201 // Drop all packets so that both channels become not writable. |
| 1202 fw()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, kPublicAddrs[0]); |
| 1203 const int kWriteTimeoutDelay = 6000; |
| 1204 EXPECT_TRUE_SIMULATED_WAIT(!ep1_ch1()->writable() && !ep2_ch1()->writable(), |
| 1205 kWriteTimeoutDelay, clock); |
| 1206 |
| 1207 ep1_ch1()->SetIceParameters(kIceParams[2]); |
| 1208 ep1_ch1()->SetRemoteIceParameters(kIceParams[3]); |
| 1209 ep1_ch1()->MaybeStartGathering(); |
| 1210 EXPECT_EQ(1, GetMetricsObserver(0)->GetEnumCounter( |
| 1211 webrtc::kEnumCounterIceRestart, |
| 1212 static_cast<int>(IceRestartState::DISCONNECTED))); |
| 1213 |
| 1214 ep2_ch1()->SetIceParameters(kIceParams[3]); |
| 1215 ep2_ch1()->SetRemoteIceParameters(kIceParams[2]); |
| 1216 ep2_ch1()->MaybeStartGathering(); |
| 1217 EXPECT_EQ(1, GetMetricsObserver(1)->GetEnumCounter( |
| 1218 webrtc::kEnumCounterIceRestart, |
| 1219 static_cast<int>(IceRestartState::DISCONNECTED))); |
| 1220 |
| 1221 DestroyChannels(); |
| 1222 } |
| 1223 |
| 1224 // Tests that UMAs are recorded when ICE restarts while the channel |
| 1225 // is connected. |
| 1226 TEST_F(P2PTransportChannelTest, TestUMAIceRestartWhileConnected) { |
| 1227 rtc::ScopedFakeClock clock; |
| 1228 ConfigureEndpoints(OPEN, OPEN, kOnlyLocalPorts, kOnlyLocalPorts); |
| 1229 |
| 1230 CreateChannels(); |
| 1231 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
| 1232 ep2_ch1()->receiving() && |
| 1233 ep2_ch1()->writable(), |
| 1234 kDefaultTimeout, clock); |
| 1235 |
| 1236 ep1_ch1()->SetIceParameters(kIceParams[2]); |
| 1237 ep1_ch1()->SetRemoteIceParameters(kIceParams[3]); |
| 1238 ep1_ch1()->MaybeStartGathering(); |
| 1239 EXPECT_EQ(1, GetMetricsObserver(0)->GetEnumCounter( |
| 1240 webrtc::kEnumCounterIceRestart, |
| 1241 static_cast<int>(IceRestartState::CONNECTED))); |
| 1242 |
| 1243 ep2_ch1()->SetIceParameters(kIceParams[3]); |
| 1244 ep2_ch1()->SetRemoteIceParameters(kIceParams[2]); |
| 1245 ep2_ch1()->MaybeStartGathering(); |
| 1246 EXPECT_EQ(1, GetMetricsObserver(1)->GetEnumCounter( |
| 1247 webrtc::kEnumCounterIceRestart, |
| 1248 static_cast<int>(IceRestartState::CONNECTED))); |
| 1249 |
| 1250 DestroyChannels(); |
| 1251 } |
| 1252 |
| 1253 // Tests that UMAs are recorded when ICE restarts while the channel |
| 1254 // is connecting. |
| 1255 TEST_F(P2PTransportChannelTest, TestUMAIceRestartWhileConnecting) { |
| 1256 rtc::ScopedFakeClock clock; |
| 1257 ConfigureEndpoints(OPEN, OPEN, kOnlyLocalPorts, kOnlyLocalPorts); |
| 1258 |
| 1259 // Create the channels without waiting for them to become connected. |
| 1260 CreateChannels(); |
| 1261 |
| 1262 ep1_ch1()->SetIceParameters(kIceParams[2]); |
| 1263 ep1_ch1()->SetRemoteIceParameters(kIceParams[3]); |
| 1264 ep1_ch1()->MaybeStartGathering(); |
| 1265 EXPECT_EQ(1, GetMetricsObserver(0)->GetEnumCounter( |
| 1266 webrtc::kEnumCounterIceRestart, |
| 1267 static_cast<int>(IceRestartState::CONNECTING))); |
| 1268 |
| 1269 ep2_ch1()->SetIceParameters(kIceParams[3]); |
| 1270 ep2_ch1()->SetRemoteIceParameters(kIceParams[2]); |
| 1271 ep2_ch1()->MaybeStartGathering(); |
| 1272 EXPECT_EQ(1, GetMetricsObserver(1)->GetEnumCounter( |
| 1273 webrtc::kEnumCounterIceRestart, |
| 1274 static_cast<int>(IceRestartState::CONNECTING))); |
| 1275 |
| 1276 DestroyChannels(); |
| 1277 } |
| 1278 |
| 1279 // Tests that a UMA on ICE regathering is recorded when there is a network |
| 1280 // change if and only if continual gathering is enabled. |
| 1281 TEST_F(P2PTransportChannelTest, |
| 1282 TestIceRegatheringReasonContinualGatheringByNetworkChange) { |
| 1283 rtc::ScopedFakeClock clock; |
| 1284 ConfigureEndpoints(OPEN, OPEN, kOnlyLocalPorts, kOnlyLocalPorts); |
| 1285 |
| 1286 // ep1 gathers continually but ep2 does not. |
| 1287 IceConfig continual_gathering_config = |
| 1288 CreateIceConfig(1000, GATHER_CONTINUALLY); |
| 1289 IceConfig default_config; |
| 1290 CreateChannels(continual_gathering_config, default_config); |
| 1291 |
| 1292 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
| 1293 ep2_ch1()->receiving() && |
| 1294 ep2_ch1()->writable(), |
| 1295 kDefaultTimeout, clock); |
| 1296 |
| 1297 // Adding address in ep1 will trigger continual gathering. |
| 1298 AddAddress(0, kAlternateAddrs[0]); |
| 1299 EXPECT_EQ_SIMULATED_WAIT( |
| 1300 1, GetMetricsObserver(0)->GetEnumCounter( |
| 1301 webrtc::kEnumCounterIceRegathering, |
| 1302 static_cast<int>(IceRegatheringReason::NETWORK_CHANGE)), |
| 1303 kDefaultTimeout, clock); |
| 1304 |
| 1305 ep2_ch1()->SetIceParameters(kIceParams[3]); |
| 1306 ep2_ch1()->SetRemoteIceParameters(kIceParams[2]); |
| 1307 ep2_ch1()->MaybeStartGathering(); |
| 1308 |
| 1309 AddAddress(1, kAlternateAddrs[1]); |
| 1310 SIMULATED_WAIT(false, kDefaultTimeout, clock); |
| 1311 // ep2 has not enabled continual gathering. |
| 1312 EXPECT_EQ(0, GetMetricsObserver(1)->GetEnumCounter( |
| 1313 webrtc::kEnumCounterIceRegathering, |
| 1314 static_cast<int>(IceRegatheringReason::NETWORK_CHANGE))); |
| 1315 |
| 1316 DestroyChannels(); |
| 1317 } |
| 1318 |
| 1319 // Tests that a UMA on ICE regathering is recorded when there is a network |
| 1320 // failure if and only if continual gathering is enabled. |
| 1321 TEST_F(P2PTransportChannelTest, |
| 1322 TestIceRegatheringReasonContinualGatheringByNetworkFailure) { |
| 1323 rtc::ScopedFakeClock clock; |
| 1324 ConfigureEndpoints(OPEN, OPEN, kOnlyLocalPorts, kOnlyLocalPorts); |
| 1325 |
| 1326 // ep1 gathers continually but ep2 does not. |
| 1327 IceConfig config1 = CreateIceConfig(1000, GATHER_CONTINUALLY); |
| 1328 config1.regather_on_failed_networks_interval = rtc::Optional<int>(2000); |
| 1329 IceConfig config2; |
| 1330 config2.regather_on_failed_networks_interval = rtc::Optional<int>(2000); |
| 1331 CreateChannels(config1, config2); |
| 1332 |
| 1333 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
| 1334 ep2_ch1()->receiving() && |
| 1335 ep2_ch1()->writable(), |
| 1336 kDefaultTimeout, clock); |
| 1337 |
| 1338 fw()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, kPublicAddrs[0]); |
| 1339 // Timeout value such that all connections are deleted. |
| 1340 const int kNetworkFailureTimeout = 35000; |
| 1341 SIMULATED_WAIT(false, kNetworkFailureTimeout, clock); |
| 1342 EXPECT_LE(1, GetMetricsObserver(0)->GetEnumCounter( |
| 1343 webrtc::kEnumCounterIceRegathering, |
| 1344 static_cast<int>(IceRegatheringReason::NETWORK_FAILURE))); |
| 1345 EXPECT_EQ(0, GetMetricsObserver(1)->GetEnumCounter( |
| 1346 webrtc::kEnumCounterIceRegathering, |
| 1347 static_cast<int>(IceRegatheringReason::NETWORK_FAILURE))); |
| 1348 |
| 1349 DestroyChannels(); |
| 1350 } |
| 1351 |
1175 // Test that we properly create a connection on a STUN ping from unknown address | 1352 // Test that we properly create a connection on a STUN ping from unknown address |
1176 // when the signaling is slow. | 1353 // when the signaling is slow. |
1177 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { | 1354 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { |
1178 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1355 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
1179 kDefaultPortAllocatorFlags); | 1356 kDefaultPortAllocatorFlags); |
1180 // Emulate no remote parameters coming in. | 1357 // Emulate no remote parameters coming in. |
1181 set_remote_ice_parameter_source(FROM_CANDIDATE); | 1358 set_remote_ice_parameter_source(FROM_CANDIDATE); |
1182 CreateChannels(); | 1359 CreateChannels(); |
1183 // Only have remote parameters come in for ep2, not ep1. | 1360 // Only have remote parameters come in for ep2, not ep1. |
1184 ep2_ch1()->SetRemoteIceParameters(kIceParams[0]); | 1361 ep2_ch1()->SetRemoteIceParameters(kIceParams[0]); |
(...skipping 2815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4000 | 4177 |
4001 // TCP Relay/Relay is the next. | 4178 // TCP Relay/Relay is the next. |
4002 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, | 4179 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, |
4003 TCP_PROTOCOL_NAME); | 4180 TCP_PROTOCOL_NAME); |
4004 | 4181 |
4005 // Finally, Local/Relay will be pinged. | 4182 // Finally, Local/Relay will be pinged. |
4006 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); | 4183 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); |
4007 } | 4184 } |
4008 | 4185 |
4009 } // namespace cricket { | 4186 } // namespace cricket { |
OLD | NEW |