Chromium Code Reviews| 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 | 
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1060 // Test that we restart candidate allocation when local ufrag&pwd changed. | 1060 // Test that we restart candidate allocation when local ufrag&pwd changed. | 
| 1061 // Standard Ice protocol is used. | 1061 // Standard Ice protocol is used. | 
| 1062 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) { | 1062 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) { | 
| 1063 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1063 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 
| 1064 kDefaultPortAllocatorFlags); | 1064 kDefaultPortAllocatorFlags); | 
| 1065 CreateChannels(1); | 1065 CreateChannels(1); | 
| 1066 TestHandleIceUfragPasswordChanged(); | 1066 TestHandleIceUfragPasswordChanged(); | 
| 1067 DestroyChannels(); | 1067 DestroyChannels(); | 
| 1068 } | 1068 } | 
| 1069 | 1069 | 
| 1070 // Same as above test, but with a symmetric NAT. | |
| 1071 // We should end up with relay<->prflx candidate pairs, with generation "1". | |
| 1072 TEST_F(P2PTransportChannelTest, HandleUfragPwdChangeSymmetricNat) { | |
| 1073 ConfigureEndpoints(NAT_SYMMETRIC, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, | |
| 1074 kDefaultPortAllocatorFlags); | |
| 1075 CreateChannels(1); | |
| 1076 TestHandleIceUfragPasswordChanged(); | |
| 1077 DestroyChannels(); | |
| 1078 } | |
| 1079 | |
| 1070 // Test the operation of GetStats. | 1080 // Test the operation of GetStats. | 
| 1071 TEST_F(P2PTransportChannelTest, GetStats) { | 1081 TEST_F(P2PTransportChannelTest, GetStats) { | 
| 1072 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1082 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 
| 1073 kDefaultPortAllocatorFlags); | 1083 kDefaultPortAllocatorFlags); | 
| 1074 CreateChannels(1); | 1084 CreateChannels(1); | 
| 1075 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 1085 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 
| 1076 ep2_ch1()->receiving() && ep2_ch1()->writable(), | 1086 ep2_ch1()->receiving() && ep2_ch1()->writable(), | 
| 1077 1000, 1000); | 1087 1000, 1000); | 
| 1078 TestSendRecv(1); | 1088 TestSendRecv(1); | 
| 1079 cricket::ConnectionInfos infos; | 1089 cricket::ConnectionInfos infos; | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1264 int kOnlyLocalTcpPorts = cricket::PORTALLOCATOR_DISABLE_UDP | | 1274 int kOnlyLocalTcpPorts = cricket::PORTALLOCATOR_DISABLE_UDP | | 
| 1265 cricket::PORTALLOCATOR_DISABLE_STUN | | 1275 cricket::PORTALLOCATOR_DISABLE_STUN | | 
| 1266 cricket::PORTALLOCATOR_DISABLE_RELAY; | 1276 cricket::PORTALLOCATOR_DISABLE_RELAY; | 
| 1267 // Disable all protocols except TCP. | 1277 // Disable all protocols except TCP. | 
| 1268 SetAllocatorFlags(0, kOnlyLocalTcpPorts); | 1278 SetAllocatorFlags(0, kOnlyLocalTcpPorts); | 
| 1269 SetAllocatorFlags(1, kOnlyLocalTcpPorts); | 1279 SetAllocatorFlags(1, kOnlyLocalTcpPorts); | 
| 1270 | 1280 | 
| 1271 SetAllowTcpListen(0, true); // actpass. | 1281 SetAllowTcpListen(0, true); // actpass. | 
| 1272 SetAllowTcpListen(1, false); // active. | 1282 SetAllowTcpListen(1, false); // active. | 
| 1273 | 1283 | 
| 1284 // We want SetRemoteIceCredentials to be called as it normally would. | |
| 1285 // Otherwise we won't know what credentials to use for the expected | |
| 1286 // prflx TCP candidates. | |
| 1287 set_clear_remote_candidates_ufrag_pwd(true); | |
| 
 
