Replace RelayPort with TurnPort in p2ptransportchannel tests.

Also remove the relay servers in the tests.
Most of the code and the downstream apps are using TurnPort, not RelayPort. Most of the tests in this file are not using RelayPort anyway.

BUG=None
R=deadbeef@webrtc.org

Review URL: https://codereview.webrtc.org/2380923002 .

Committed: https://crrev.com/c8d21712dde64c7d613d1ea56c840438505a909f
Cr-Original-Commit-Position: refs/heads/master@{#14441}
Cr-Commit-Position: refs/heads/master@{#14446}
This commit is contained in:
Honghai Zhang
2016-09-29 22:46:09 -07:00
parent 26105b41b4
commit b73d269707

View File

@ -76,15 +76,8 @@ static const SocketAddress kCascadedPrivateAddrs[2] =
{ SocketAddress("192.168.10.11", 0), SocketAddress("192.168.20.22", 0) };
// The address of the public STUN server.
static const SocketAddress kStunAddr("99.99.99.1", cricket::STUN_SERVER_PORT);
// The addresses for the public relay server.
static const SocketAddress kRelayUdpIntAddr("99.99.99.2", 5000);
static const SocketAddress kRelayUdpExtAddr("99.99.99.3", 5001);
static const SocketAddress kRelayTcpIntAddr("99.99.99.2", 5002);
static const SocketAddress kRelayTcpExtAddr("99.99.99.3", 5003);
static const SocketAddress kRelaySslTcpIntAddr("99.99.99.2", 5004);
static const SocketAddress kRelaySslTcpExtAddr("99.99.99.3", 5005);
// The addresses for the public turn server.
static const SocketAddress kTurnUdpIntAddr("99.99.99.4",
static const SocketAddress kTurnUdpIntAddr("99.99.99.3",
cricket::STUN_SERVER_PORT);
static const SocketAddress kTurnTcpIntAddr("99.99.99.4",
cricket::STUN_SERVER_PORT + 1);
@ -134,6 +127,28 @@ cricket::Candidate CreateUdpCandidate(const std::string& type,
return c;
}
cricket::BasicPortAllocator* CreateBasicPortAllocator(
rtc::NetworkManager* network_manager,
const cricket::ServerAddresses& stun_servers,
const rtc::SocketAddress& turn_server_udp,
const rtc::SocketAddress& turn_server_tcp) {
cricket::RelayServerConfig turn_server(cricket::RELAY_TURN);
turn_server.credentials = kRelayCredentials;
if (!turn_server_udp.IsNil()) {
turn_server.ports.push_back(
cricket::ProtocolAddress(turn_server_udp, cricket::PROTO_UDP, false));
}
if (!turn_server_tcp.IsNil()) {
turn_server.ports.push_back(
cricket::ProtocolAddress(turn_server_tcp, cricket::PROTO_TCP, false));
}
std::vector<cricket::RelayServerConfig> turn_servers(1, turn_server);
cricket::BasicPortAllocator* allocator =
new cricket::BasicPortAllocator(network_manager);
allocator->SetConfiguration(stun_servers, turn_servers, 0, false);
return allocator;
}
} // namespace
namespace cricket {
@ -166,13 +181,6 @@ class P2PTransportChannelTestBase : public testing::Test,
ss_scope_(ss_.get()),
stun_server_(TestStunServer::Create(main_, kStunAddr)),
turn_server_(main_, kTurnUdpIntAddr, kTurnUdpExtAddr),
relay_server_(main_,
kRelayUdpIntAddr,
kRelayUdpExtAddr,
kRelayTcpIntAddr,
kRelayTcpExtAddr,
kRelaySslTcpIntAddr,
kRelaySslTcpExtAddr),
socks_server1_(ss_.get(),
kSocksProxyAddrs[0],
ss_.get(),
@ -187,12 +195,12 @@ class P2PTransportChannelTestBase : public testing::Test,
ServerAddresses stun_servers;
stun_servers.insert(kStunAddr);
ep1_.allocator_.reset(new BasicPortAllocator(
&ep1_.network_manager_, stun_servers, kRelayUdpIntAddr,
kRelayTcpIntAddr, kRelaySslTcpIntAddr));
ep2_.allocator_.reset(new BasicPortAllocator(
&ep2_.network_manager_, stun_servers, kRelayUdpIntAddr,
kRelayTcpIntAddr, kRelaySslTcpIntAddr));
ep1_.allocator_.reset(
CreateBasicPortAllocator(&ep1_.network_manager_, stun_servers,
kTurnUdpIntAddr, rtc::SocketAddress()));
ep2_.allocator_.reset(
CreateBasicPortAllocator(&ep2_.network_manager_, stun_servers,
kTurnUdpIntAddr, rtc::SocketAddress()));
}
protected:
@ -844,7 +852,6 @@ class P2PTransportChannelTestBase : public testing::Test,
rtc::SocketServerScope ss_scope_;
std::unique_ptr<TestStunServer> stun_server_;
TestTurnServer turn_server_;
TestRelayServer relay_server_;
rtc::SocksProxyServer socks_server1_;
rtc::SocksProxyServer socks_server2_;
Endpoint ep1_;
@ -951,22 +958,6 @@ class P2PTransportChannelTest : public P2PTransportChannelTestBase {
Config config2,
int allocator_flags1,
int allocator_flags2) {
ServerAddresses stun_servers;
stun_servers.insert(kStunAddr);
GetEndpoint(0)->allocator_.reset(new BasicPortAllocator(
&(GetEndpoint(0)->network_manager_), stun_servers, rtc::SocketAddress(),
rtc::SocketAddress(), rtc::SocketAddress()));
GetEndpoint(1)->allocator_.reset(new BasicPortAllocator(
&(GetEndpoint(1)->network_manager_), stun_servers, rtc::SocketAddress(),
rtc::SocketAddress(), rtc::SocketAddress()));
RelayServerConfig turn_server(RELAY_TURN);
turn_server.credentials = kRelayCredentials;
turn_server.ports.push_back(
ProtocolAddress(kTurnUdpIntAddr, PROTO_UDP, false));
GetEndpoint(0)->allocator_->AddTurnServer(turn_server);
GetEndpoint(1)->allocator_->AddTurnServer(turn_server);
int delay = kMinimumStepDelay;
ConfigureEndpoint(0, config1);
SetAllocatorFlags(0, allocator_flags1);
@ -3814,15 +3805,11 @@ class P2PTransportChannelMostLikelyToWorkFirstTest
P2PTransportChannelMostLikelyToWorkFirstTest()
: turn_server_(rtc::Thread::Current(), kTurnUdpIntAddr, kTurnUdpExtAddr) {
network_manager_.AddInterface(kPublicAddrs[0]);
allocator_.reset(new BasicPortAllocator(
&network_manager_, ServerAddresses(), rtc::SocketAddress(),
rtc::SocketAddress(), rtc::SocketAddress()));
allocator_.reset(
CreateBasicPortAllocator(&network_manager_, ServerAddresses(),
kTurnUdpIntAddr, rtc::SocketAddress()));
allocator_->set_flags(allocator_->flags() | PORTALLOCATOR_DISABLE_STUN |
PORTALLOCATOR_DISABLE_TCP);
RelayServerConfig config(RELAY_TURN);
config.credentials = kRelayCredentials;
config.ports.push_back(ProtocolAddress(kTurnUdpIntAddr, PROTO_UDP, false));
allocator_->AddTurnServer(config);
allocator_->set_step_delay(kMinimumStepDelay);
}