| Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| index 7cd23daa38d2567dbab7cb16647c197f2ff8c094..b989cee9513adedc45eb2a8d68e2ae3c335c1c0e 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| @@ -92,16 +92,19 @@ static const SocketAddress kTurnUdpExtAddr("99.99.99.5", 0);
|
| static const cricket::RelayCredentials kRelayCredentials("test", "test");
|
|
|
| // Based on ICE_UFRAG_LENGTH
|
| -static const char* kIceUfrag[4] = {"UF00", "UF01",
|
| - "UF02", "UF03"};
|
| +const char* kIceUfrag[4] = {"UF00", "UF01", "UF02", "UF03"};
|
| // Based on ICE_PWD_LENGTH
|
| -static const char* kIcePwd[4] = {"TESTICEPWD00000000000000",
|
| - "TESTICEPWD00000000000001",
|
| - "TESTICEPWD00000000000002",
|
| - "TESTICEPWD00000000000003"};
|
| -
|
| -static const uint64_t kLowTiebreaker = 11111;
|
| -static const uint64_t kHighTiebreaker = 22222;
|
| +const char* kIcePwd[4] = {
|
| + "TESTICEPWD00000000000000", "TESTICEPWD00000000000001",
|
| + "TESTICEPWD00000000000002", "TESTICEPWD00000000000003"};
|
| +const cricket::IceParameters kIceParams[4] = {
|
| + {kIceUfrag[0], kIcePwd[0], false},
|
| + {kIceUfrag[1], kIcePwd[1], false},
|
| + {kIceUfrag[2], kIcePwd[2], false},
|
| + {kIceUfrag[3], kIcePwd[3], false}};
|
| +
|
| +const uint64_t kLowTiebreaker = 11111;
|
| +const uint64_t kHighTiebreaker = 22222;
|
|
|
| enum { MSG_ADD_CANDIDATES, MSG_REMOVE_CANDIDATES };
|
|
|
| @@ -131,7 +134,7 @@ cricket::Candidate CreateUdpCandidate(const std::string& type,
|
| return c;
|
| }
|
|
|
| -} // namespace {
|
| +} // namespace
|
|
|
| namespace cricket {
|
|
|
| @@ -305,39 +308,29 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| }
|
|
|
| void CreateChannels(int num) {
|
| - 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];
|
| - std::string ice_pwd_ep2_cd1_ch = kIcePwd[1];
|
| - ep1_.cd1_.ch_.reset(CreateChannel(
|
| - 0, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep1_cd1_ch,
|
| - ice_pwd_ep1_cd1_ch, ice_ufrag_ep2_cd1_ch, ice_pwd_ep2_cd1_ch));
|
| - 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));
|
| + const IceParameters& ice_ep1_cd1_ch = kIceParams[0];
|
| + const IceParameters& ice_ep2_cd1_ch = kIceParams[1];
|
| + ep1_.cd1_.ch_.reset(CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT,
|
| + ice_ep1_cd1_ch, ice_ep2_cd1_ch));
|
| + ep2_.cd1_.ch_.reset(CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT,
|
| + ice_ep2_cd1_ch, ice_ep1_cd1_ch));
|
| ep1_.cd1_.ch_->MaybeStartGathering();
|
| ep2_.cd1_.ch_->MaybeStartGathering();
|
| if (num == 2) {
|
| - std::string ice_ufrag_ep1_cd2_ch = kIceUfrag[2];
|
| - std::string ice_pwd_ep1_cd2_ch = kIcePwd[2];
|
| - std::string ice_ufrag_ep2_cd2_ch = kIceUfrag[3];
|
| - std::string ice_pwd_ep2_cd2_ch = kIcePwd[3];
|
| - ep1_.cd2_.ch_.reset(CreateChannel(
|
| - 0, ICE_CANDIDATE_COMPONENT_DEFAULT, ice_ufrag_ep1_cd2_ch,
|
| - ice_pwd_ep1_cd2_ch, ice_ufrag_ep2_cd2_ch, ice_pwd_ep2_cd2_ch));
|
| - 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));
|
| + const IceParameters& ice_ep1_cd2_ch = kIceParams[2];
|
| + const IceParameters& ice_ep2_cd2_ch = kIceParams[3];
|
| + ep1_.cd2_.ch_.reset(CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT,
|
| + ice_ep1_cd2_ch, ice_ep2_cd2_ch));
|
| + ep2_.cd2_.ch_.reset(CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT,
|
| + ice_ep2_cd2_ch, ice_ep1_cd2_ch));
|
| ep1_.cd2_.ch_->MaybeStartGathering();
|
| ep2_.cd2_.ch_->MaybeStartGathering();
|
| }
|
| }
|
| P2PTransportChannel* CreateChannel(int endpoint,
|
| int component,
|
| - const std::string& local_ice_ufrag,
|
| - const std::string& local_ice_pwd,
|
| - const std::string& remote_ice_ufrag,
|
| - const std::string& remote_ice_pwd) {
|
| + const IceParameters& local_ice,
|
| + const IceParameters& remote_ice) {
|
| P2PTransportChannel* channel = new P2PTransportChannel(
|
| "test content name", component, GetAllocator(endpoint));
|
| channel->SignalReadyToSend.connect(
|
| @@ -352,9 +345,9 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| this, &P2PTransportChannelTestBase::OnRoleConflict);
|
| channel->SignalSelectedCandidatePairChanged.connect(
|
| this, &P2PTransportChannelTestBase::OnSelectedCandidatePairChanged);
|
| - channel->SetIceCredentials(local_ice_ufrag, local_ice_pwd);
|
| - if (remote_ice_credential_source_ == FROM_SETICECREDENTIALS) {
|
| - channel->SetRemoteIceCredentials(remote_ice_ufrag, remote_ice_pwd);
|
| + channel->SetIceParameters(local_ice);
|
| + if (remote_ice_parameter_source_ == FROM_SETICEPARAMETERS) {
|
| + channel->SetRemoteIceParameters(remote_ice);
|
| }
|
| channel->SetIceRole(GetEndpoint(endpoint)->ice_role());
|
| channel->SetIceTiebreaker(GetEndpoint(endpoint)->GetIceTiebreaker());
|
| @@ -608,13 +601,13 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| }
|
|
|
| // This test waits for the transport to become receiving and writable on both
|
| - // end points. Once they are, the end points set new local ice credentials and
|
| + // end points. Once they are, the end points set new local ice parameters and
|
| // restart the ice gathering. Finally it waits for the transport to select a
|
| // new connection using the newly generated ice candidates.
|
| // Before calling this function the end points must be configured.
|
| void TestHandleIceUfragPasswordChanged() {
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| - ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]);
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[1]);
|
| + ep2_ch1()->SetRemoteIceParameters(kIceParams[0]);
|
| EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
|
| ep2_ch1()->receiving() && ep2_ch1()->writable(),
|
| 1000, 1000);
|
| @@ -624,11 +617,12 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| const Candidate* old_remote_candidate1 = RemoteCandidate(ep1_ch1());
|
| const Candidate* old_remote_candidate2 = RemoteCandidate(ep2_ch1());
|
|
|
| - ep1_ch1()->SetIceCredentials(kIceUfrag[2], kIcePwd[2]);
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]);
|
| + ep1_ch1()->SetIceParameters(kIceParams[2]);
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[3]);
|
| ep1_ch1()->MaybeStartGathering();
|
| - ep2_ch1()->SetIceCredentials(kIceUfrag[3], kIcePwd[3]);
|
| - ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]);
|
| + ep2_ch1()->SetIceParameters(kIceParams[3]);
|
| +
|
| + ep2_ch1()->SetRemoteIceParameters(kIceParams[2]);
|
| ep2_ch1()->MaybeStartGathering();
|
|
|
| EXPECT_TRUE_WAIT_MARGIN(LocalCandidate(ep1_ch1())->generation() !=
|
| @@ -751,7 +745,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| return;
|
| }
|
| for (auto& c : data->candidates) {
|
| - if (remote_ice_credential_source_ != FROM_CANDIDATE) {
|
| + if (remote_ice_parameter_source_ != FROM_CANDIDATE) {
|
| c.set_username("");
|
| c.set_password("");
|
| }
|
| @@ -836,13 +830,13 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| return GetChannelData(ch)->ch_packets_;
|
| }
|
|
|
| - enum RemoteIceCredentialSource { FROM_CANDIDATE, FROM_SETICECREDENTIALS };
|
| + enum RemoteIceParameterSource { FROM_CANDIDATE, FROM_SETICEPARAMETERS };
|
|
|
| - // How does the test pass ICE credentials to the P2PTransportChannel?
|
| - // On the candidate itself, or through SetIceCredentials?
|
| + // How does the test pass ICE parameters to the P2PTransportChannel?
|
| + // On the candidate itself, or through SetRemoteIceParameters?
|
| // Goes through the candidate itself by default.
|
| - void set_remote_ice_credential_source(RemoteIceCredentialSource source) {
|
| - remote_ice_credential_source_ = source;
|
| + void set_remote_ice_parameter_source(RemoteIceParameterSource source) {
|
| + remote_ice_parameter_source_ = source;
|
| }
|
|
|
| void set_force_relay(bool relay) {
|
| @@ -871,7 +865,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| rtc::SocksProxyServer socks_server2_;
|
| Endpoint ep1_;
|
| Endpoint ep2_;
|
| - RemoteIceCredentialSource remote_ice_credential_source_ = FROM_CANDIDATE;
|
| + RemoteIceParameterSource remote_ice_parameter_source_ = FROM_CANDIDATE;
|
| bool force_relay_;
|
| int selected_candidate_pair_switches_ = 0;
|
|
|
| @@ -949,7 +943,7 @@ class P2PTransportChannelTest : public P2PTransportChannelTestBase {
|
| SetAllocatorFlags(1, allocator_flags2);
|
| SetAllocationStepDelay(1, delay);
|
|
|
| - set_remote_ice_credential_source(FROM_SETICECREDENTIALS);
|
| + set_remote_ice_parameter_source(FROM_SETICEPARAMETERS);
|
| }
|
| void ConfigureEndpoint(int endpoint, Config config) {
|
| switch (config) {
|
| @@ -1162,11 +1156,11 @@ TEST_F(P2PTransportChannelTest, GetStats) {
|
| TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) {
|
| ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags,
|
| kDefaultPortAllocatorFlags);
|
| - // Emulate no remote credentials coming in.
|
| - set_remote_ice_credential_source(FROM_CANDIDATE);
|
| + // Emulate no remote parameters coming in.
|
| + set_remote_ice_parameter_source(FROM_CANDIDATE);
|
| CreateChannels(1);
|
| - // Only have remote credentials come in for ep2, not ep1.
|
| - ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]);
|
| + // Only have remote parameters come in for ep2, not ep1.
|
| + ep2_ch1()->SetRemoteIceParameters(kIceParams[0]);
|
|
|
| // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive
|
| // candidate.
|
| @@ -1184,16 +1178,17 @@ TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) {
|
| ep1_ch1()->selected_connection()->remote_candidate().username());
|
| EXPECT_EQ("",
|
| ep1_ch1()->selected_connection()->remote_candidate().password());
|
| - // Because we don't have ICE credentials yet, we don't know the generation.
|
| + // Because we don't have ICE parameters yet, we don't know the generation.
|
| EXPECT_EQ(0u,
|
| ep1_ch1()->selected_connection()->remote_candidate().generation());
|
| EXPECT_TRUE(nullptr == ep1_ch1()->FindNextPingableConnection());
|
|
|
| - // Add two sets of remote ICE credentials, so that the ones used by the
|
| + // Add two sets of remote ICE parameters, so that the ones used by the
|
| // candidate will be generation 1 instead of 0.
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]);
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| - // After setting the remote ICE credentials, the password and generation
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[3]);
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[1]);
|
| +
|
| + // After setting the remote ICE parameters, the password and generation
|
| // of the peer reflexive candidate should be updated.
|
| EXPECT_EQ(kIcePwd[1],
|
| ep1_ch1()->selected_connection()->remote_candidate().password());
|
| @@ -1217,11 +1212,11 @@ TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) {
|
| TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignalingWithNAT) {
|
| ConfigureEndpoints(OPEN, NAT_SYMMETRIC, kDefaultPortAllocatorFlags,
|
| kDefaultPortAllocatorFlags);
|
| - // Emulate no remote credentials coming in.
|
| - set_remote_ice_credential_source(FROM_CANDIDATE);
|
| + // Emulate no remote parameters coming in.
|
| + set_remote_ice_parameter_source(FROM_CANDIDATE);
|
| CreateChannels(1);
|
| - // Only have remote credentials come in for ep2, not ep1.
|
| - ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]);
|
| + // Only have remote parameters come in for ep2, not ep1.
|
| + ep2_ch1()->SetRemoteIceParameters(kIceParams[0]);
|
| // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive
|
| // candidate.
|
| PauseCandidates(1);
|
| @@ -1237,16 +1232,16 @@ TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignalingWithNAT) {
|
| ep1_ch1()->selected_connection()->remote_candidate().username());
|
| EXPECT_EQ("",
|
| ep1_ch1()->selected_connection()->remote_candidate().password());
|
| - // Because we don't have ICE credentials yet, we don't know the generation.
|
| + // Because we don't have ICE parameters yet, we don't know the generation.
|
| EXPECT_EQ(0u,
|
| ep1_ch1()->selected_connection()->remote_candidate().generation());
|
| EXPECT_TRUE(nullptr == ep1_ch1()->FindNextPingableConnection());
|
|
|
| - // Add two sets of remote ICE credentials, so that the ones used by the
|
| + // Add two sets of remote ICE parameters, so that the ones used by the
|
| // candidate will be generation 1 instead of 0.
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]);
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| - // After setting the remote ICE credentials, the password and generation
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[3]);
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[1]);
|
| + // After setting the remote ICE parameters, the password and generation
|
| // of the peer reflexive candidate should be updated.
|
| EXPECT_EQ(kIcePwd[1],
|
| ep1_ch1()->selected_connection()->remote_candidate().password());
|
| @@ -1283,21 +1278,22 @@ TEST_F(P2PTransportChannelTest,
|
| // it's prioritized above the current candidate pair.
|
| GetEndpoint(0)->allocator_->set_candidate_filter(CF_RELAY);
|
| GetEndpoint(1)->allocator_->set_candidate_filter(CF_RELAY);
|
| - // Setting this allows us to control when SetRemoteIceCredentials is called.
|
| - set_remote_ice_credential_source(FROM_CANDIDATE);
|
| + // Setting this allows us to control when SetRemoteIceParameters is called.
|
| + set_remote_ice_parameter_source(FROM_CANDIDATE);
|
| CreateChannels(1);
|
| // Wait for the initial connection to be made.
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| - ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[0], kIcePwd[0]);
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[1]);
|
| + ep2_ch1()->SetRemoteIceParameters(kIceParams[0]);
|
| EXPECT_TRUE_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
|
| ep2_ch1()->receiving() && ep2_ch1()->writable(),
|
| kDefaultTimeout);
|
|
|
| // Simulate an ICE restart on ep2, but don't signal the candidate or new
|
| - // ICE credentials until after a prflx connection has been made.
|
| + // ICE parameters until after a prflx connection has been made.
|
| PauseCandidates(1);
|
| - ep2_ch1()->SetIceCredentials(kIceUfrag[3], kIcePwd[3]);
|
| - ep1_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]);
|
| + ep2_ch1()->SetIceParameters(kIceParams[3]);
|
| +
|
| + ep1_ch1()->SetRemoteIceParameters(kIceParams[3]);
|
| ep2_ch1()->MaybeStartGathering();
|
|
|
| // The caller should have the selected connection connected to the peer
|
| @@ -1309,8 +1305,9 @@ TEST_F(P2PTransportChannelTest,
|
| ep1_ch1()->selected_connection();
|
|
|
| // Now simulate the ICE restart on ep1.
|
| - ep1_ch1()->SetIceCredentials(kIceUfrag[2], kIcePwd[2]);
|
| - ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]);
|
| + ep1_ch1()->SetIceParameters(kIceParams[2]);
|
| +
|
| + ep2_ch1()->SetRemoteIceParameters(kIceParams[2]);
|
| ep1_ch1()->MaybeStartGathering();
|
|
|
| // Finally send the candidates from ep2's ICE restart and verify that ep1 uses
|
| @@ -1326,7 +1323,7 @@ TEST_F(P2PTransportChannelTest,
|
|
|
| // Test that if remote candidates don't have ufrag and pwd, we still work.
|
| TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) {
|
| - set_remote_ice_credential_source(FROM_SETICECREDENTIALS);
|
| + set_remote_ice_parameter_source(FROM_SETICEPARAMETERS);
|
| ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags,
|
| kDefaultPortAllocatorFlags);
|
| CreateChannels(1);
|
| @@ -1395,10 +1392,10 @@ TEST_F(P2PTransportChannelTest, TestTcpConnectionsFromActiveToPassive) {
|
| SetAllowTcpListen(0, true); // actpass.
|
| SetAllowTcpListen(1, false); // active.
|
|
|
| - // We want SetRemoteIceCredentials to be called as it normally would.
|
| - // Otherwise we won't know what credentials to use for the expected
|
| + // We want SetRemoteIceParameters to be called as it normally would.
|
| + // Otherwise we won't know what parameters to use for the expected
|
| // prflx TCP candidates.
|
| - set_remote_ice_credential_source(FROM_SETICECREDENTIALS);
|
| + set_remote_ice_parameter_source(FROM_SETICEPARAMETERS);
|
|
|
| // Pause candidate so we could verify the candidate properties.
|
| PauseCandidates(0);
|
| @@ -1684,9 +1681,8 @@ TEST_F(P2PTransportChannelTest, TurnToTurnPresumedWritable) {
|
| kDefaultPortAllocatorFlags);
|
| // Only configure one channel so we can control when the remote candidate
|
| // is added.
|
| - GetEndpoint(0)->cd1_.ch_.reset(
|
| - CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[0],
|
| - kIcePwd[0], kIceUfrag[1], kIcePwd[1]));
|
| + GetEndpoint(0)->cd1_.ch_.reset(CreateChannel(
|
| + 0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[0], kIceParams[1]));
|
| IceConfig config;
|
| config.presume_writable_when_fully_relayed = true;
|
| ep1_ch1()->SetIceConfig(config);
|
| @@ -1732,12 +1728,10 @@ TEST_F(P2PTransportChannelTest, TurnToPrflxPresumedWritable) {
|
| test_turn_server()->set_enable_permission_checks(false);
|
| IceConfig config;
|
| config.presume_writable_when_fully_relayed = true;
|
| - GetEndpoint(0)->cd1_.ch_.reset(
|
| - CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[0],
|
| - kIcePwd[0], kIceUfrag[1], kIcePwd[1]));
|
| - GetEndpoint(1)->cd1_.ch_.reset(
|
| - CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[1],
|
| - kIcePwd[1], kIceUfrag[0], kIcePwd[0]));
|
| + GetEndpoint(0)->cd1_.ch_.reset(CreateChannel(
|
| + 0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[0], kIceParams[1]));
|
| + GetEndpoint(1)->cd1_.ch_.reset(CreateChannel(
|
| + 1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[1], kIceParams[0]));
|
| ep1_ch1()->SetIceConfig(config);
|
| ep2_ch1()->SetIceConfig(config);
|
| // Don't signal candidates from channel 2, so that channel 1 sees the TURN
|
| @@ -1773,12 +1767,10 @@ TEST_F(P2PTransportChannelTest, PresumedWritablePreferredOverUnreliable) {
|
| kDefaultPortAllocatorFlags);
|
| IceConfig config;
|
| config.presume_writable_when_fully_relayed = true;
|
| - GetEndpoint(0)->cd1_.ch_.reset(
|
| - CreateChannel(0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[0],
|
| - kIcePwd[0], kIceUfrag[1], kIcePwd[1]));
|
| - GetEndpoint(1)->cd1_.ch_.reset(
|
| - CreateChannel(1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceUfrag[1],
|
| - kIcePwd[1], kIceUfrag[0], kIcePwd[0]));
|
| + GetEndpoint(0)->cd1_.ch_.reset(CreateChannel(
|
| + 0, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[0], kIceParams[1]));
|
| + GetEndpoint(1)->cd1_.ch_.reset(CreateChannel(
|
| + 1, ICE_CANDIDATE_COMPONENT_DEFAULT, kIceParams[1], kIceParams[0]));
|
| ep1_ch1()->SetIceConfig(config);
|
| ep2_ch1()->SetIceConfig(config);
|
| ep1_ch1()->MaybeStartGathering();
|
| @@ -1821,7 +1813,7 @@ class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase {
|
| static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE));
|
| ConfigureEndpoint(outer_nat, 0, config1);
|
| ConfigureEndpoint(outer_nat, 1, config2);
|
| - set_remote_ice_credential_source(FROM_SETICECREDENTIALS);
|
| + set_remote_ice_parameter_source(FROM_SETICEPARAMETERS);
|
| }
|
| void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat,
|
| int endpoint, Config config) {
|
| @@ -2017,9 +2009,13 @@ TEST_F(P2PTransportChannelMultihomedTest, TestIceRenomination) {
|
| SetAllocatorFlags(0, kOnlyLocalPorts);
|
| SetAllocatorFlags(1, kOnlyLocalPorts);
|
|
|
| + // We want it to set the remote ICE parameters when creating channels.
|
| + set_remote_ice_parameter_source(FROM_SETICEPARAMETERS);
|
| // Create channels and let them go writable, as usual.
|
| CreateChannels(1);
|
| - ep1_ch1()->set_remote_supports_renomination(true);
|
| + // TODO(honghaiz): Once we enable renomination for all webrtc clients, we
|
| + // should set the renomination to be true by default, so we won't need this.
|
| + ASSERT_TRUE(ep1_ch1()->set_remote_supports_renomination(true));
|
| EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
|
| ep2_ch1()->receiving() &&
|
| ep2_ch1()->writable(),
|
| @@ -2545,8 +2541,8 @@ class P2PTransportChannelPingTest : public testing::Test,
|
| protected:
|
| void PrepareChannel(P2PTransportChannel* ch) {
|
| ch->SetIceRole(ICEROLE_CONTROLLING);
|
| - ch->SetIceCredentials(kIceUfrag[0], kIcePwd[0]);
|
| - ch->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| + ch->SetIceParameters(kIceParams[0]);
|
| + ch->SetRemoteIceParameters(kIceParams[1]);
|
| ch->SignalSelectedCandidatePairChanged.connect(
|
| this, &P2PTransportChannelPingTest::OnSelectedCandidatePairChanged);
|
| ch->SignalReadyToSend.connect(this,
|
| @@ -2819,20 +2815,20 @@ TEST_F(P2PTransportChannelPingTest, TestStunPingIntervals) {
|
| }
|
|
|
| // Test that we start pinging as soon as we have a connection and remote ICE
|
| -// credentials.
|
| +// parameters.
|
| TEST_F(P2PTransportChannelPingTest, PingingStartedAsSoonAsPossible) {
|
| rtc::ScopedFakeClock clock;
|
|
|
| FakePortAllocator pa(rtc::Thread::Current(), nullptr);
|
| P2PTransportChannel ch("TestChannel", 1, &pa);
|
| ch.SetIceRole(ICEROLE_CONTROLLING);
|
| - ch.SetIceCredentials(kIceUfrag[0], kIcePwd[0]);
|
| + ch.SetIceParameters(kIceParams[0]);
|
| ch.MaybeStartGathering();
|
| EXPECT_EQ_WAIT(IceGatheringState::kIceGatheringComplete, ch.gathering_state(),
|
| kDefaultTimeout);
|
|
|
| // Simulate a binding request being received, creating a peer reflexive
|
| - // candidate pair while we still don't have remote ICE credentials.
|
| + // candidate pair while we still don't have remote ICE parameters.
|
| IceMessage request;
|
| request.SetType(STUN_BINDING_REQUEST);
|
| request.AddAttribute(
|
| @@ -2848,14 +2844,14 @@ TEST_F(P2PTransportChannelPingTest, PingingStartedAsSoonAsPossible) {
|
| ASSERT_NE(nullptr, conn);
|
|
|
| // Simulate waiting for a second (and change) and verify that no pings were
|
| - // sent, since we don't yet have remote ICE credentials.
|
| + // sent, since we don't yet have remote ICE parameters.
|
| SIMULATED_WAIT(conn->num_pings_sent() > 0, 1025, clock);
|
| EXPECT_EQ(0, conn->num_pings_sent());
|
|
|
| - // Set remote ICE credentials. Now we should be able to ping. Ensure that
|
| + // Set remote ICE parameters. Now we should be able to ping. Ensure that
|
| // the first ping is sent as soon as possible, within one simulated clock
|
| // tick.
|
| - ch.SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| + ch.SetRemoteIceParameters(kIceParams[1]);
|
| EXPECT_TRUE_SIMULATED_WAIT(conn->num_pings_sent() > 0, 1, clock);
|
| }
|
|
|
| @@ -2919,7 +2915,7 @@ TEST_F(P2PTransportChannelPingTest, TestSignalStateChanged) {
|
| // is added with an old ufrag, it will be discarded. If it is added with a
|
| // ufrag that was not seen before, it will be used to create connections
|
| // although the ICE pwd in the remote candidate will be set when the ICE
|
| -// credentials arrive. If a remote candidate is added with the current ICE
|
| +// parameters arrive. If a remote candidate is added with the current ICE
|
| // ufrag, its pwd and generation will be set properly.
|
| TEST_F(P2PTransportChannelPingTest, TestAddRemoteCandidateWithVariousUfrags) {
|
| FakePortAllocator pa(rtc::Thread::Current(), nullptr);
|
| @@ -2936,10 +2932,10 @@ TEST_F(P2PTransportChannelPingTest, TestAddRemoteCandidateWithVariousUfrags) {
|
| EXPECT_TRUE(candidate.password().empty());
|
| EXPECT_TRUE(FindNextPingableConnectionAndPingIt(&ch) == nullptr);
|
|
|
| - // Set the remote credentials with the "future" ufrag.
|
| + // Set the remote ICE parameters with the "future" ufrag.
|
| // This should set the ICE pwd in the remote candidate of |conn1|, making
|
| // it pingable.
|
| - ch.SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]);
|
| + ch.SetRemoteIceParameters(kIceParams[2]);
|
| EXPECT_EQ(kIceUfrag[2], candidate.username());
|
| EXPECT_EQ(kIcePwd[2], candidate.password());
|
| EXPECT_EQ(conn1, FindNextPingableConnectionAndPingIt(&ch));
|
| @@ -3195,8 +3191,8 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionFromUnknownAddress) {
|
| // Test that the request from an unknown address contains a ufrag from an old
|
| // generation.
|
| port->set_sent_binding_response(false);
|
| - ch.SetRemoteIceCredentials(kIceUfrag[2], kIcePwd[2]);
|
| - ch.SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]);
|
| + ch.SetRemoteIceParameters(kIceParams[2]);
|
| + ch.SetRemoteIceParameters(kIceParams[3]);
|
| port->SignalUnknownAddress(port, rtc::SocketAddress("5.5.5.5", 5), PROTO_UDP,
|
| &request, kIceUfrag[2], false);
|
| Connection* conn5 = WaitForConnectionTo(&ch, "5.5.5.5", 5);
|
| @@ -3655,7 +3651,7 @@ TEST_F(P2PTransportChannelPingTest, TestStopPortAllocatorSessions) {
|
| // Start a new session. Even though conn1, which belongs to an older
|
| // session, becomes unwritable and writable again, it should not stop the
|
| // current session.
|
| - ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| + ch.SetIceParameters(kIceParams[1]);
|
| ch.MaybeStartGathering();
|
| conn1->Prune();
|
| conn1->ReceivedPingResponse(LOW_RTT, "id");
|
| @@ -3711,7 +3707,7 @@ TEST_F(P2PTransportChannelPingTest, TestIceRoleUpdatedOnPortAfterIceRestart) {
|
|
|
| // Do an ICE restart, change the role, and expect the old port to have its
|
| // role updated.
|
| - ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]);
|
| + ch.SetIceParameters(kIceParams[1]);
|
| ch.MaybeStartGathering();
|
| ch.SetIceRole(ICEROLE_CONTROLLED);
|
| EXPECT_EQ(ICEROLE_CONTROLLED, conn->port()->GetIceRole());
|
|
|