Index: webrtc/p2p/base/port_unittest.cc |
diff --git a/webrtc/p2p/base/port_unittest.cc b/webrtc/p2p/base/port_unittest.cc |
index fc49f20a5d7ef7e55721555686ac182206e44ff5..7e787e08eb316c24053efdcf6dc39a21891db446 100644 |
--- a/webrtc/p2p/base/port_unittest.cc |
+++ b/webrtc/p2p/base/port_unittest.cc |
@@ -8,6 +8,8 @@ |
* be found in the AUTHORS file in the root of the source tree. |
*/ |
+#include <memory> |
+ |
#include "webrtc/p2p/base/basicpacketsocketfactory.h" |
#include "webrtc/p2p/base/relayport.h" |
#include "webrtc/p2p/base/stunport.h" |
@@ -26,7 +28,6 @@ |
#include "webrtc/base/natserver.h" |
#include "webrtc/base/natsocketfactory.h" |
#include "webrtc/base/physicalsocketserver.h" |
-#include "webrtc/base/scoped_ptr.h" |
#include "webrtc/base/socketaddress.h" |
#include "webrtc/base/ssladapter.h" |
#include "webrtc/base/stringutils.h" |
@@ -43,7 +44,6 @@ using rtc::NAT_ADDR_RESTRICTED; |
using rtc::NAT_PORT_RESTRICTED; |
using rtc::NAT_SYMMETRIC; |
using rtc::PacketSocketFactory; |
-using rtc::scoped_ptr; |
using rtc::Socket; |
using rtc::SocketAddress; |
using namespace cricket; |
@@ -212,8 +212,8 @@ class TestPort : public Port { |
const rtc::SentPacket& sent_packet) { |
PortInterface::SignalSentPacket(sent_packet); |
} |
- rtc::scoped_ptr<Buffer> last_stun_buf_; |
- rtc::scoped_ptr<IceMessage> last_stun_msg_; |
+ std::unique_ptr<Buffer> last_stun_buf_; |
+ std::unique_ptr<IceMessage> last_stun_msg_; |
int type_preference_ = 0; |
}; |
@@ -344,12 +344,12 @@ class TestChannel : public sigslot::has_slots<> { |
} |
IceMode ice_mode_; |
- rtc::scoped_ptr<Port> port_; |
+ std::unique_ptr<Port> port_; |
int complete_count_; |
Connection* conn_; |
SocketAddress remote_address_; |
- rtc::scoped_ptr<StunMessage> remote_request_; |
+ std::unique_ptr<StunMessage> remote_request_; |
std::string remote_frag_; |
bool nominated_; |
bool connection_ready_to_send_ = false; |
@@ -764,18 +764,18 @@ class PortTest : public testing::Test, public sigslot::has_slots<> { |
private: |
rtc::Thread* main_; |
- rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; |
- rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; |
+ std::unique_ptr<rtc::PhysicalSocketServer> pss_; |
+ std::unique_ptr<rtc::VirtualSocketServer> ss_; |
rtc::SocketServerScope ss_scope_; |
rtc::Network network_; |
rtc::BasicPacketSocketFactory socket_factory_; |
- rtc::scoped_ptr<rtc::NATServer> nat_server1_; |
- rtc::scoped_ptr<rtc::NATServer> nat_server2_; |
+ std::unique_ptr<rtc::NATServer> nat_server1_; |
+ std::unique_ptr<rtc::NATServer> nat_server2_; |
rtc::NATSocketFactory nat_factory1_; |
rtc::NATSocketFactory nat_factory2_; |
rtc::BasicPacketSocketFactory nat_socket_factory1_; |
rtc::BasicPacketSocketFactory nat_socket_factory2_; |
- scoped_ptr<TestStunServer> stun_server_; |
+ std::unique_ptr<TestStunServer> stun_server_; |
TestTurnServer turn_server_; |
TestRelayServer relay_server_; |
std::string username_; |
@@ -1217,7 +1217,7 @@ TEST_F(PortTest, TestTcpNeverConnect) { |
ch1.Start(); |
ASSERT_EQ_WAIT(1, ch1.complete_count(), kTimeout); |
- rtc::scoped_ptr<rtc::AsyncSocket> server( |
+ std::unique_ptr<rtc::AsyncSocket> server( |
vss()->CreateAsyncSocket(kLocalAddr2.family(), SOCK_STREAM)); |
// Bind but not listen. |
EXPECT_EQ(0, server->Bind(kLocalAddr2)); |
@@ -1322,7 +1322,7 @@ TEST_F(PortTest, TestLocalToLocalStandard) { |
// should remain equal to the request generated by the port and role of port |
// must be in controlling. |
TEST_F(PortTest, TestLoopbackCal) { |
- rtc::scoped_ptr<TestPort> lport( |
+ std::unique_ptr<TestPort> lport( |
CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
lport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
lport->SetIceTiebreaker(kTiebreaker1); |
@@ -1354,7 +1354,7 @@ TEST_F(PortTest, TestLoopbackCal) { |
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000); |
msg = lport->last_stun_msg(); |
EXPECT_EQ(STUN_BINDING_REQUEST, msg->type()); |
- rtc::scoped_ptr<IceMessage> modified_req( |
+ std::unique_ptr<IceMessage> modified_req( |
CreateStunMessage(STUN_BINDING_REQUEST)); |
const StunByteStringAttribute* username_attr = msg->GetByteString( |
STUN_ATTR_USERNAME); |
@@ -1368,7 +1368,7 @@ TEST_F(PortTest, TestLoopbackCal) { |
modified_req->AddFingerprint(); |
lport->Reset(); |
- rtc::scoped_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
+ std::unique_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
WriteStunMessage(modified_req.get(), buf.get()); |
conn1->OnReadPacket(buf->Data(), buf->Length(), rtc::PacketTime()); |
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000); |
@@ -1382,11 +1382,11 @@ TEST_F(PortTest, TestLoopbackCal) { |
// value of tiebreaker, when it receives ping request from |rport| it will |
// send role conflict signal. |
TEST_F(PortTest, TestIceRoleConflict) { |
- rtc::scoped_ptr<TestPort> lport( |
+ std::unique_ptr<TestPort> lport( |
CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
lport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
lport->SetIceTiebreaker(kTiebreaker1); |
- rtc::scoped_ptr<TestPort> rport( |
+ std::unique_ptr<TestPort> rport( |
CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
rport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
rport->SetIceTiebreaker(kTiebreaker2); |
@@ -1430,8 +1430,7 @@ TEST_F(PortTest, TestDelayedBindingUdp) { |
FakePacketSocketFactory socket_factory; |
socket_factory.set_next_udp_socket(socket); |
- scoped_ptr<UDPPort> port( |
- CreateUdpPort(kLocalAddr1, &socket_factory)); |
+ std::unique_ptr<UDPPort> port(CreateUdpPort(kLocalAddr1, &socket_factory)); |
socket->set_state(AsyncPacketSocket::STATE_BINDING); |
port->PrepareAddress(); |
@@ -1447,8 +1446,7 @@ TEST_F(PortTest, TestDelayedBindingTcp) { |
FakePacketSocketFactory socket_factory; |
socket_factory.set_next_server_tcp_socket(socket); |
- scoped_ptr<TCPPort> port( |
- CreateTcpPort(kLocalAddr1, &socket_factory)); |
+ std::unique_ptr<TCPPort> port(CreateTcpPort(kLocalAddr1, &socket_factory)); |
socket->set_state(AsyncPacketSocket::STATE_BINDING); |
port->PrepareAddress(); |
@@ -1461,7 +1459,7 @@ TEST_F(PortTest, TestDelayedBindingTcp) { |
void PortTest::TestCrossFamilyPorts(int type) { |
FakePacketSocketFactory factory; |
- scoped_ptr<Port> ports[4]; |
+ std::unique_ptr<Port> ports[4]; |
SocketAddress addresses[4] = {SocketAddress("192.168.1.3", 0), |
SocketAddress("192.168.1.4", 0), |
SocketAddress("2001:db8::1", 0), |
@@ -1531,7 +1529,7 @@ void PortTest::ExpectPortsCanConnect(bool can_connect, Port* p1, Port* p2) { |
TEST_F(PortTest, TestUdpV6CrossTypePorts) { |
FakePacketSocketFactory factory; |
- scoped_ptr<Port> ports[4]; |
+ std::unique_ptr<Port> ports[4]; |
SocketAddress addresses[4] = {SocketAddress("2001:db8::1", 0), |
SocketAddress("fe80::1", 0), |
SocketAddress("fe80::2", 0), |
@@ -1564,23 +1562,23 @@ TEST_F(PortTest, TestUdpV6CrossTypePorts) { |
// get through DefaultDscpValue. |
TEST_F(PortTest, TestDefaultDscpValue) { |
int dscp; |
- rtc::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1)); |
+ std::unique_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1)); |
EXPECT_EQ(0, udpport->SetOption(rtc::Socket::OPT_DSCP, |
rtc::DSCP_CS6)); |
EXPECT_EQ(0, udpport->GetOption(rtc::Socket::OPT_DSCP, &dscp)); |
- rtc::scoped_ptr<TCPPort> tcpport(CreateTcpPort(kLocalAddr1)); |
+ std::unique_ptr<TCPPort> tcpport(CreateTcpPort(kLocalAddr1)); |
EXPECT_EQ(0, tcpport->SetOption(rtc::Socket::OPT_DSCP, |
rtc::DSCP_AF31)); |
EXPECT_EQ(0, tcpport->GetOption(rtc::Socket::OPT_DSCP, &dscp)); |
EXPECT_EQ(rtc::DSCP_AF31, dscp); |
- rtc::scoped_ptr<StunPort> stunport( |
+ std::unique_ptr<StunPort> stunport( |
CreateStunPort(kLocalAddr1, nat_socket_factory1())); |
EXPECT_EQ(0, stunport->SetOption(rtc::Socket::OPT_DSCP, |
rtc::DSCP_AF41)); |
EXPECT_EQ(0, stunport->GetOption(rtc::Socket::OPT_DSCP, &dscp)); |
EXPECT_EQ(rtc::DSCP_AF41, dscp); |
- rtc::scoped_ptr<TurnPort> turnport1(CreateTurnPort( |
- kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
+ std::unique_ptr<TurnPort> turnport1( |
+ CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
// Socket is created in PrepareAddress. |
turnport1->PrepareAddress(); |
EXPECT_EQ(0, turnport1->SetOption(rtc::Socket::OPT_DSCP, |
@@ -1588,8 +1586,8 @@ TEST_F(PortTest, TestDefaultDscpValue) { |
EXPECT_EQ(0, turnport1->GetOption(rtc::Socket::OPT_DSCP, &dscp)); |
EXPECT_EQ(rtc::DSCP_CS7, dscp); |
// This will verify correct value returned without the socket. |
- rtc::scoped_ptr<TurnPort> turnport2(CreateTurnPort( |
- kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
+ std::unique_ptr<TurnPort> turnport2( |
+ CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
EXPECT_EQ(0, turnport2->SetOption(rtc::Socket::OPT_DSCP, |
rtc::DSCP_CS6)); |
EXPECT_EQ(0, turnport2->GetOption(rtc::Socket::OPT_DSCP, &dscp)); |
@@ -1598,9 +1596,9 @@ TEST_F(PortTest, TestDefaultDscpValue) { |
// Test sending STUN messages. |
TEST_F(PortTest, TestSendStunMessage) { |
- rtc::scoped_ptr<TestPort> lport( |
+ std::unique_ptr<TestPort> lport( |
CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
- rtc::scoped_ptr<TestPort> rport( |
+ std::unique_ptr<TestPort> rport( |
CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
lport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
lport->SetIceTiebreaker(kTiebreaker1); |
@@ -1647,7 +1645,7 @@ TEST_F(PortTest, TestSendStunMessage) { |
ASSERT_TRUE(msg->GetUInt32(STUN_ATTR_RETRANSMIT_COUNT) == NULL); |
// Save a copy of the BINDING-REQUEST for use below. |
- rtc::scoped_ptr<IceMessage> request(CopyStunMessage(msg)); |
+ std::unique_ptr<IceMessage> request(CopyStunMessage(msg)); |
// Respond with a BINDING-RESPONSE. |
rport->SendBindingResponse(request.get(), lport->Candidates()[0].address()); |
@@ -1738,9 +1736,9 @@ TEST_F(PortTest, TestSendStunMessage) { |
} |
TEST_F(PortTest, TestUseCandidateAttribute) { |
- rtc::scoped_ptr<TestPort> lport( |
+ std::unique_ptr<TestPort> lport( |
CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
- rtc::scoped_ptr<TestPort> rport( |
+ std::unique_ptr<TestPort> rport( |
CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
lport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
lport->SetIceTiebreaker(kTiebreaker1); |
@@ -1765,11 +1763,11 @@ TEST_F(PortTest, TestUseCandidateAttribute) { |
} |
TEST_F(PortTest, TestNetworkInfoAttribute) { |
- rtc::scoped_ptr<TestPort> lport( |
+ std::unique_ptr<TestPort> lport( |
CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
// Set the network type for rport to be cellular so its cost will be 999. |
SetNetworkType(rtc::ADAPTER_TYPE_CELLULAR); |
- rtc::scoped_ptr<TestPort> rport( |
+ std::unique_ptr<TestPort> rport( |
CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
lport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
lport->SetIceTiebreaker(kTiebreaker1); |
@@ -1812,11 +1810,10 @@ TEST_F(PortTest, TestNetworkInfoAttribute) { |
// Test handling STUN messages. |
TEST_F(PortTest, TestHandleStunMessage) { |
// Our port will act as the "remote" port. |
- rtc::scoped_ptr<TestPort> port( |
- CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
+ std::unique_ptr<TestPort> port(CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
- rtc::scoped_ptr<IceMessage> in_msg, out_msg; |
- rtc::scoped_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
+ std::unique_ptr<IceMessage> in_msg, out_msg; |
+ std::unique_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
rtc::SocketAddress addr(kLocalAddr1); |
std::string username; |
@@ -1862,11 +1859,10 @@ TEST_F(PortTest, TestHandleStunMessage) { |
// Tests handling of ICE binding requests with missing or incorrect usernames. |
TEST_F(PortTest, TestHandleStunMessageBadUsername) { |
- rtc::scoped_ptr<TestPort> port( |
- CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
+ std::unique_ptr<TestPort> port(CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
- rtc::scoped_ptr<IceMessage> in_msg, out_msg; |
- rtc::scoped_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
+ std::unique_ptr<IceMessage> in_msg, out_msg; |
+ std::unique_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
rtc::SocketAddress addr(kLocalAddr1); |
std::string username; |
@@ -1931,11 +1927,10 @@ TEST_F(PortTest, TestHandleStunMessageBadUsername) { |
// Test handling STUN messages with missing or malformed M-I. |
TEST_F(PortTest, TestHandleStunMessageBadMessageIntegrity) { |
// Our port will act as the "remote" port. |
- rtc::scoped_ptr<TestPort> port( |
- CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
+ std::unique_ptr<TestPort> port(CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
- rtc::scoped_ptr<IceMessage> in_msg, out_msg; |
- rtc::scoped_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
+ std::unique_ptr<IceMessage> in_msg, out_msg; |
+ std::unique_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
rtc::SocketAddress addr(kLocalAddr1); |
std::string username; |
@@ -1972,11 +1967,10 @@ TEST_F(PortTest, TestHandleStunMessageBadMessageIntegrity) { |
// Test handling STUN messages with missing or malformed FINGERPRINT. |
TEST_F(PortTest, TestHandleStunMessageBadFingerprint) { |
// Our port will act as the "remote" port. |
- rtc::scoped_ptr<TestPort> port( |
- CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
+ std::unique_ptr<TestPort> port(CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
- rtc::scoped_ptr<IceMessage> in_msg, out_msg; |
- rtc::scoped_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
+ std::unique_ptr<IceMessage> in_msg, out_msg; |
+ std::unique_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
rtc::SocketAddress addr(kLocalAddr1); |
std::string username; |
@@ -2038,14 +2032,14 @@ TEST_F(PortTest, TestHandleStunMessageBadFingerprint) { |
// Test handling of STUN binding indication messages . STUN binding |
// indications are allowed only to the connection which is in read mode. |
TEST_F(PortTest, TestHandleStunBindingIndication) { |
- rtc::scoped_ptr<TestPort> lport( |
+ std::unique_ptr<TestPort> lport( |
CreateTestPort(kLocalAddr2, "lfrag", "lpass")); |
lport->SetIceRole(cricket::ICEROLE_CONTROLLING); |
lport->SetIceTiebreaker(kTiebreaker1); |
// Verifying encoding and decoding STUN indication message. |
- rtc::scoped_ptr<IceMessage> in_msg, out_msg; |
- rtc::scoped_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
+ std::unique_ptr<IceMessage> in_msg, out_msg; |
+ std::unique_ptr<ByteBufferWriter> buf(new ByteBufferWriter()); |
rtc::SocketAddress addr(kLocalAddr1); |
std::string username; |
@@ -2060,7 +2054,7 @@ TEST_F(PortTest, TestHandleStunBindingIndication) { |
// Verify connection can handle STUN indication and updates |
// last_ping_received. |
- rtc::scoped_ptr<TestPort> rport( |
+ std::unique_ptr<TestPort> rport( |
CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
rport->SetIceRole(cricket::ICEROLE_CONTROLLED); |
rport->SetIceTiebreaker(kTiebreaker2); |
@@ -2096,8 +2090,7 @@ TEST_F(PortTest, TestHandleStunBindingIndication) { |
} |
TEST_F(PortTest, TestComputeCandidatePriority) { |
- rtc::scoped_ptr<TestPort> port( |
- CreateTestPort(kLocalAddr1, "name", "pass")); |
+ std::unique_ptr<TestPort> port(CreateTestPort(kLocalAddr1, "name", "pass")); |
port->set_type_preference(90); |
port->set_component(177); |
port->AddCandidateAddress(SocketAddress("192.168.1.4", 1234)); |
@@ -2134,7 +2127,7 @@ TEST_F(PortTest, TestComputeCandidatePriority) { |
// In the case of shared socket, one port may be shared by local and stun. |
// Test that candidates with different types will have different foundation. |
TEST_F(PortTest, TestFoundation) { |
- rtc::scoped_ptr<TestPort> testport( |
+ std::unique_ptr<TestPort> testport( |
CreateTestPort(kLocalAddr1, "name", "pass")); |
testport->AddCandidateAddress(kLocalAddr1, kLocalAddr1, |
LOCAL_PORT_TYPE, |
@@ -2148,21 +2141,21 @@ TEST_F(PortTest, TestFoundation) { |
// This test verifies the foundation of different types of ICE candidates. |
TEST_F(PortTest, TestCandidateFoundation) { |
- rtc::scoped_ptr<rtc::NATServer> nat_server( |
+ std::unique_ptr<rtc::NATServer> nat_server( |
CreateNatServer(kNatAddr1, NAT_OPEN_CONE)); |
- rtc::scoped_ptr<UDPPort> udpport1(CreateUdpPort(kLocalAddr1)); |
+ std::unique_ptr<UDPPort> udpport1(CreateUdpPort(kLocalAddr1)); |
udpport1->PrepareAddress(); |
- rtc::scoped_ptr<UDPPort> udpport2(CreateUdpPort(kLocalAddr1)); |
+ std::unique_ptr<UDPPort> udpport2(CreateUdpPort(kLocalAddr1)); |
udpport2->PrepareAddress(); |
EXPECT_EQ(udpport1->Candidates()[0].foundation(), |
udpport2->Candidates()[0].foundation()); |
- rtc::scoped_ptr<TCPPort> tcpport1(CreateTcpPort(kLocalAddr1)); |
+ std::unique_ptr<TCPPort> tcpport1(CreateTcpPort(kLocalAddr1)); |
tcpport1->PrepareAddress(); |
- rtc::scoped_ptr<TCPPort> tcpport2(CreateTcpPort(kLocalAddr1)); |
+ std::unique_ptr<TCPPort> tcpport2(CreateTcpPort(kLocalAddr1)); |
tcpport2->PrepareAddress(); |
EXPECT_EQ(tcpport1->Candidates()[0].foundation(), |
tcpport2->Candidates()[0].foundation()); |
- rtc::scoped_ptr<Port> stunport( |
+ std::unique_ptr<Port> stunport( |
CreateStunPort(kLocalAddr1, nat_socket_factory1())); |
stunport->PrepareAddress(); |
ASSERT_EQ_WAIT(1U, stunport->Candidates().size(), kTimeout); |
@@ -2175,8 +2168,7 @@ TEST_F(PortTest, TestCandidateFoundation) { |
EXPECT_NE(udpport2->Candidates()[0].foundation(), |
stunport->Candidates()[0].foundation()); |
// Verify GTURN candidate foundation. |
- rtc::scoped_ptr<RelayPort> relayport( |
- CreateGturnPort(kLocalAddr1)); |
+ std::unique_ptr<RelayPort> relayport(CreateGturnPort(kLocalAddr1)); |
relayport->AddServerAddress( |
cricket::ProtocolAddress(kRelayUdpIntAddr, cricket::PROTO_UDP)); |
relayport->PrepareAddress(); |
@@ -2186,8 +2178,8 @@ TEST_F(PortTest, TestCandidateFoundation) { |
EXPECT_NE(udpport2->Candidates()[0].foundation(), |
relayport->Candidates()[0].foundation()); |
// Verifying TURN candidate foundation. |
- rtc::scoped_ptr<Port> turnport1(CreateTurnPort( |
- kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
+ std::unique_ptr<Port> turnport1( |
+ CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
turnport1->PrepareAddress(); |
ASSERT_EQ_WAIT(1U, turnport1->Candidates().size(), kTimeout); |
EXPECT_NE(udpport1->Candidates()[0].foundation(), |
@@ -2196,8 +2188,8 @@ TEST_F(PortTest, TestCandidateFoundation) { |
turnport1->Candidates()[0].foundation()); |
EXPECT_NE(stunport->Candidates()[0].foundation(), |
turnport1->Candidates()[0].foundation()); |
- rtc::scoped_ptr<Port> turnport2(CreateTurnPort( |
- kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
+ std::unique_ptr<Port> turnport2( |
+ CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
turnport2->PrepareAddress(); |
ASSERT_EQ_WAIT(1U, turnport2->Candidates().size(), kTimeout); |
EXPECT_EQ(turnport1->Candidates()[0].foundation(), |
@@ -2208,9 +2200,9 @@ TEST_F(PortTest, TestCandidateFoundation) { |
SocketAddress kTurnUdpExtAddr2("99.99.98.5", 0); |
TestTurnServer turn_server2( |
rtc::Thread::Current(), kTurnUdpIntAddr2, kTurnUdpExtAddr2); |
- rtc::scoped_ptr<Port> turnport3(CreateTurnPort( |
- kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP, |
- kTurnUdpIntAddr2)); |
+ std::unique_ptr<Port> turnport3( |
+ CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP, |
+ kTurnUdpIntAddr2)); |
turnport3->PrepareAddress(); |
ASSERT_EQ_WAIT(1U, turnport3->Candidates().size(), kTimeout); |
EXPECT_NE(turnport3->Candidates()[0].foundation(), |
@@ -2220,7 +2212,7 @@ TEST_F(PortTest, TestCandidateFoundation) { |
// different foundations if their relay protocols are different. |
TestTurnServer turn_server3(rtc::Thread::Current(), kTurnTcpIntAddr, |
kTurnUdpExtAddr, PROTO_TCP); |
- rtc::scoped_ptr<Port> turnport4( |
+ std::unique_ptr<Port> turnport4( |
CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_TCP, PROTO_UDP)); |
turnport4->PrepareAddress(); |
ASSERT_EQ_WAIT(1U, turnport4->Candidates().size(), kTimeout); |
@@ -2231,16 +2223,16 @@ TEST_F(PortTest, TestCandidateFoundation) { |
// This test verifies the related addresses of different types of |
// ICE candiates. |
TEST_F(PortTest, TestCandidateRelatedAddress) { |
- rtc::scoped_ptr<rtc::NATServer> nat_server( |
+ std::unique_ptr<rtc::NATServer> nat_server( |
CreateNatServer(kNatAddr1, NAT_OPEN_CONE)); |
- rtc::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1)); |
+ std::unique_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1)); |
udpport->PrepareAddress(); |
// For UDPPort, related address will be empty. |
EXPECT_TRUE(udpport->Candidates()[0].related_address().IsNil()); |
// Testing related address for stun candidates. |
// For stun candidate related address must be equal to the base |
// socket address. |
- rtc::scoped_ptr<StunPort> stunport( |
+ std::unique_ptr<StunPort> stunport( |
CreateStunPort(kLocalAddr1, nat_socket_factory1())); |
stunport->PrepareAddress(); |
ASSERT_EQ_WAIT(1U, stunport->Candidates().size(), kTimeout); |
@@ -2253,8 +2245,7 @@ TEST_F(PortTest, TestCandidateRelatedAddress) { |
// Verifying the related address for the GTURN candidates. |
// NOTE: In case of GTURN related address will be equal to the mapped |
// address, but address(mapped) will not be XOR. |
- rtc::scoped_ptr<RelayPort> relayport( |
- CreateGturnPort(kLocalAddr1)); |
+ std::unique_ptr<RelayPort> relayport(CreateGturnPort(kLocalAddr1)); |
relayport->AddServerAddress( |
cricket::ProtocolAddress(kRelayUdpIntAddr, cricket::PROTO_UDP)); |
relayport->PrepareAddress(); |
@@ -2264,8 +2255,8 @@ TEST_F(PortTest, TestCandidateRelatedAddress) { |
relayport->Candidates()[0].related_address()); |
// Verifying the related address for TURN candidate. |
// For TURN related address must be equal to the mapped address. |
- rtc::scoped_ptr<Port> turnport(CreateTurnPort( |
- kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
+ std::unique_ptr<Port> turnport( |
+ CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
turnport->PrepareAddress(); |
ASSERT_EQ_WAIT(1U, turnport->Candidates().size(), kTimeout); |
EXPECT_EQ(kTurnUdpExtAddr.ipaddr(), |
@@ -2285,10 +2276,10 @@ TEST_F(PortTest, TestCandidatePriority) { |
// Test the Connection priority is calculated correctly. |
TEST_F(PortTest, TestConnectionPriority) { |
- rtc::scoped_ptr<TestPort> lport( |
+ std::unique_ptr<TestPort> lport( |
CreateTestPort(kLocalAddr1, "lfrag", "lpass")); |
lport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_HOST); |
- rtc::scoped_ptr<TestPort> rport( |
+ std::unique_ptr<TestPort> rport( |
CreateTestPort(kLocalAddr2, "rfrag", "rpass")); |
rport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_RELAY); |
lport->set_component(123); |
@@ -2428,9 +2419,9 @@ TEST_F(PortTest, TestIceLiteConnectivity) { |
kLocalAddr1, "lfrag", "lpass", |
cricket::ICEROLE_CONTROLLING, kTiebreaker1); |
- rtc::scoped_ptr<TestPort> ice_lite_port(CreateTestPort( |
- kLocalAddr2, "rfrag", "rpass", |
- cricket::ICEROLE_CONTROLLED, kTiebreaker2)); |
+ std::unique_ptr<TestPort> ice_lite_port( |
+ CreateTestPort(kLocalAddr2, "rfrag", "rpass", cricket::ICEROLE_CONTROLLED, |
+ kTiebreaker2)); |
// Setup TestChannel. This behaves like FULL mode client. |
TestChannel ch1(ice_full_port); |
ch1.SetIceMode(ICEMODE_FULL); |
@@ -2462,7 +2453,7 @@ TEST_F(PortTest, TestIceLiteConnectivity) { |
// But we need a connection to send a response message. |
ice_lite_port->CreateConnection( |
ice_full_port->Candidates()[0], cricket::Port::ORIGIN_MESSAGE); |
- rtc::scoped_ptr<IceMessage> request(CopyStunMessage(msg)); |
+ std::unique_ptr<IceMessage> request(CopyStunMessage(msg)); |
ice_lite_port->SendBindingResponse( |
request.get(), ice_full_port->Candidates()[0].address()); |
@@ -2576,21 +2567,21 @@ TEST_F(PortTest, TestControlledToControllingNotDestroyed) { |
} |
TEST_F(PortTest, TestSupportsProtocol) { |
- rtc::scoped_ptr<Port> udp_port(CreateUdpPort(kLocalAddr1)); |
+ std::unique_ptr<Port> udp_port(CreateUdpPort(kLocalAddr1)); |
EXPECT_TRUE(udp_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
EXPECT_FALSE(udp_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |
- rtc::scoped_ptr<Port> stun_port( |
+ std::unique_ptr<Port> stun_port( |
CreateStunPort(kLocalAddr1, nat_socket_factory1())); |
EXPECT_TRUE(stun_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
EXPECT_FALSE(stun_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |
- rtc::scoped_ptr<Port> tcp_port(CreateTcpPort(kLocalAddr1)); |
+ std::unique_ptr<Port> tcp_port(CreateTcpPort(kLocalAddr1)); |
EXPECT_TRUE(tcp_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |
EXPECT_TRUE(tcp_port->SupportsProtocol(SSLTCP_PROTOCOL_NAME)); |
EXPECT_FALSE(tcp_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
- rtc::scoped_ptr<Port> turn_port( |
+ std::unique_ptr<Port> turn_port( |
CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
EXPECT_TRUE(turn_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
EXPECT_FALSE(turn_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |