Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 1359363003: Make it possible to keep the port allocator session running (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 CreateChannels(1);
1448 cricket::IceConfig config = CreateIceConfig(1000, true);
1449 ep1_ch1()->SetIceConfig(config);
1450 // By default, ep2 does not gather continually.
1451
1452 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && ep2_ch1() != NULL &&
1453 ep1_ch1()->receiving() && ep1_ch1()->writable() &&
1454 ep2_ch1()->receiving() && ep2_ch1()->writable(),
1455 1000, 1000);
1456 WAIT(cricket::IceGatheringState::kIceGatheringComplete ==
1457 ep1_ch1()->gathering_state(),
1458 1000);
1459 EXPECT_EQ(cricket::IceGatheringState::kIceGatheringGathering,
1460 ep1_ch1()->gathering_state());
1461 // By now, ep2 should have completed gathering.
1462 EXPECT_EQ(cricket::IceGatheringState::kIceGatheringComplete,
1463 ep2_ch1()->gathering_state());
1464
1465 DestroyChannels();
1466 }
1467
1442 // Test what happens when we have 2 users behind the same NAT. This can lead 1468 // 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 1469 // to interesting behavior because the STUN server will only give out the
1444 // address of the outermost NAT. 1470 // address of the outermost NAT.
1445 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { 1471 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase {
1446 protected: 1472 protected:
1447 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { 1473 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) {
1448 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); 1474 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC);
1449 rtc::NATSocketServer::Translator* outer_nat = 1475 rtc::NATSocketServer::Translator* outer_nat =
1450 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], 1476 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0],
1451 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); 1477 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE));
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 2059
2034 ch.AddRemoteCandidate(CreateCandidate("3.3.3.3", 3, 1)); 2060 ch.AddRemoteCandidate(CreateCandidate("3.3.3.3", 3, 1));
2035 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); 2061 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3);
2036 ASSERT_TRUE(conn3 != nullptr); 2062 ASSERT_TRUE(conn3 != nullptr);
2037 // The best connection should still be conn2. Even through conn3 has lower 2063 // 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 2064 // priority and is not receiving/writable, it is not pruned because the best
2039 // connection is not receiving. 2065 // connection is not receiving.
2040 WAIT(conn3->pruned(), 1000); 2066 WAIT(conn3->pruned(), 1000);
2041 EXPECT_FALSE(conn3->pruned()); 2067 EXPECT_FALSE(conn3->pruned());
2042 } 2068 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698