| Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| index 7ac70a115a1d33581c342f5f849a4601e1b8e2c8..3a9ec189b092790eb15f2490af4b19a607977bf1 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| @@ -34,7 +34,6 @@
|
| #include "webrtc/base/ssladapter.h"
|
| #include "webrtc/base/thread.h"
|
| #include "webrtc/base/virtualsocketserver.h"
|
| -#include "webrtc/p2p/base/icetransportinternal.h"
|
|
|
| namespace {
|
|
|
| @@ -272,11 +271,11 @@
|
| };
|
|
|
| struct CandidatesData : public rtc::MessageData {
|
| - CandidatesData(IceTransportInternal* ch, const Candidate& c)
|
| + CandidatesData(TransportChannel* ch, const Candidate& c)
|
| : channel(ch), candidates(1, c) {}
|
| - CandidatesData(IceTransportInternal* ch, const std::vector<Candidate>& cc)
|
| + CandidatesData(TransportChannel* ch, const std::vector<Candidate>& cc)
|
| : channel(ch), candidates(cc) {}
|
| - IceTransportInternal* channel;
|
| + TransportChannel* channel;
|
| Candidates candidates;
|
| };
|
|
|
| @@ -686,7 +685,7 @@
|
| }
|
|
|
| // We pass the candidates directly to the other side.
|
| - void OnCandidateGathered(IceTransportInternal* ch, const Candidate& c) {
|
| + void OnCandidateGathered(TransportChannelImpl* ch, const Candidate& c) {
|
| if (force_relay_ && c.type() != RELAY_PORT_TYPE)
|
| return;
|
|
|
| @@ -699,7 +698,7 @@
|
| }
|
| }
|
| void OnSelectedCandidatePairChanged(
|
| - IceTransportInternal* transport_channel,
|
| + TransportChannel* transport_channel,
|
| CandidatePairInterface* selected_candidate_pair,
|
| int last_sent_packet_id,
|
| bool ready_to_send) {
|
| @@ -720,7 +719,7 @@
|
| GetEndpoint(endpoint)->save_candidates_ = true;
|
| }
|
|
|
| - void OnCandidatesRemoved(IceTransportInternal* ch,
|
| + void OnCandidatesRemoved(TransportChannelImpl* ch,
|
| const std::vector<Candidate>& candidates) {
|
| // Candidate removals are not paused.
|
| CandidatesData* candidates_data = new CandidatesData(ch, candidates);
|
| @@ -798,7 +797,7 @@
|
| packets.push_front(std::string(data, len));
|
| }
|
|
|
| - void OnRoleConflict(IceTransportInternal* channel) {
|
| + void OnRoleConflict(TransportChannelImpl* channel) {
|
| GetEndpoint(channel)->OnRoleConflict(true);
|
| IceRole new_role = GetEndpoint(channel)->ice_role() == ICEROLE_CONTROLLING
|
| ? ICEROLE_CONTROLLED
|
| @@ -806,11 +805,11 @@
|
| channel->SetIceRole(new_role);
|
| }
|
|
|
| - int SendData(IceTransportInternal* channel, const char* data, size_t len) {
|
| + int SendData(TransportChannel* channel, const char* data, size_t len) {
|
| rtc::PacketOptions options;
|
| return channel->SendPacket(data, len, options, 0);
|
| }
|
| - bool CheckDataOnChannel(IceTransportInternal* channel,
|
| + bool CheckDataOnChannel(TransportChannel* channel,
|
| const char* data,
|
| int len) {
|
| return GetChannelData(channel)->CheckData(data, len);
|
| @@ -834,7 +833,7 @@
|
| return NULL;
|
| }
|
| }
|
| - P2PTransportChannel* GetRemoteChannel(IceTransportInternal* ch) {
|
| + P2PTransportChannel* GetRemoteChannel(TransportChannel* ch) {
|
| if (ch == ep1_ch1())
|
| return ep2_ch1();
|
| else if (ch == ep1_ch2())
|
| @@ -2657,8 +2656,7 @@
|
| CreateIceConfig(2000, GATHER_ONCE, backup_ping_interval));
|
| // After the state becomes COMPLETED, the backup connection will be pinged
|
| // once every |backup_ping_interval| milliseconds.
|
| - ASSERT_TRUE_WAIT(ep2_ch1()->GetState() == IceTransportState::STATE_COMPLETED,
|
| - 1000);
|
| + ASSERT_TRUE_WAIT(ep2_ch1()->GetState() == STATE_COMPLETED, 1000);
|
| const std::vector<Connection*>& connections = ep2_ch1()->connections();
|
| ASSERT_EQ(2U, connections.size());
|
| Connection* backup_conn = connections[1];
|
| @@ -2684,9 +2682,9 @@
|
| CreateChannels();
|
|
|
| // Both transport channels will reach STATE_COMPLETED quickly.
|
| - EXPECT_EQ_SIMULATED_WAIT(IceTransportState::STATE_COMPLETED,
|
| + EXPECT_EQ_SIMULATED_WAIT(TransportChannelState::STATE_COMPLETED,
|
| ep1_ch1()->GetState(), kShortTimeout, clock);
|
| - EXPECT_EQ_SIMULATED_WAIT(IceTransportState::STATE_COMPLETED,
|
| + EXPECT_EQ_SIMULATED_WAIT(TransportChannelState::STATE_COMPLETED,
|
| ep2_ch1()->GetState(), kShortTimeout, clock);
|
| }
|
|
|
| @@ -2768,13 +2766,13 @@
|
| // backup connection created using this new interface.
|
| AddAddress(0, cellular[0], "test_cellular0", rtc::ADAPTER_TYPE_CELLULAR);
|
| EXPECT_TRUE_WAIT(
|
| - ep1_ch1()->GetState() == IceTransportState::STATE_COMPLETED &&
|
| + ep1_ch1()->GetState() == STATE_COMPLETED &&
|
| (conn = GetConnectionWithLocalAddress(ep1_ch1(), cellular[0])) !=
|
| nullptr &&
|
| conn != ep1_ch1()->selected_connection() && conn->writable(),
|
| kDefaultTimeout);
|
| EXPECT_TRUE_WAIT(
|
| - ep2_ch1()->GetState() == IceTransportState::STATE_COMPLETED &&
|
| + ep2_ch1()->GetState() == STATE_COMPLETED &&
|
| (conn = GetConnectionWithRemoteAddress(ep2_ch1(), cellular[0])) !=
|
| nullptr &&
|
| conn != ep2_ch1()->selected_connection() && conn->receiving(),
|
| @@ -2990,7 +2988,7 @@
|
| return conn;
|
| }
|
|
|
| - int SendData(IceTransportInternal& channel,
|
| + int SendData(TransportChannel& channel,
|
| const char* data,
|
| size_t len,
|
| int packet_id) {
|
| @@ -3024,7 +3022,7 @@
|
| }
|
|
|
| void OnSelectedCandidatePairChanged(
|
| - IceTransportInternal* transport_channel,
|
| + TransportChannel* transport_channel,
|
| CandidatePairInterface* selected_candidate_pair,
|
| int last_sent_packet_id,
|
| bool ready_to_send) {
|
| @@ -3058,7 +3056,7 @@
|
| void OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
| channel_ready_to_send_ = true;
|
| }
|
| - void OnChannelStateChanged(IceTransportInternal* channel) {
|
| + void OnChannelStateChanged(TransportChannelImpl* channel) {
|
| channel_state_ = channel->GetState();
|
| }
|
|
|
| @@ -3068,7 +3066,7 @@
|
| int last_sent_packet_id() { return last_sent_packet_id_; }
|
| bool channel_ready_to_send() { return channel_ready_to_send_; }
|
| void reset_channel_ready_to_send() { channel_ready_to_send_ = false; }
|
| - IceTransportState channel_state() { return channel_state_; }
|
| + TransportChannelState channel_state() { return channel_state_; }
|
| int reset_selected_candidate_pair_switches() {
|
| int switches = selected_candidate_pair_switches_;
|
| selected_candidate_pair_switches_ = 0;
|
| @@ -3083,7 +3081,7 @@
|
| int selected_candidate_pair_switches_ = 0;
|
| int last_sent_packet_id_ = -1;
|
| bool channel_ready_to_send_ = false;
|
| - IceTransportState channel_state_ = IceTransportState::STATE_INIT;
|
| + TransportChannelState channel_state_ = STATE_INIT;
|
| };
|
|
|
| TEST_F(P2PTransportChannelPingTest, TestTriggeredChecks) {
|
| @@ -3319,8 +3317,7 @@
|
| // Pruning the connection reduces the set of active connections and changes
|
| // the channel state.
|
| conn1->Prune();
|
| - EXPECT_EQ_WAIT(IceTransportState::STATE_FAILED, channel_state(),
|
| - kDefaultTimeout);
|
| + EXPECT_EQ_WAIT(STATE_FAILED, channel_state(), kDefaultTimeout);
|
| }
|
|
|
| // Test adding remote candidates with different ufrags. If a remote candidate
|
| @@ -3971,7 +3968,7 @@
|
| P2PTransportChannel ch("test channel", 1, &pa);
|
| PrepareChannel(&ch);
|
| ch.MaybeStartGathering();
|
| - EXPECT_EQ(IceTransportState::STATE_INIT, ch.GetState());
|
| + EXPECT_EQ(TransportChannelState::STATE_INIT, ch.GetState());
|
| ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 100));
|
| ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "2.2.2.2", 2, 1));
|
| Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1, &clock);
|
| @@ -3979,14 +3976,14 @@
|
| ASSERT_TRUE(conn1 != nullptr);
|
| ASSERT_TRUE(conn2 != nullptr);
|
| // Now there are two connections, so the transport channel is connecting.
|
| - EXPECT_EQ(IceTransportState::STATE_CONNECTING, ch.GetState());
|
| + EXPECT_EQ(TransportChannelState::STATE_CONNECTING, ch.GetState());
|
| // |conn1| becomes writable and receiving; it then should prune |conn2|.
|
| conn1->ReceivedPingResponse(LOW_RTT, "id");
|
| EXPECT_TRUE_SIMULATED_WAIT(conn2->pruned(), kShortTimeout, clock);
|
| - EXPECT_EQ(IceTransportState::STATE_COMPLETED, ch.GetState());
|
| + EXPECT_EQ(TransportChannelState::STATE_COMPLETED, ch.GetState());
|
| conn1->Prune(); // All connections are pruned.
|
| // Need to wait until the channel state is updated.
|
| - EXPECT_EQ_SIMULATED_WAIT(IceTransportState::STATE_FAILED, ch.GetState(),
|
| + EXPECT_EQ_SIMULATED_WAIT(TransportChannelState::STATE_FAILED, ch.GetState(),
|
| kShortTimeout, clock);
|
| }
|
|
|
| @@ -4021,7 +4018,7 @@
|
| EXPECT_TRUE_SIMULATED_WAIT(!conn2->active(), kDefaultTimeout, clock);
|
| // |conn2| should not send a ping yet.
|
| EXPECT_EQ(Connection::STATE_WAITING, conn2->state());
|
| - EXPECT_EQ(IceTransportState::STATE_COMPLETED, ch.GetState());
|
| + EXPECT_EQ(TransportChannelState::STATE_COMPLETED, ch.GetState());
|
| // Wait for |conn1| becoming not receiving.
|
| EXPECT_TRUE_SIMULATED_WAIT(!conn1->receiving(), kMediumTimeout, clock);
|
| // Make sure conn2 is not deleted.
|
| @@ -4032,14 +4029,14 @@
|
| conn2->ReceivedPingResponse(LOW_RTT, "id");
|
| EXPECT_EQ_SIMULATED_WAIT(conn2, ch.selected_connection(), kDefaultTimeout,
|
| clock);
|
| - EXPECT_EQ(IceTransportState::STATE_CONNECTING, ch.GetState());
|
| + EXPECT_EQ(TransportChannelState::STATE_CONNECTING, ch.GetState());
|
|
|
| // When |conn1| comes back again, |conn2| will be pruned again.
|
| conn1->ReceivedPingResponse(LOW_RTT, "id");
|
| EXPECT_EQ_SIMULATED_WAIT(conn1, ch.selected_connection(), kDefaultTimeout,
|
| clock);
|
| EXPECT_TRUE_SIMULATED_WAIT(!conn2->active(), kDefaultTimeout, clock);
|
| - EXPECT_EQ(IceTransportState::STATE_COMPLETED, ch.GetState());
|
| + EXPECT_EQ(TransportChannelState::STATE_COMPLETED, ch.GetState());
|
| }
|
|
|
| // Test that if all connections in a channel has timed out on writing, they
|
|
|