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

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

Issue 2163403002: Prepare for ICE-renomination (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@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 6673f8f54d3e9f96c501662664bd2106b9097ab5..ba2553716a06c7b3885544d90b35c98fd1a86902 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -1862,9 +1862,10 @@ class P2PTransportChannelMultihomedTest : public P2PTransportChannelTestBase {
}
void DestroyAllButBestConnection(cricket::P2PTransportChannel* channel) {
- const cricket::Connection* best_connection = channel->best_connection();
+ const cricket::Connection* selected_connection =
+ channel->selected_connection();
for (cricket::Connection* conn : channel->connections()) {
- if (conn != best_connection) {
+ if (conn != selected_connection) {
conn->Destroy();
}
}
@@ -1991,6 +1992,54 @@ TEST_F(P2PTransportChannelMultihomedTest, TestFailoverControllingSide) {
DestroyChannels();
}
+// Test that when the controlling side switches the selected connection,
+// the nominated value of the selected connection on the controlled side will
+// increase.
+TEST_F(P2PTransportChannelMultihomedTest, TestIceRenomination) {
+ rtc::ScopedFakeClock clock;
+ // Adding alternate address will make sure |kPublicAddrs| has the higher
+ // priority than others. This is due to FakeNetwork::AddInterface method.
+ AddAddress(0, kAlternateAddrs[0]);
+ AddAddress(0, kPublicAddrs[0]);
+ AddAddress(1, kPublicAddrs[1]);
+
+ // Use only local ports for simplicity.
+ SetAllocatorFlags(0, kOnlyLocalPorts);
+ SetAllocatorFlags(1, kOnlyLocalPorts);
+
+ // Create channels and let them go writable, as usual.
+ CreateChannels(1);
+ ep1_ch1()->set_peer_supports_renomination(true);
+ EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
+ ep2_ch1()->receiving() &&
+ ep2_ch1()->writable(),
+ 3000, clock);
+ EXPECT_TRUE_SIMULATED_WAIT(
+ ep2_ch1()->selected_connection()->nominated_value() > 0, kDefaultTimeout,
+ clock);
+ const Connection* selected_connection1 = ep1_ch1()->selected_connection();
+ int nominated_value2 = ep2_ch1()->selected_connection()->nominated_value();
+
+ // Make the receiving timeout shorter for testing.
+ IceConfig config = CreateIceConfig(1000, GATHER_ONCE);
+ ep1_ch1()->SetIceConfig(config);
+ ep2_ch1()->SetIceConfig(config);
+
+ // Blackhole any traffic to or from the public addrs.
+ LOG(LS_INFO) << "Failing over...";
+ fw()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, kPublicAddrs[0]);
+
+ // The selected connection on the controlling side should switch.
+ EXPECT_TRUE_SIMULATED_WAIT(
+ ep1_ch1()->selected_connection() != selected_connection1, 3000, clock);
+ // The nominated value on the controlled side should increase.
+ EXPECT_TRUE_SIMULATED_WAIT(
+ ep2_ch1()->selected_connection()->nominated_value() > nominated_value2,
+ kDefaultTimeout, clock);
pthatcher1 2016/07/28 22:57:25 Don't we need to also test that when it's acked, t
honghaiz3 2016/08/03 04:46:56 Done.
+
+ DestroyChannels();
+}
+
// Test that if an interface fails temporarily and then recovers quickly,
// the selected connection will not switch.
// The case that it will switch over to the backup connection if the selected
@@ -2295,26 +2344,27 @@ TEST_F(P2PTransportChannelMultihomedTest,
// to be created and the new one will be the best connection.
AddAddress(1, wifi[1], "test_wifi1", rtc::ADAPTER_TYPE_WIFI);
const cricket::Connection* conn;
- EXPECT_TRUE_WAIT((conn = ep1_ch1()->best_connection()) != nullptr &&
+ EXPECT_TRUE_WAIT((conn = ep1_ch1()->selected_connection()) != nullptr &&
conn->remote_candidate().address().EqualIPs(wifi[1]),
kDefaultTimeout);
- EXPECT_TRUE_WAIT((conn = ep2_ch1()->best_connection()) != nullptr &&
+ EXPECT_TRUE_WAIT((conn = ep2_ch1()->selected_connection()) != nullptr &&
conn->local_candidate().address().EqualIPs(wifi[1]),
kDefaultTimeout);
// Add a new cellular interface on end point 1, we should expect a new
// backup connection created using this new interface.
AddAddress(0, cellular[0], "test_cellular0", rtc::ADAPTER_TYPE_CELLULAR);
- EXPECT_TRUE_WAIT(ep1_ch1()->GetState() == cricket::STATE_COMPLETED &&
- (conn = GetConnectionWithLocalAddress(
- ep1_ch1(), cellular[0])) != nullptr &&
- conn != ep1_ch1()->best_connection() && conn->writable(),
- kDefaultTimeout);
+ EXPECT_TRUE_WAIT(
+ ep1_ch1()->GetState() == cricket::STATE_COMPLETED &&
+ (conn = GetConnectionWithLocalAddress(ep1_ch1(), cellular[0])) !=
+ nullptr &&
+ conn != ep1_ch1()->selected_connection() && conn->writable(),
+ kDefaultTimeout);
EXPECT_TRUE_WAIT(
ep2_ch1()->GetState() == cricket::STATE_COMPLETED &&
(conn = GetConnectionWithRemoteAddress(ep2_ch1(), cellular[0])) !=
nullptr &&
- conn != ep2_ch1()->best_connection() && conn->receiving(),
+ conn != ep2_ch1()->selected_connection() && conn->receiving(),
kDefaultTimeout);
DestroyChannels();
@@ -2360,7 +2410,7 @@ TEST_F(P2PTransportChannelMultihomedTest,
RemoveAddress(1, kAlternateAddrs[1]);
AddAddress(1, kAlternateAddrs[0]);
EXPECT_TRUE_SIMULATED_WAIT(
- ep1_ch1()->best_connection() && ep2_ch1()->best_connection() &&
+ ep1_ch1()->selected_connection() && ep2_ch1()->selected_connection() &&
LocalCandidate(ep1_ch1())->address().EqualIPs(kPublicAddrs[0]) &&
RemoteCandidate(ep1_ch1())->address().EqualIPs(kAlternateAddrs[0]),
3000, clock);
@@ -2397,7 +2447,8 @@ TEST_F(P2PTransportChannelMultihomedTest,
EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
ep2_ch1()->receiving() && ep2_ch1()->writable(),
3000, clock);
- EXPECT_TRUE(ep1_ch1()->best_connection() && ep2_ch1()->best_connection() &&
+ EXPECT_TRUE(ep1_ch1()->selected_connection() &&
+ ep2_ch1()->selected_connection() &&
LocalCandidate(ep1_ch1())->address().EqualIPs(wifi[0]) &&
RemoteCandidate(ep1_ch1())->address().EqualIPs(wifi[1]));
@@ -2408,7 +2459,7 @@ TEST_F(P2PTransportChannelMultihomedTest,
// Then the interface of the best connection goes away.
RemoveAddress(0, wifi[0]);
EXPECT_TRUE_SIMULATED_WAIT(
- ep1_ch1()->best_connection() && ep2_ch1()->best_connection() &&
+ ep1_ch1()->selected_connection() && ep2_ch1()->selected_connection() &&
LocalCandidate(ep1_ch1())->address().EqualIPs(cellular[0]) &&
RemoteCandidate(ep1_ch1())->address().EqualIPs(wifi[1]),
3000, clock);
@@ -2440,7 +2491,8 @@ TEST_F(P2PTransportChannelMultihomedTest, TestRestoreBackupConnection) {
ep2_ch1()->receiving() &&
ep2_ch1()->writable(),
3000, clock);
- EXPECT_TRUE(ep1_ch1()->best_connection() && ep2_ch1()->best_connection() &&
+ EXPECT_TRUE(ep1_ch1()->selected_connection() &&
+ ep2_ch1()->selected_connection() &&
LocalCandidate(ep1_ch1())->address().EqualIPs(wifi[0]) &&
RemoteCandidate(ep1_ch1())->address().EqualIPs(wifi[1]));
@@ -2454,7 +2506,7 @@ TEST_F(P2PTransportChannelMultihomedTest, TestRestoreBackupConnection) {
EXPECT_TRUE_SIMULATED_WAIT(
(conn = GetConnectionWithLocalAddress(ep1_ch1(), cellular[0])) !=
nullptr &&
- conn != ep1_ch1()->best_connection() && conn->writable(),
+ conn != ep1_ch1()->selected_connection() && conn->writable(),
5000, clock);
DestroyChannels();
@@ -2537,13 +2589,13 @@ class P2PTransportChannelPingTest : public testing::Test,
Connection* conn = GetConnectionTo(&channel, ip_addr, port);
if (conn && writable) {
- conn->ReceivedPingResponse(LOW_RTT); // make it writable
+ conn->ReceivedPingResponse(LOW_RTT, "id"); // make it writable
}
return conn;
}
- void NominateConnection(Connection* conn) {
- conn->set_nominated(true);
+ void NominateConnection(Connection* conn, int nominated_value = 1) {
+ conn->set_nominated_value(nominated_value);
conn->SignalNominated(conn);
}
@@ -2644,7 +2696,7 @@ TEST_F(P2PTransportChannelPingTest, TestAllConnectionsPingedSufficiently) {
// Low-priority connection becomes writable so that the other connection
// is not pruned.
- conn1->ReceivedPingResponse(LOW_RTT);
+ conn1->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_TRUE_WAIT(
conn1->num_pings_sent() >= MIN_PINGS_AT_WEAK_PING_INTERVAL &&
conn2->num_pings_sent() >= MIN_PINGS_AT_WEAK_PING_INTERVAL,
@@ -2680,7 +2732,7 @@ TEST_F(P2PTransportChannelPingTest, TestStunPingIntervals) {
// Stabilizing.
- conn->ReceivedPingResponse(LOW_RTT);
+ conn->ReceivedPingResponse(LOW_RTT, "id");
int ping_sent_before = conn->num_pings_sent();
start = clock.TimeNanos();
// The connection becomes strong but not stable because we haven't been able
@@ -2696,7 +2748,7 @@ TEST_F(P2PTransportChannelPingTest, TestStunPingIntervals) {
// The connection becomes stable after receiving more than RTT_RATIO rtt
// samples.
for (int i = 0; i < RTT_RATIO; i++) {
- conn->ReceivedPingResponse(LOW_RTT);
+ conn->ReceivedPingResponse(LOW_RTT, "id");
}
ping_sent_before = conn->num_pings_sent();
start = clock.TimeNanos();
@@ -2708,7 +2760,7 @@ TEST_F(P2PTransportChannelPingTest, TestStunPingIntervals) {
// Destabilized.
- conn->ReceivedPingResponse(LOW_RTT);
+ conn->ReceivedPingResponse(LOW_RTT, "id");
// Create a in-flight ping.
conn->Ping(clock.TimeNanos() / rtc::kNumNanosecsPerMillisec);
start = clock.TimeNanos();
@@ -2790,7 +2842,7 @@ TEST_F(P2PTransportChannelPingTest, TestNoTriggeredChecksWhenWritable) {
EXPECT_EQ(conn2, FindNextPingableConnectionAndPingIt(&ch));
EXPECT_EQ(conn1, FindNextPingableConnectionAndPingIt(&ch));
- conn1->ReceivedPingResponse(LOW_RTT);
+ conn1->ReceivedPingResponse(LOW_RTT, "id");
ASSERT_TRUE(conn1->writable());
conn1->ReceivedPing();
@@ -2907,7 +2959,7 @@ TEST_F(P2PTransportChannelPingTest, ConnectionResurrection) {
Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2);
ASSERT_TRUE(conn2 != nullptr);
conn2->ReceivedPing();
- conn2->ReceivedPingResponse(LOW_RTT);
+ conn2->ReceivedPingResponse(LOW_RTT, "id");
// Wait for conn1 to be pruned.
EXPECT_TRUE_WAIT(conn1->pruned(), 3000);
@@ -3008,11 +3060,10 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBeforeNomination) {
ASSERT_TRUE(conn3 != nullptr);
// Because it has a lower priority, the selected connection is still conn2.
EXPECT_EQ(conn2, ch.selected_connection());
- conn3->ReceivedPingResponse(LOW_RTT); // Become writable.
+ conn3->ReceivedPingResponse(LOW_RTT, "id"); // Become writable.
// But if it is nominated via use_candidate, it is chosen as the selected
// connection.
- conn3->set_nominated(true);
- conn3->SignalNominated(conn3);
+ NominateConnection(conn3);
EXPECT_EQ(conn3, ch.selected_connection());
EXPECT_EQ(conn3, last_selected_candidate_pair());
EXPECT_EQ(-1, last_sent_packet_id());
@@ -3028,13 +3079,12 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBeforeNomination) {
EXPECT_EQ(conn3, ch.selected_connection());
// But if it is nominated via use_candidate and writable, it will be set as
// the selected connection.
- conn4->set_nominated(true);
- conn4->SignalNominated(conn4);
+ NominateConnection(conn4);
// Not switched yet because conn4 is not writable.
EXPECT_EQ(conn3, ch.selected_connection());
reset_channel_ready_to_send();
// The selected connection switches after conn4 becomes writable.
- conn4->ReceivedPingResponse(LOW_RTT);
+ conn4->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_EQ_WAIT(conn4, ch.selected_connection(), kDefaultTimeout);
EXPECT_EQ(conn4, last_selected_candidate_pair());
EXPECT_EQ(last_packet_id, last_sent_packet_id());
@@ -3069,7 +3119,7 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionFromUnknownAddress) {
ASSERT_TRUE(conn1 != nullptr);
EXPECT_TRUE(port->sent_binding_response());
EXPECT_EQ(conn1, ch.selected_connection());
- conn1->ReceivedPingResponse(LOW_RTT);
+ conn1->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_EQ(conn1, ch.selected_connection());
port->set_sent_binding_response(false);
@@ -3081,9 +3131,8 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionFromUnknownAddress) {
EXPECT_EQ(conn1, ch.selected_connection());
// When it is nominated via use_candidate and writable, it is chosen as the
// selected connection.
- conn2->ReceivedPingResponse(LOW_RTT); // Become writable.
- conn2->set_nominated(true);
- conn2->SignalNominated(conn2);
+ conn2->ReceivedPingResponse(LOW_RTT, "id"); // Become writable.
+ NominateConnection(conn2);
EXPECT_EQ(conn2, ch.selected_connection());
// Another request with unknown address, it will not be set as the selected
@@ -3094,7 +3143,7 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionFromUnknownAddress) {
Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3);
ASSERT_TRUE(conn3 != nullptr);
EXPECT_TRUE(port->sent_binding_response());
- conn3->ReceivedPingResponse(LOW_RTT); // Become writable.
+ conn3->ReceivedPingResponse(LOW_RTT, "id"); // Become writable.
EXPECT_EQ(conn2, ch.selected_connection());
port->set_sent_binding_response(false);
@@ -3108,7 +3157,7 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionFromUnknownAddress) {
EXPECT_TRUE(port->sent_binding_response());
// conn4 is not the selected connection yet because it is not writable.
EXPECT_EQ(conn2, ch.selected_connection());
- conn4->ReceivedPingResponse(LOW_RTT); // Become writable.
+ conn4->ReceivedPingResponse(LOW_RTT, "id"); // Become writable.
EXPECT_EQ_WAIT(conn4, ch.selected_connection(), kDefaultTimeout);
// Test that the request from an unknown address contains a ufrag from an old
@@ -3148,7 +3197,7 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) {
conn2->ReceivedPing(); // Start receiving.
conn2->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0));
EXPECT_EQ(conn2, ch.selected_connection());
- conn2->ReceivedPingResponse(LOW_RTT); // Become writable.
+ conn2->ReceivedPingResponse(LOW_RTT, "id"); // Become writable.
// Now another STUN message with an unknown address and use_candidate will
// nominate the selected connection.
@@ -3166,13 +3215,13 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) {
Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3);
ASSERT_TRUE(conn3 != nullptr);
EXPECT_EQ(conn2, ch.selected_connection()); // Not writable yet.
- conn3->ReceivedPingResponse(LOW_RTT); // Become writable.
+ conn3->ReceivedPingResponse(LOW_RTT, "id"); // Become writable.
EXPECT_EQ_WAIT(conn3, ch.selected_connection(), kDefaultTimeout);
// Now another data packet will not switch the selected connection because the
// selected connection was nominated by the controlling side.
conn2->ReceivedPing();
- conn2->ReceivedPingResponse(LOW_RTT);
+ conn2->ReceivedPingResponse(LOW_RTT, "id");
conn2->OnReadPacket("XYZ", 3, rtc::CreatePacketTime(0));
EXPECT_EQ_WAIT(conn3, ch.selected_connection(), kDefaultTimeout);
}
@@ -3262,6 +3311,48 @@ TEST_F(P2PTransportChannelPingTest,
}
TEST_F(P2PTransportChannelPingTest,
+ TestControlledAgentSelectsConnectionWithHigherNominatedValue) {
+ rtc::ScopedFakeClock clock;
+
+ FakePortAllocator pa(rtc::Thread::Current(), nullptr);
+ P2PTransportChannel ch("SwitchSelectedConnection", 1, &pa);
+ PrepareChannel(&ch);
+ ch.SetIceRole(ICEROLE_CONTROLLED);
+ ch.MaybeStartGathering();
+ // The connections have decreasing priority.
+ Connection* conn1 =
+ CreateConnectionWithCandidate(ch, clock, "1.1.1.1", 1, 10, false);
+ ASSERT_TRUE(conn1 != nullptr);
+ Connection* conn2 =
+ CreateConnectionWithCandidate(ch, clock, "2.2.2.2", 2, 9, false);
+ ASSERT_TRUE(conn2 != nullptr);
+
+ // conn1 is the selected connection because it has a higher priority,
+ EXPECT_EQ_SIMULATED_WAIT(conn1, last_selected_candidate_pair(),
+ kDefaultTimeout, clock);
+ reset_selected_candidate_pair_switches();
+
+ // conn2 is nominated; it becomes selected.
+ NominateConnection(conn2);
+ EXPECT_EQ(1, reset_selected_candidate_pair_switches());
+ EXPECT_EQ(conn2, last_selected_candidate_pair());
+
+ // conn1 is selected because of its priority.
+ NominateConnection(conn1);
+ EXPECT_EQ(1, reset_selected_candidate_pair_switches());
+ EXPECT_EQ(conn1, last_selected_candidate_pair());
+
+ // conn2 gets higher nominated value; it is selected again.
+ NominateConnection(conn2, 2);
+ EXPECT_EQ(1, reset_selected_candidate_pair_switches());
+ EXPECT_EQ(conn2, last_selected_candidate_pair());
+
+ // Make sure sorting won't reselect candidate pair.
+ SIMULATED_WAIT(false, 100, clock);
+ EXPECT_EQ(0, reset_selected_candidate_pair_switches());
+}
+
+TEST_F(P2PTransportChannelPingTest,
TestControlledAgentWriteStateTakesHigherPrecedenceThanNomination) {
rtc::ScopedFakeClock clock;
@@ -3282,7 +3373,7 @@ TEST_F(P2PTransportChannelPingTest,
EXPECT_EQ(1, reset_selected_candidate_pair_switches());
// conn2 becomes writable; it is selected even though it is not nominated.
- conn2->ReceivedPingResponse(LOW_RTT);
+ conn2->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_EQ_SIMULATED_WAIT(1, reset_selected_candidate_pair_switches(),
kDefaultTimeout, clock);
@@ -3290,7 +3381,7 @@ TEST_F(P2PTransportChannelPingTest,
kDefaultTimeout, clock);
// If conn1 is also writable, it will become selected.
- conn1->ReceivedPingResponse(LOW_RTT);
+ conn1->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_EQ_SIMULATED_WAIT(1, reset_selected_candidate_pair_switches(),
kDefaultTimeout, clock);
EXPECT_EQ_SIMULATED_WAIT(conn1, last_selected_candidate_pair(),
@@ -3351,16 +3442,15 @@ TEST_F(P2PTransportChannelPingTest, TestDontPruneWhenWeak) {
Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
ASSERT_TRUE(conn1 != nullptr);
EXPECT_EQ(conn1, ch.selected_connection());
- conn1->ReceivedPingResponse(LOW_RTT); // Becomes writable and receiving
+ conn1->ReceivedPingResponse(LOW_RTT, "id"); // Becomes writable and receiving
// When a higher-priority, nominated candidate comes in, the connections with
// lower-priority are pruned.
ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 10));
Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2);
ASSERT_TRUE(conn2 != nullptr);
- conn2->ReceivedPingResponse(LOW_RTT); // Becomes writable and receiving
- conn2->set_nominated(true);
- conn2->SignalNominated(conn2);
+ conn2->ReceivedPingResponse(LOW_RTT, "id"); // Becomes writable and receiving
+ NominateConnection(conn2);
EXPECT_TRUE_WAIT(conn1->pruned(), 3000);
ch.SetIceConfig(CreateIceConfig(500, GATHER_ONCE));
@@ -3415,7 +3505,7 @@ TEST_F(P2PTransportChannelPingTest, TestGetState) {
// Now there are two connections, so the transport channel is connecting.
EXPECT_EQ(TransportChannelState::STATE_CONNECTING, ch.GetState());
// |conn1| becomes writable and receiving; it then should prune |conn2|.
- conn1->ReceivedPingResponse(LOW_RTT);
+ conn1->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_TRUE_WAIT(conn2->pruned(), 1000);
EXPECT_EQ(TransportChannelState::STATE_COMPLETED, ch.GetState());
conn1->Prune(); // All connections are pruned.
@@ -3437,7 +3527,7 @@ TEST_F(P2PTransportChannelPingTest, TestConnectionPrunedAgain) {
Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
ASSERT_TRUE(conn1 != nullptr);
EXPECT_EQ(conn1, ch.selected_connection());
- conn1->ReceivedPingResponse(LOW_RTT); // Becomes writable and receiving
+ conn1->ReceivedPingResponse(LOW_RTT, "id"); // Becomes writable and receiving
// Add a low-priority connection |conn2|, which will be pruned, but it will
// not be deleted right away. Once the current selected connection becomes not
@@ -3456,12 +3546,12 @@ TEST_F(P2PTransportChannelPingTest, TestConnectionPrunedAgain) {
conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2);
ASSERT_TRUE(conn2 != nullptr);
EXPECT_EQ_WAIT(Connection::STATE_INPROGRESS, conn2->state(), 1000);
- conn2->ReceivedPingResponse(LOW_RTT);
+ conn2->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_EQ_WAIT(conn2, ch.selected_connection(), 1000);
EXPECT_EQ(TransportChannelState::STATE_CONNECTING, ch.GetState());
// When |conn1| comes back again, |conn2| will be pruned again.
- conn1->ReceivedPingResponse(LOW_RTT);
+ conn1->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_EQ_WAIT(conn1, ch.selected_connection(), 1000);
EXPECT_TRUE_WAIT(!conn2->active(), 1000);
EXPECT_EQ(TransportChannelState::STATE_COMPLETED, ch.GetState());
@@ -3510,7 +3600,7 @@ TEST_F(P2PTransportChannelPingTest, TestStopPortAllocatorSessions) {
ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 100));
Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
ASSERT_TRUE(conn1 != nullptr);
- conn1->ReceivedPingResponse(LOW_RTT); // Becomes writable and receiving
+ conn1->ReceivedPingResponse(LOW_RTT, "id"); // Becomes writable and receiving
EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts());
// Start a new session. Even though conn1, which belongs to an older
@@ -3519,7 +3609,7 @@ TEST_F(P2PTransportChannelPingTest, TestStopPortAllocatorSessions) {
ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]);
ch.MaybeStartGathering();
conn1->Prune();
- conn1->ReceivedPingResponse(LOW_RTT);
+ conn1->ReceivedPingResponse(LOW_RTT, "id");
EXPECT_TRUE(ch.allocator_session()->IsGettingPorts());
// But if a new connection created from the new session becomes writable,
@@ -3527,7 +3617,7 @@ TEST_F(P2PTransportChannelPingTest, TestStopPortAllocatorSessions) {
ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 100));
Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2);
ASSERT_TRUE(conn2 != nullptr);
- conn2->ReceivedPingResponse(LOW_RTT); // Becomes writable and receiving
+ conn2->ReceivedPingResponse(LOW_RTT, "id"); // Becomes writable and receiving
EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts());
}
@@ -3693,7 +3783,7 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest,
Connection* conn3 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
EXPECT_EQ(conn3->local_candidate().type(), LOCAL_PORT_TYPE);
EXPECT_EQ(conn3->remote_candidate().type(), RELAY_PORT_TYPE);
- conn3->ReceivedPingResponse(LOW_RTT);
+ conn3->ReceivedPingResponse(LOW_RTT, "id");
ASSERT_TRUE(conn3->writable());
conn3->ReceivedPing();
@@ -3711,7 +3801,7 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest,
// pingable connection.
EXPECT_TRUE_WAIT(conn3 == ch.selected_connection(), 5000);
WAIT(false, max_strong_interval + 100);
- conn3->ReceivedPingResponse(LOW_RTT);
+ conn3->ReceivedPingResponse(LOW_RTT, "id");
ASSERT_TRUE(conn3->writable());
EXPECT_EQ(conn3, FindNextPingableConnectionAndPingIt(&ch));

Powered by Google App Engine
This is Rietveld 408576698