Chromium Code Reviews

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

Issue 2108493003: Fixing P2PTransportChannelTest.TestIceConfigWillPassDownToPort. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 82 matching lines...)
93 93
94 // Based on ICE_UFRAG_LENGTH 94 // Based on ICE_UFRAG_LENGTH
95 static const char* kIceUfrag[4] = {"UF00", "UF01", 95 static const char* kIceUfrag[4] = {"UF00", "UF01",
96 "UF02", "UF03"}; 96 "UF02", "UF03"};
97 // Based on ICE_PWD_LENGTH 97 // Based on ICE_PWD_LENGTH
98 static const char* kIcePwd[4] = {"TESTICEPWD00000000000000", 98 static const char* kIcePwd[4] = {"TESTICEPWD00000000000000",
99 "TESTICEPWD00000000000001", 99 "TESTICEPWD00000000000001",
100 "TESTICEPWD00000000000002", 100 "TESTICEPWD00000000000002",
101 "TESTICEPWD00000000000003"}; 101 "TESTICEPWD00000000000003"};
102 102
103 static const uint64_t kTiebreaker1 = 11111; 103 static const uint64_t kLowTiebreaker = 11111;
104 static const uint64_t kTiebreaker2 = 22222; 104 static const uint64_t kHighTiebreaker = 22222;
105 105
106 enum { MSG_ADD_CANDIDATES, MSG_REMOVE_CANDIDATES }; 106 enum { MSG_ADD_CANDIDATES, MSG_REMOVE_CANDIDATES };
107 107
108 cricket::IceConfig CreateIceConfig(int receiving_timeout, 108 cricket::IceConfig CreateIceConfig(int receiving_timeout,
109 bool gather_continually, 109 bool gather_continually,
110 int backup_ping_interval = -1) { 110 int backup_ping_interval = -1) {
111 cricket::IceConfig config; 111 cricket::IceConfig config;
112 config.receiving_timeout = receiving_timeout; 112 config.receiving_timeout = receiving_timeout;
113 config.gather_continually = gather_continually; 113 config.gather_continually = gather_continually;
114 config.backup_connection_ping_interval = backup_ping_interval; 114 config.backup_connection_ping_interval = backup_ping_interval;
(...skipping 521 matching lines...)
636 old_remote_candidate1->generation(), 636 old_remote_candidate1->generation(),
637 1000, 1000); 637 1000, 1000);
638 EXPECT_TRUE_WAIT_MARGIN(RemoteCandidate(ep2_ch1())->generation() != 638 EXPECT_TRUE_WAIT_MARGIN(RemoteCandidate(ep2_ch1())->generation() !=
639 old_remote_candidate2->generation(), 639 old_remote_candidate2->generation(),
640 1000, 1000); 640 1000, 1000);
641 EXPECT_EQ(1u, RemoteCandidate(ep2_ch1())->generation()); 641 EXPECT_EQ(1u, RemoteCandidate(ep2_ch1())->generation());
642 EXPECT_EQ(1u, RemoteCandidate(ep1_ch1())->generation()); 642 EXPECT_EQ(1u, RemoteCandidate(ep1_ch1())->generation());
643 } 643 }
644 644
645 void TestSignalRoleConflict() { 645 void TestSignalRoleConflict() {
646 SetIceTiebreaker(0, kTiebreaker1); // Default EP1 is in controlling state. 646 SetIceTiebreaker(0,
647 kLowTiebreaker); // Default EP1 is in controlling state.
647 648
648 SetIceRole(1, ICEROLE_CONTROLLING); 649 SetIceRole(1, ICEROLE_CONTROLLING);
649 SetIceTiebreaker(1, kTiebreaker2); 650 SetIceTiebreaker(1, kHighTiebreaker);
650 651
651 // Creating channels with both channels role set to CONTROLLING. 652 // Creating channels with both channels role set to CONTROLLING.
652 CreateChannels(1); 653 CreateChannels(1);
653 // Since both the channels initiated with controlling state and channel2 654 // Since both the channels initiated with controlling state and channel2
654 // has higher tiebreaker value, channel1 should receive SignalRoleConflict. 655 // has higher tiebreaker value, channel1 should receive SignalRoleConflict.
655 EXPECT_TRUE_WAIT(GetRoleConflict(0), 1000); 656 EXPECT_TRUE_WAIT(GetRoleConflict(0), 1000);
656 EXPECT_FALSE(GetRoleConflict(1)); 657 EXPECT_FALSE(GetRoleConflict(1));
657 658
658 EXPECT_TRUE_WAIT(ep1_ch1()->receiving() && 659 EXPECT_TRUE_WAIT(ep1_ch1()->receiving() &&
659 ep1_ch1()->writable() && 660 ep1_ch1()->writable() &&
(...skipping 750 matching lines...)
1410 } 1411 }
1411 1412
1412 TEST_F(P2PTransportChannelTest, TestIceRoleConflict) { 1413 TEST_F(P2PTransportChannelTest, TestIceRoleConflict) {
1413 AddAddress(0, kPublicAddrs[0]); 1414 AddAddress(0, kPublicAddrs[0]);
1414 AddAddress(1, kPublicAddrs[1]); 1415 AddAddress(1, kPublicAddrs[1]);
1415 TestSignalRoleConflict(); 1416 TestSignalRoleConflict();
1416 } 1417 }
1417 1418
1418 // Tests that the ice configs (protocol, tiebreaker and role) can be passed 1419 // Tests that the ice configs (protocol, tiebreaker and role) can be passed
1419 // down to ports. 1420 // down to ports.
1420 // Disable on Windows because it is flaky. 1421 TEST_F(P2PTransportChannelTest, TestIceConfigWillPassDownToPort) {
1421 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6019
1422 #if defined(WEBRTC_WIN)
1423 #define MAYBE_TestIceConfigWillPassDownToPort \
1424 DISABLED_TestIceConfigWillPassDownToPort
1425 #else
1426 #define MAYBE_TestIceConfigWillPassDownToPort TestIceConfigWillPassDownToPort
1427 #endif
1428 TEST_F(P2PTransportChannelTest, MAYBE_TestIceConfigWillPassDownToPort) {
1429 AddAddress(0, kPublicAddrs[0]); 1422 AddAddress(0, kPublicAddrs[0]);
1430 AddAddress(1, kPublicAddrs[1]); 1423 AddAddress(1, kPublicAddrs[1]);
1431 1424
1425 // Give the first connection the higher tiebreaker so its role won't
1426 // change unless we tell it to.
1432 SetIceRole(0, ICEROLE_CONTROLLING); 1427 SetIceRole(0, ICEROLE_CONTROLLING);
1433 SetIceTiebreaker(0, kTiebreaker1); 1428 SetIceTiebreaker(0, kHighTiebreaker);
1434 SetIceRole(1, ICEROLE_CONTROLLING); 1429 SetIceRole(1, ICEROLE_CONTROLLING);
1435 SetIceTiebreaker(1, kTiebreaker2); 1430 SetIceTiebreaker(1, kLowTiebreaker);
1436 1431
1437 CreateChannels(1); 1432 CreateChannels(1);
1438 1433
1439 EXPECT_EQ_WAIT(2u, ep1_ch1()->ports().size(), 1000); 1434 EXPECT_EQ_WAIT(2u, ep1_ch1()->ports().size(), 1000);
1440 1435
1441 const std::vector<PortInterface*> ports_before = ep1_ch1()->ports(); 1436 const std::vector<PortInterface*> ports_before = ep1_ch1()->ports();
1442 for (size_t i = 0; i < ports_before.size(); ++i) { 1437 for (size_t i = 0; i < ports_before.size(); ++i) {
1443 EXPECT_EQ(ICEROLE_CONTROLLING, ports_before[i]->GetIceRole()); 1438 EXPECT_EQ(ICEROLE_CONTROLLING, ports_before[i]->GetIceRole());
1444 EXPECT_EQ(kTiebreaker1, ports_before[i]->IceTiebreaker()); 1439 EXPECT_EQ(kHighTiebreaker, ports_before[i]->IceTiebreaker());
1445 } 1440 }
1446 1441
1447 ep1_ch1()->SetIceRole(ICEROLE_CONTROLLED); 1442 ep1_ch1()->SetIceRole(ICEROLE_CONTROLLED);
1448 ep1_ch1()->SetIceTiebreaker(kTiebreaker2); 1443 ep1_ch1()->SetIceTiebreaker(kLowTiebreaker);
1449 1444
1450 const std::vector<PortInterface*> ports_after = ep1_ch1()->ports(); 1445 const std::vector<PortInterface*> ports_after = ep1_ch1()->ports();
1451 for (size_t i = 0; i < ports_after.size(); ++i) { 1446 for (size_t i = 0; i < ports_after.size(); ++i) {
1452 EXPECT_EQ(ICEROLE_CONTROLLED, ports_before[i]->GetIceRole()); 1447 EXPECT_EQ(ICEROLE_CONTROLLED, ports_before[i]->GetIceRole());
1453 // SetIceTiebreaker after Connect() has been called will fail. So expect the 1448 // SetIceTiebreaker after Connect() has been called will fail. So expect the
1454 // original value. 1449 // original value.
1455 EXPECT_EQ(kTiebreaker1, ports_before[i]->IceTiebreaker()); 1450 EXPECT_EQ(kHighTiebreaker, ports_before[i]->IceTiebreaker());
1456 } 1451 }
1457 1452
1458 EXPECT_TRUE_WAIT(ep1_ch1()->receiving() && 1453 EXPECT_TRUE_WAIT(ep1_ch1()->receiving() &&
1459 ep1_ch1()->writable() && 1454 ep1_ch1()->writable() &&
1460 ep2_ch1()->receiving() && 1455 ep2_ch1()->receiving() &&
1461 ep2_ch1()->writable(), 1456 ep2_ch1()->writable(),
1462 1000); 1457 1000);
1463 1458
1464 EXPECT_TRUE(ep1_ch1()->selected_connection() && 1459 EXPECT_TRUE(ep1_ch1()->selected_connection() &&
1465 ep2_ch1()->selected_connection()); 1460 ep2_ch1()->selected_connection());
(...skipping 2013 matching lines...)
3479 3474
3480 // TCP Relay/Relay is the next. 3475 // TCP Relay/Relay is the next.
3481 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, 3476 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE,
3482 TCP_PROTOCOL_NAME); 3477 TCP_PROTOCOL_NAME);
3483 3478
3484 // Finally, Local/Relay will be pinged. 3479 // Finally, Local/Relay will be pinged.
3485 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); 3480 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE);
3486 } 3481 }
3487 3482
3488 } // namespace cricket { 3483 } // namespace cricket {
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine