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

Unified Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 2124283003: Fixing inconsistency with behavior of `ClearGettingPorts`. (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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
index cf54fc4a27fdcf6dbc4c615ae6216097b0f2dd01..4783833564731619430c5a0744f50509ce176963 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -304,7 +304,9 @@ class P2PTransportChannelTestBase : public testing::Test,
return ep2_.GetChannelData(channel);
}
- void CreateChannels(int num) {
+ void CreateChannels(int num,
+ const IceConfig& ep1_config,
+ const IceConfig& ep2_config) {
std::string ice_ufrag_ep1_cd1_ch = kIceUfrag[0];
std::string ice_pwd_ep1_cd1_ch = kIcePwd[0];
std::string ice_ufrag_ep2_cd1_ch = kIceUfrag[1];
@@ -315,6 +317,8 @@ class P2PTransportChannelTestBase : public testing::Test,
ep2_.cd1_.ch_.reset(CreateChannel(
1, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep2_cd1_ch,
ice_pwd_ep2_cd1_ch, ice_ufrag_ep1_cd1_ch, ice_pwd_ep1_cd1_ch));
+ ep1_.cd1_.ch_->SetIceConfig(ep1_config);
+ ep2_.cd1_.ch_->SetIceConfig(ep2_config);
ep1_.cd1_.ch_->MaybeStartGathering();
ep2_.cd1_.ch_->MaybeStartGathering();
if (num == 2) {
@@ -328,10 +332,18 @@ class P2PTransportChannelTestBase : public testing::Test,
ep2_.cd2_.ch_.reset(CreateChannel(
1, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep2_cd2_ch,
ice_pwd_ep2_cd2_ch, ice_ufrag_ep1_cd2_ch, ice_pwd_ep1_cd2_ch));
+ ep1_.cd2_.ch_->SetIceConfig(ep1_config);
+ ep2_.cd2_.ch_->SetIceConfig(ep2_config);
ep1_.cd2_.ch_->MaybeStartGathering();
ep2_.cd2_.ch_->MaybeStartGathering();
}
}
+
+ void CreateChannels(int num) {
+ IceConfig default_config;
+ CreateChannels(num, default_config, default_config);
+ }
+
P2PTransportChannel* CreateChannel(int endpoint,
int component,
const std::string& local_ice_ufrag,
@@ -1544,10 +1556,11 @@ TEST_F(P2PTransportChannelTest, TestContinualGathering) {
kDefaultPortAllocatorFlags);
SetAllocationStepDelay(0, kDefaultStepDelay);
SetAllocationStepDelay(1, kDefaultStepDelay);
- CreateChannels(1);
- IceConfig config = CreateIceConfig(1000, GATHER_CONTINUALLY);
- ep1_ch1()->SetIceConfig(config);
+ IceConfig continual_gathering_config =
+ CreateIceConfig(1000, GATHER_CONTINUALLY);
// By default, ep2 does not gather continually.
+ IceConfig default_config;
+ CreateChannels(1, continual_gathering_config, default_config);
EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && ep2_ch1() != NULL &&
ep1_ch1()->receiving() && ep1_ch1()->writable() &&
@@ -2097,9 +2110,9 @@ TEST_F(P2PTransportChannelMultihomedTest, TestNetworkBecomesInactive) {
AddAddress(0, kPublicAddrs[0]);
AddAddress(1, kPublicAddrs[1]);
// Create channels and let them go writable, as usual.
- CreateChannels(1);
- ep1_ch1()->SetIceConfig(CreateIceConfig(2000, GATHER_CONTINUALLY));
- ep2_ch1()->SetIceConfig(CreateIceConfig(2000, GATHER_ONCE));
+ IceConfig ep1_config = CreateIceConfig(2000, GATHER_CONTINUALLY);
+ IceConfig ep2_config = CreateIceConfig(2000, GATHER_ONCE);
+ CreateChannels(1, ep1_config, ep2_config);
SetAllocatorFlags(0, kOnlyLocalPorts);
SetAllocatorFlags(1, kOnlyLocalPorts);
@@ -2141,10 +2154,10 @@ TEST_F(P2PTransportChannelMultihomedTest,
auto& cellular = kPublicAddrs;
AddAddress(0, wifi[0], "test_wifi0", rtc::ADAPTER_TYPE_WIFI);
AddAddress(1, cellular[1], "test_cell1", rtc::ADAPTER_TYPE_CELLULAR);
- CreateChannels(1);
// Set continual gathering policy.
- ep1_ch1()->SetIceConfig(CreateIceConfig(1000, GATHER_CONTINUALLY));
- ep2_ch1()->SetIceConfig(CreateIceConfig(1000, GATHER_CONTINUALLY));
+ IceConfig continual_gathering_config =
+ CreateIceConfig(1000, GATHER_CONTINUALLY);
+ CreateChannels(1, continual_gathering_config, continual_gathering_config);
SetAllocatorFlags(0, kOnlyLocalPorts);
SetAllocatorFlags(1, kOnlyLocalPorts);
EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
@@ -2190,11 +2203,11 @@ TEST_F(P2PTransportChannelMultihomedTest,
SetAllocatorFlags(0, kOnlyLocalPorts);
SetAllocatorFlags(1, kOnlyLocalPorts);
- // Create channels and let them go writable, as usual.
- CreateChannels(1);
// Set continual gathering policy.
- ep1_ch1()->SetIceConfig(CreateIceConfig(1000, GATHER_CONTINUALLY));
- ep2_ch1()->SetIceConfig(CreateIceConfig(1000, GATHER_CONTINUALLY));
+ IceConfig continual_gathering_config =
+ CreateIceConfig(1000, GATHER_CONTINUALLY);
+ // Create channels and let them go writable, as usual.
+ CreateChannels(1, continual_gathering_config, continual_gathering_config);
EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
ep2_ch1()->receiving() &&
ep2_ch1()->writable(),
@@ -2248,12 +2261,10 @@ TEST_F(P2PTransportChannelMultihomedTest,
SetAllocatorFlags(0, kOnlyLocalPorts);
SetAllocatorFlags(1, kOnlyLocalPorts);
- // Create channels and let them go writable, as usual.
- CreateChannels(1);
// Set continual gathering policy.
IceConfig config = CreateIceConfig(1000, GATHER_CONTINUALLY_AND_RECOVER);
- ep1_ch1()->SetIceConfig(config);
- ep2_ch1()->SetIceConfig(config);
+ // Create channels and let them go writable, as usual.
+ CreateChannels(1, config, config);
EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
ep2_ch1()->receiving() && ep2_ch1()->writable(),
3000, clock);
@@ -2291,11 +2302,9 @@ TEST_F(P2PTransportChannelMultihomedTest, TestRestoreBackupConnection) {
SetAllocatorFlags(1, kOnlyLocalPorts);
// Create channels and let them go writable, as usual.
- CreateChannels(1);
IceConfig config = CreateIceConfig(1000, GATHER_CONTINUALLY);
config.regather_on_failed_networks_interval = rtc::Optional<int>(2000);
- ep1_ch1()->SetIceConfig(config);
- ep2_ch1()->SetIceConfig(config);
+ CreateChannels(1, config, config);
EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
ep2_ch1()->receiving() &&
ep2_ch1()->writable(),

Powered by Google App Engine
This is Rietveld 408576698