Taylor Brandstetter
2016/06/21 01:53:10
A couple tests needed to be updated because they w
 
 | |
| 1288 | |
| 1274 // Pause candidate so we could verify the candidate properties. | 1289 // Pause candidate so we could verify the candidate properties. | 
| 1275 PauseCandidates(0); | 1290 PauseCandidates(0); | 
| 1276 PauseCandidates(1); | 1291 PauseCandidates(1); | 
| 1277 CreateChannels(1); | 1292 CreateChannels(1); | 
| 1278 | 1293 | 
| 1279 // Verify tcp candidates. | 1294 // Verify tcp candidates. | 
| 1280 VerifySavedTcpCandidates(0, cricket::TCPTYPE_PASSIVE_STR); | 1295 VerifySavedTcpCandidates(0, cricket::TCPTYPE_PASSIVE_STR); | 
| 1281 VerifySavedTcpCandidates(1, cricket::TCPTYPE_ACTIVE_STR); | 1296 VerifySavedTcpCandidates(1, cricket::TCPTYPE_ACTIVE_STR); | 
| 1282 | 1297 | 
| 1283 // Resume candidates. | 1298 // Resume candidates. | 
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1551 // address of the outermost NAT. | 1566 // address of the outermost NAT. | 
| 1552 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { | 1567 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { | 
| 1553 protected: | 1568 protected: | 
| 1554 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { | 1569 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { | 
| 1555 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); | 1570 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); | 
| 1556 rtc::NATSocketServer::Translator* outer_nat = | 1571 rtc::NATSocketServer::Translator* outer_nat = | 
| 1557 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], | 1572 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], | 
| 1558 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); | 1573 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); | 
| 1559 ConfigureEndpoint(outer_nat, 0, config1); | 1574 ConfigureEndpoint(outer_nat, 0, config1); | 
| 1560 ConfigureEndpoint(outer_nat, 1, config2); | 1575 ConfigureEndpoint(outer_nat, 1, config2); | 
| 1576 set_clear_remote_candidates_ufrag_pwd(true); | |
| 1561 } | 1577 } | 
| 1562 void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat, | 1578 void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat, | 
| 1563 int endpoint, Config config) { | 1579 int endpoint, Config config) { | 
| 1564 ASSERT(config <= NAT_SYMMETRIC); | 1580 ASSERT(config <= NAT_SYMMETRIC); | 
| 1565 if (config == OPEN) { | 1581 if (config == OPEN) { | 
| 1566 AddAddress(endpoint, kPrivateAddrs[endpoint]); | 1582 AddAddress(endpoint, kPrivateAddrs[endpoint]); | 
| 1567 nat->AddClient(kPrivateAddrs[endpoint]); | 1583 nat->AddClient(kPrivateAddrs[endpoint]); | 
| 1568 } else { | 1584 } else { | 
| 1569 AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]); | 1585 AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]); | 
| 1570 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], | 1586 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], | 
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2968 | 2984 | 
| 2969 // TCP Relay/Relay is the next. | 2985 // TCP Relay/Relay is the next. | 
| 2970 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, | 2986 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, | 
| 2971 cricket::RELAY_PORT_TYPE, | 2987 cricket::RELAY_PORT_TYPE, | 
| 2972 cricket::TCP_PROTOCOL_NAME); | 2988 cricket::TCP_PROTOCOL_NAME); | 
| 2973 | 2989 | 
| 2974 // Finally, Local/Relay will be pinged. | 2990 // Finally, Local/Relay will be pinged. | 
| 2975 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, | 2991 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, | 
| 2976 cricket::RELAY_PORT_TYPE); | 2992 cricket::RELAY_PORT_TYPE); | 
| 2977 } | 2993 } | 
| OLD | NEW |