Reland "remove stun origin support"
This is a reland of ba29ce320fe1f9ac69b0ff8eb50fbe402c2912a6 readding the origin to the CreateRelayPortArgs structure to not break downstream tests yet: https://webrtc-review.googlesource.com/c/src/+/235300/1..2 Original change's description: > remove stun origin support > > Bug: webrtc:12132 > Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35202} Bug: webrtc:12132 Change-Id: Ied840b59bb7c9497e98f9b80eb0a54d30008a40f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235300 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35220}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
8a2e375eb7
commit
11a89c99e9
@ -85,7 +85,6 @@ static const char kIcePwd1[] = "TESTICEPWD00000000000001";
|
||||
static const char kIcePwd2[] = "TESTICEPWD00000000000002";
|
||||
static const char kTurnUsername[] = "test";
|
||||
static const char kTurnPassword[] = "test";
|
||||
static const char kTestOrigin[] = "http://example.com";
|
||||
// This test configures the virtual socket server to simulate delay so that we
|
||||
// can verify operations take no more than the expected number of round trips.
|
||||
static constexpr unsigned int kSimulatedRtt = 50;
|
||||
@ -259,25 +258,14 @@ class TurnPortTest : public ::testing::Test,
|
||||
const std::string& password,
|
||||
const ProtocolAddress& server_address) {
|
||||
return CreateTurnPortWithAllParams(MakeNetwork(kLocalAddr1), username,
|
||||
password, server_address, std::string());
|
||||
password, server_address);
|
||||
}
|
||||
bool CreateTurnPort(const rtc::SocketAddress& local_address,
|
||||
const std::string& username,
|
||||
const std::string& password,
|
||||
const ProtocolAddress& server_address) {
|
||||
return CreateTurnPortWithAllParams(MakeNetwork(local_address), username,
|
||||
password, server_address, std::string());
|
||||
}
|
||||
|
||||
// Should be identical to CreateTurnPort but specifies an origin value
|
||||
// when creating the instance of TurnPort.
|
||||
bool CreateTurnPortWithOrigin(const rtc::SocketAddress& local_address,
|
||||
const std::string& username,
|
||||
const std::string& password,
|
||||
const ProtocolAddress& server_address,
|
||||
const std::string& origin) {
|
||||
return CreateTurnPortWithAllParams(MakeNetwork(local_address), username,
|
||||
password, server_address, origin);
|
||||
password, server_address);
|
||||
}
|
||||
|
||||
bool CreateTurnPortWithNetwork(rtc::Network* network,
|
||||
@ -285,7 +273,7 @@ class TurnPortTest : public ::testing::Test,
|
||||
const std::string& password,
|
||||
const ProtocolAddress& server_address) {
|
||||
return CreateTurnPortWithAllParams(network, username, password,
|
||||
server_address, std::string());
|
||||
server_address);
|
||||
}
|
||||
|
||||
// Version of CreateTurnPort that takes all possible parameters; all other
|
||||
@ -294,12 +282,11 @@ class TurnPortTest : public ::testing::Test,
|
||||
bool CreateTurnPortWithAllParams(rtc::Network* network,
|
||||
const std::string& username,
|
||||
const std::string& password,
|
||||
const ProtocolAddress& server_address,
|
||||
const std::string& origin) {
|
||||
const ProtocolAddress& server_address) {
|
||||
RelayCredentials credentials(username, password);
|
||||
turn_port_ = TurnPort::Create(
|
||||
&main_, &socket_factory_, network, 0, 0, kIceUfrag1, kIcePwd1,
|
||||
server_address, credentials, 0, origin, {}, {}, turn_customizer_.get());
|
||||
server_address, credentials, 0, {}, {}, turn_customizer_.get());
|
||||
if (!turn_port_) {
|
||||
return false;
|
||||
}
|
||||
@ -331,10 +318,9 @@ class TurnPortTest : public ::testing::Test,
|
||||
}
|
||||
|
||||
RelayCredentials credentials(username, password);
|
||||
turn_port_ =
|
||||
TurnPort::Create(&main_, &socket_factory_, MakeNetwork(kLocalAddr1),
|
||||
socket_.get(), kIceUfrag1, kIcePwd1, server_address,
|
||||
credentials, 0, std::string(), nullptr);
|
||||
turn_port_ = TurnPort::Create(
|
||||
&main_, &socket_factory_, MakeNetwork(kLocalAddr1), socket_.get(),
|
||||
kIceUfrag1, kIcePwd1, server_address, credentials, 0, nullptr);
|
||||
// This TURN port will be the controlling.
|
||||
turn_port_->SetIceRole(ICEROLE_CONTROLLING);
|
||||
ConnectSignals();
|
||||
@ -361,9 +347,9 @@ class TurnPortTest : public ::testing::Test,
|
||||
void CreateUdpPort() { CreateUdpPort(kLocalAddr2); }
|
||||
|
||||
void CreateUdpPort(const SocketAddress& address) {
|
||||
udp_port_ = UDPPort::Create(&main_, &socket_factory_, MakeNetwork(address),
|
||||
0, 0, kIceUfrag2, kIcePwd2, std::string(),
|
||||
false, absl::nullopt);
|
||||
udp_port_ =
|
||||
UDPPort::Create(&main_, &socket_factory_, MakeNetwork(address), 0, 0,
|
||||
kIceUfrag2, kIcePwd2, false, absl::nullopt);
|
||||
// UDP port will be controlled.
|
||||
udp_port_->SetIceRole(ICEROLE_CONTROLLED);
|
||||
udp_port_->SignalPortComplete.connect(this,
|
||||
@ -1551,17 +1537,6 @@ TEST_F(TurnPortTest, TestCandidateAddressFamilyMatch) {
|
||||
EXPECT_EQ(nullptr, conn);
|
||||
}
|
||||
|
||||
TEST_F(TurnPortTest, TestOriginHeader) {
|
||||
CreateTurnPortWithOrigin(kLocalAddr1, kTurnUsername, kTurnPassword,
|
||||
kTurnUdpProtoAddr, kTestOrigin);
|
||||
turn_port_->PrepareAddress();
|
||||
EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 2, fake_clock_);
|
||||
ASSERT_GT(turn_server_.server()->allocations().size(), 0U);
|
||||
SocketAddress local_address = turn_port_->GetLocalAddress();
|
||||
ASSERT_TRUE(turn_server_.FindAllocation(local_address) != NULL);
|
||||
EXPECT_EQ(kTestOrigin, turn_server_.FindAllocation(local_address)->origin());
|
||||
}
|
||||
|
||||
// Test that a CreatePermission failure will result in the connection being
|
||||
// pruned and failed.
|
||||
TEST_F(TurnPortTest, TestConnectionFailedAndPrunedOnCreatePermissionFailure) {
|
||||
|
||||
Reference in New Issue
Block a user