| Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| index 7e65b4baba93d22a4cac78b71b31705229006f04..ec1499595be4e6b5440e5351a6fe3f8e053fda0a 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| @@ -13,6 +13,7 @@
|
|
|
| #include "webrtc/api/fakemetricsobserver.h"
|
| #include "webrtc/p2p/base/fakeportallocator.h"
|
| +#include "webrtc/p2p/base/packettransportinterface.h"
|
| #include "webrtc/p2p/base/p2ptransportchannel.h"
|
| #include "webrtc/p2p/base/testrelayserver.h"
|
| #include "webrtc/p2p/base/teststunserver.h"
|
| @@ -280,12 +281,13 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| tiebreaker_(0),
|
| role_conflict_(false),
|
| save_candidates_(false) {}
|
| - bool HasChannel(TransportChannel* ch) {
|
| - return (ch == cd1_.ch_.get() || ch == cd2_.ch_.get());
|
| + bool HasTransport(const rtc::PacketTransportInterface* transport) {
|
| + return (transport == cd1_.ch_.get() || transport == cd2_.ch_.get());
|
| }
|
| - ChannelData* GetChannelData(TransportChannel* ch) {
|
| - if (!HasChannel(ch)) return NULL;
|
| - if (cd1_.ch_.get() == ch)
|
| + ChannelData* GetChannelData(rtc::PacketTransportInterface* transport) {
|
| + if (!HasTransport(transport))
|
| + return NULL;
|
| + if (cd1_.ch_.get() == transport)
|
| return &cd1_;
|
| else
|
| return &cd2_;
|
| @@ -319,11 +321,11 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| bool ready_to_send_ = false;
|
| };
|
|
|
| - ChannelData* GetChannelData(TransportChannel* channel) {
|
| - if (ep1_.HasChannel(channel))
|
| - return ep1_.GetChannelData(channel);
|
| + ChannelData* GetChannelData(rtc::PacketTransportInterface* transport) {
|
| + if (ep1_.HasTransport(transport))
|
| + return ep1_.GetChannelData(transport);
|
| else
|
| - return ep2_.GetChannelData(channel);
|
| + return ep2_.GetChannelData(transport);
|
| }
|
|
|
| IceParameters IceParamsWithRenomination(const IceParameters& ice,
|
| @@ -670,8 +672,8 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| TestSendRecv();
|
| }
|
|
|
| - void OnReadyToSend(TransportChannel* ch) {
|
| - GetEndpoint(ch)->ready_to_send_ = true;
|
| + void OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
| + GetEndpoint(transport)->ready_to_send_ = true;
|
| }
|
|
|
| // We pass the candidates directly to the other side.
|
| @@ -777,14 +779,16 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| }
|
| }
|
| }
|
| - void OnReadPacket(TransportChannel* channel,
|
| +
|
| + void OnReadPacket(rtc::PacketTransportInterface* transport,
|
| const char* data,
|
| size_t len,
|
| const rtc::PacketTime& packet_time,
|
| int flags) {
|
| - std::list<std::string>& packets = GetPacketList(channel);
|
| + std::list<std::string>& packets = GetPacketList(transport);
|
| packets.push_front(std::string(data, len));
|
| }
|
| +
|
| void OnRoleConflict(TransportChannelImpl* channel) {
|
| GetEndpoint(channel)->OnRoleConflict(true);
|
| IceRole new_role = GetEndpoint(channel)->ice_role() == ICEROLE_CONTROLLING
|
| @@ -812,10 +816,10 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| ? &ch->selected_connection()->remote_candidate()
|
| : NULL;
|
| }
|
| - Endpoint* GetEndpoint(TransportChannel* ch) {
|
| - if (ep1_.HasChannel(ch)) {
|
| + Endpoint* GetEndpoint(rtc::PacketTransportInterface* transport) {
|
| + if (ep1_.HasTransport(transport)) {
|
| return &ep1_;
|
| - } else if (ep2_.HasChannel(ch)) {
|
| + } else if (ep2_.HasTransport(transport)) {
|
| return &ep2_;
|
| } else {
|
| return NULL;
|
| @@ -833,8 +837,9 @@ class P2PTransportChannelTestBase : public testing::Test,
|
| else
|
| return NULL;
|
| }
|
| - std::list<std::string>& GetPacketList(TransportChannel* ch) {
|
| - return GetChannelData(ch)->ch_packets_;
|
| + std::list<std::string>& GetPacketList(
|
| + rtc::PacketTransportInterface* transport) {
|
| + return GetChannelData(transport)->ch_packets_;
|
| }
|
|
|
| enum RemoteIceParameterSource { FROM_CANDIDATE, FROM_SETICEPARAMETERS };
|
| @@ -2909,7 +2914,7 @@ class P2PTransportChannelPingTest : public testing::Test,
|
| conn->OnReadPacket(buf.Data(), buf.Length(), rtc::CreatePacketTime(0));
|
| }
|
|
|
| - void OnReadyToSend(TransportChannel* channel) {
|
| + void OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
| channel_ready_to_send_ = true;
|
| }
|
| void OnChannelStateChanged(TransportChannelImpl* channel) {
|
|
|