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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 // Test that we restart candidate allocation when local ufrag&pwd changed. | 1064 // Test that we restart candidate allocation when local ufrag&pwd changed. |
1065 // Standard Ice protocol is used. | 1065 // Standard Ice protocol is used. |
1066 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) { | 1066 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) { |
1067 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1067 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
1068 kDefaultPortAllocatorFlags); | 1068 kDefaultPortAllocatorFlags); |
1069 CreateChannels(1); | 1069 CreateChannels(1); |
1070 TestHandleIceUfragPasswordChanged(); | 1070 TestHandleIceUfragPasswordChanged(); |
1071 DestroyChannels(); | 1071 DestroyChannels(); |
1072 } | 1072 } |
1073 | 1073 |
| 1074 // Same as above test, but with a symmetric NAT. |
| 1075 // We should end up with relay<->prflx candidate pairs, with generation "1". |
| 1076 TEST_F(P2PTransportChannelTest, HandleUfragPwdChangeSymmetricNat) { |
| 1077 ConfigureEndpoints(NAT_SYMMETRIC, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, |
| 1078 kDefaultPortAllocatorFlags); |
| 1079 CreateChannels(1); |
| 1080 TestHandleIceUfragPasswordChanged(); |
| 1081 DestroyChannels(); |
| 1082 } |
| 1083 |
1074 // Test the operation of GetStats. | 1084 // Test the operation of GetStats. |
1075 TEST_F(P2PTransportChannelTest, GetStats) { | 1085 TEST_F(P2PTransportChannelTest, GetStats) { |
1076 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1086 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
1077 kDefaultPortAllocatorFlags); | 1087 kDefaultPortAllocatorFlags); |
1078 CreateChannels(1); | 1088 CreateChannels(1); |
1079 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 1089 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
1080 ep2_ch1()->receiving() && ep2_ch1()->writable(), | 1090 ep2_ch1()->receiving() && ep2_ch1()->writable(), |
1081 1000, 1000); | 1091 1000, 1000); |
1082 TestSendRecv(1); | 1092 TestSendRecv(1); |
1083 cricket::ConnectionInfos infos; | 1093 cricket::ConnectionInfos infos; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 int kOnlyLocalTcpPorts = cricket::PORTALLOCATOR_DISABLE_UDP | | 1336 int kOnlyLocalTcpPorts = cricket::PORTALLOCATOR_DISABLE_UDP | |
1327 cricket::PORTALLOCATOR_DISABLE_STUN | | 1337 cricket::PORTALLOCATOR_DISABLE_STUN | |
1328 cricket::PORTALLOCATOR_DISABLE_RELAY; | 1338 cricket::PORTALLOCATOR_DISABLE_RELAY; |
1329 // Disable all protocols except TCP. | 1339 // Disable all protocols except TCP. |
1330 SetAllocatorFlags(0, kOnlyLocalTcpPorts); | 1340 SetAllocatorFlags(0, kOnlyLocalTcpPorts); |
1331 SetAllocatorFlags(1, kOnlyLocalTcpPorts); | 1341 SetAllocatorFlags(1, kOnlyLocalTcpPorts); |
1332 | 1342 |
1333 SetAllowTcpListen(0, true); // actpass. | 1343 SetAllowTcpListen(0, true); // actpass. |
1334 SetAllowTcpListen(1, false); // active. | 1344 SetAllowTcpListen(1, false); // active. |
1335 | 1345 |
| 1346 // We want SetRemoteIceCredentials to be called as it normally would. |
| 1347 // Otherwise we won't know what credentials to use for the expected |
| 1348 // prflx TCP candidates. |
| 1349 set_remote_ice_credential_source(FROM_SETICECREDENTIALS); |
| 1350 |
1336 // Pause candidate so we could verify the candidate properties. | 1351 // Pause candidate so we could verify the candidate properties. |
1337 PauseCandidates(0); | 1352 PauseCandidates(0); |
1338 PauseCandidates(1); | 1353 PauseCandidates(1); |
1339 CreateChannels(1); | 1354 CreateChannels(1); |
1340 | 1355 |
1341 // Verify tcp candidates. | 1356 // Verify tcp candidates. |
1342 VerifySavedTcpCandidates(0, cricket::TCPTYPE_PASSIVE_STR); | 1357 VerifySavedTcpCandidates(0, cricket::TCPTYPE_PASSIVE_STR); |
1343 VerifySavedTcpCandidates(1, cricket::TCPTYPE_ACTIVE_STR); | 1358 VerifySavedTcpCandidates(1, cricket::TCPTYPE_ACTIVE_STR); |
1344 | 1359 |
1345 // Resume candidates. | 1360 // Resume candidates. |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 // address of the outermost NAT. | 1635 // address of the outermost NAT. |
1621 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { | 1636 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { |
1622 protected: | 1637 protected: |
1623 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { | 1638 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { |
1624 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); | 1639 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); |
1625 rtc::NATSocketServer::Translator* outer_nat = | 1640 rtc::NATSocketServer::Translator* outer_nat = |
1626 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], | 1641 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], |
1627 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); | 1642 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); |
1628 ConfigureEndpoint(outer_nat, 0, config1); | 1643 ConfigureEndpoint(outer_nat, 0, config1); |
1629 ConfigureEndpoint(outer_nat, 1, config2); | 1644 ConfigureEndpoint(outer_nat, 1, config2); |
| 1645 set_remote_ice_credential_source(FROM_SETICECREDENTIALS); |
1630 } | 1646 } |
1631 void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat, | 1647 void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat, |
1632 int endpoint, Config config) { | 1648 int endpoint, Config config) { |
1633 ASSERT(config <= NAT_SYMMETRIC); | 1649 ASSERT(config <= NAT_SYMMETRIC); |
1634 if (config == OPEN) { | 1650 if (config == OPEN) { |
1635 AddAddress(endpoint, kPrivateAddrs[endpoint]); | 1651 AddAddress(endpoint, kPrivateAddrs[endpoint]); |
1636 nat->AddClient(kPrivateAddrs[endpoint]); | 1652 nat->AddClient(kPrivateAddrs[endpoint]); |
1637 } else { | 1653 } else { |
1638 AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]); | 1654 AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]); |
1639 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], | 1655 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 | 3171 |
3156 // TCP Relay/Relay is the next. | 3172 // TCP Relay/Relay is the next. |
3157 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, | 3173 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, |
3158 cricket::RELAY_PORT_TYPE, | 3174 cricket::RELAY_PORT_TYPE, |
3159 cricket::TCP_PROTOCOL_NAME); | 3175 cricket::TCP_PROTOCOL_NAME); |
3160 | 3176 |
3161 // Finally, Local/Relay will be pinged. | 3177 // Finally, Local/Relay will be pinged. |
3162 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, | 3178 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, |
3163 cricket::RELAY_PORT_TYPE); | 3179 cricket::RELAY_PORT_TYPE); |
3164 } | 3180 } |
OLD | NEW |