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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 | 1432 |
1433 EXPECT_EQ("relay", RemoteCandidate(ep1_ch1())->type()); | 1433 EXPECT_EQ("relay", RemoteCandidate(ep1_ch1())->type()); |
1434 EXPECT_EQ("relay", LocalCandidate(ep1_ch1())->type()); | 1434 EXPECT_EQ("relay", LocalCandidate(ep1_ch1())->type()); |
1435 EXPECT_EQ("relay", RemoteCandidate(ep2_ch1())->type()); | 1435 EXPECT_EQ("relay", RemoteCandidate(ep2_ch1())->type()); |
1436 EXPECT_EQ("relay", LocalCandidate(ep2_ch1())->type()); | 1436 EXPECT_EQ("relay", LocalCandidate(ep2_ch1())->type()); |
1437 | 1437 |
1438 TestSendRecv(1); | 1438 TestSendRecv(1); |
1439 DestroyChannels(); | 1439 DestroyChannels(); |
1440 } | 1440 } |
1441 | 1441 |
| 1442 // Test that if continual gathering is set to true, ICE gathering state will |
| 1443 // not change to "Complete", and vice versa. |
| 1444 TEST_F(P2PTransportChannelTest, TestContinualGathering) { |
| 1445 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
| 1446 kDefaultPortAllocatorFlags); |
| 1447 SetAllocationStepDelay(0, kDefaultStepDelay); |
| 1448 SetAllocationStepDelay(1, kDefaultStepDelay); |
| 1449 CreateChannels(1); |
| 1450 cricket::IceConfig config = CreateIceConfig(1000, true); |
| 1451 ep1_ch1()->SetIceConfig(config); |
| 1452 // By default, ep2 does not gather continually. |
| 1453 |
| 1454 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && ep2_ch1() != NULL && |
| 1455 ep1_ch1()->receiving() && ep1_ch1()->writable() && |
| 1456 ep2_ch1()->receiving() && ep2_ch1()->writable(), |
| 1457 1000, 1000); |
| 1458 WAIT(cricket::IceGatheringState::kIceGatheringComplete == |
| 1459 ep1_ch1()->gathering_state(), |
| 1460 1000); |
| 1461 EXPECT_EQ(cricket::IceGatheringState::kIceGatheringGathering, |
| 1462 ep1_ch1()->gathering_state()); |
| 1463 // By now, ep2 should have completed gathering. |
| 1464 EXPECT_EQ(cricket::IceGatheringState::kIceGatheringComplete, |
| 1465 ep2_ch1()->gathering_state()); |
| 1466 |
| 1467 DestroyChannels(); |
| 1468 } |
| 1469 |
1442 // Test what happens when we have 2 users behind the same NAT. This can lead | 1470 // Test what happens when we have 2 users behind the same NAT. This can lead |
1443 // to interesting behavior because the STUN server will only give out the | 1471 // to interesting behavior because the STUN server will only give out the |
1444 // address of the outermost NAT. | 1472 // address of the outermost NAT. |
1445 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { | 1473 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { |
1446 protected: | 1474 protected: |
1447 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { | 1475 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { |
1448 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); | 1476 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); |
1449 rtc::NATSocketServer::Translator* outer_nat = | 1477 rtc::NATSocketServer::Translator* outer_nat = |
1450 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], | 1478 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], |
1451 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); | 1479 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 | 2061 |
2034 ch.AddRemoteCandidate(CreateCandidate("3.3.3.3", 3, 1)); | 2062 ch.AddRemoteCandidate(CreateCandidate("3.3.3.3", 3, 1)); |
2035 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); | 2063 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); |
2036 ASSERT_TRUE(conn3 != nullptr); | 2064 ASSERT_TRUE(conn3 != nullptr); |
2037 // The best connection should still be conn2. Even through conn3 has lower | 2065 // The best connection should still be conn2. Even through conn3 has lower |
2038 // priority and is not receiving/writable, it is not pruned because the best | 2066 // priority and is not receiving/writable, it is not pruned because the best |
2039 // connection is not receiving. | 2067 // connection is not receiving. |
2040 WAIT(conn3->pruned(), 1000); | 2068 WAIT(conn3->pruned(), 1000); |
2041 EXPECT_FALSE(conn3->pruned()); | 2069 EXPECT_FALSE(conn3->pruned()); |
2042 } | 2070 } |
OLD | NEW |