Replace scoped_ptr with unique_ptr in webrtc/p2p/
But keep #including scoped_ptr.h in .h files, so as not to break WebRTC users who expect those .h files to give them rtc::scoped_ptr. BUG=webrtc:5520 Review URL: https://codereview.webrtc.org/1923163003 Cr-Commit-Position: refs/heads/master@{#12532}
This commit is contained in:
parent
3f032cf688
commit
3ec4679dd2
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/base/asyncstuntcpsocket.h"
|
||||
#include "webrtc/base/asyncsocket.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
@ -122,11 +124,11 @@ class AsyncStunTCPSocketTest : public testing::Test,
|
||||
return ret;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
|
||||
std::unique_ptr<rtc::VirtualSocketServer> vss_;
|
||||
rtc::SocketServerScope ss_scope_;
|
||||
rtc::scoped_ptr<AsyncStunTCPSocket> send_socket_;
|
||||
rtc::scoped_ptr<AsyncStunTCPSocket> recv_socket_;
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> listen_socket_;
|
||||
std::unique_ptr<AsyncStunTCPSocket> send_socket_;
|
||||
std::unique_ptr<AsyncStunTCPSocket> recv_socket_;
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> listen_socket_;
|
||||
std::list<std::string> recv_packets_;
|
||||
};
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/nethelpers.h"
|
||||
#include "webrtc/base/physicalsocketserver.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/socketadapters.h"
|
||||
#include "webrtc/base/ssladapter.h"
|
||||
#include "webrtc/base/thread.h"
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
|
||||
#define WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/base/dtlstransportchannel.h"
|
||||
#include "webrtc/p2p/base/transport.h"
|
||||
|
||||
@ -67,7 +69,7 @@ class DtlsTransport : public Base {
|
||||
if (local_fp) {
|
||||
// Sanity check local fingerprint.
|
||||
if (certificate_) {
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint> local_fp_tmp(
|
||||
std::unique_ptr<rtc::SSLFingerprint> local_fp_tmp(
|
||||
rtc::SSLFingerprint::Create(local_fp->algorithm,
|
||||
certificate_->identity()));
|
||||
ASSERT(local_fp_tmp.get() != NULL);
|
||||
@ -242,7 +244,7 @@ class DtlsTransport : public Base {
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
|
||||
rtc::SSLRole secure_role_;
|
||||
rtc::SSLProtocolVersion ssl_max_version_;
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint_;
|
||||
std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#define WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/base/p2ptransportchannel.h"
|
||||
#include "webrtc/p2p/base/testrelayserver.h"
|
||||
#include "webrtc/p2p/base/teststunserver.h"
|
||||
@ -211,7 +213,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
|
||||
std::string name_; // TODO - Currently not used.
|
||||
std::list<std::string> ch_packets_;
|
||||
rtc::scoped_ptr<cricket::P2PTransportChannel> ch_;
|
||||
std::unique_ptr<cricket::P2PTransportChannel> ch_;
|
||||
};
|
||||
|
||||
struct CandidatesData : public rtc::MessageData {
|
||||
@ -255,7 +257,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
}
|
||||
|
||||
rtc::FakeNetworkManager network_manager_;
|
||||
rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_;
|
||||
std::unique_ptr<cricket::BasicPortAllocator> allocator_;
|
||||
ChannelData cd1_;
|
||||
ChannelData cd2_;
|
||||
cricket::IceRole role_;
|
||||
@ -702,7 +704,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
void OnMessage(rtc::Message* msg) {
|
||||
switch (msg->message_id) {
|
||||
case MSG_ADD_CANDIDATES: {
|
||||
rtc::scoped_ptr<CandidatesData> data(
|
||||
std::unique_ptr<CandidatesData> data(
|
||||
static_cast<CandidatesData*>(msg->pdata));
|
||||
cricket::P2PTransportChannel* rch = GetRemoteChannel(data->channel);
|
||||
for (auto& c : data->candidates) {
|
||||
@ -717,7 +719,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
break;
|
||||
}
|
||||
case MSG_REMOVE_CANDIDATES: {
|
||||
rtc::scoped_ptr<CandidatesData> data(
|
||||
std::unique_ptr<CandidatesData> data(
|
||||
static_cast<CandidatesData*>(msg->pdata));
|
||||
cricket::P2PTransportChannel* rch = GetRemoteChannel(data->channel);
|
||||
for (cricket::Candidate& c : data->candidates) {
|
||||
@ -797,12 +799,12 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
|
||||
private:
|
||||
rtc::Thread* main_;
|
||||
rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
|
||||
rtc::scoped_ptr<rtc::NATSocketServer> nss_;
|
||||
rtc::scoped_ptr<rtc::FirewallSocketServer> ss_;
|
||||
std::unique_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
std::unique_ptr<rtc::VirtualSocketServer> vss_;
|
||||
std::unique_ptr<rtc::NATSocketServer> nss_;
|
||||
std::unique_ptr<rtc::FirewallSocketServer> ss_;
|
||||
rtc::SocketServerScope ss_scope_;
|
||||
rtc::scoped_ptr<cricket::TestStunServer> stun_server_;
|
||||
std::unique_ptr<cricket::TestStunServer> stun_server_;
|
||||
cricket::TestTurnServer turn_server_;
|
||||
cricket::TestRelayServer relay_server_;
|
||||
rtc::SocksProxyServer socks_server1_;
|
||||
@ -1994,8 +1996,8 @@ class P2PTransportChannelPingTest : public testing::Test,
|
||||
void reset_channel_ready_to_send() { channel_ready_to_send_ = false; }
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
|
||||
std::unique_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
std::unique_ptr<rtc::VirtualSocketServer> vss_;
|
||||
rtc::SocketServerScope ss_scope_;
|
||||
cricket::CandidatePairInterface* last_selected_candidate_pair_ = nullptr;
|
||||
int last_sent_packet_id_ = -1;
|
||||
@ -2640,10 +2642,10 @@ class P2PTransportChannelMostLikelyToWorkFirstTest
|
||||
}
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_;
|
||||
std::unique_ptr<cricket::BasicPortAllocator> allocator_;
|
||||
rtc::FakeNetworkManager network_manager_;
|
||||
cricket::TestTurnServer turn_server_;
|
||||
rtc::scoped_ptr<cricket::P2PTransportChannel> channel_;
|
||||
std::unique_ptr<cricket::P2PTransportChannel> channel_;
|
||||
};
|
||||
|
||||
// Test that Relay/Relay connections will be pinged first when no other
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/messagedigest.h"
|
||||
#include "webrtc/base/network.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/stringencode.h"
|
||||
#include "webrtc/base/stringutils.h"
|
||||
|
||||
@ -278,7 +277,7 @@ void Port::OnReadPacket(
|
||||
|
||||
// If this is an authenticated STUN request, then signal unknown address and
|
||||
// send back a proper binding response.
|
||||
rtc::scoped_ptr<IceMessage> msg;
|
||||
std::unique_ptr<IceMessage> msg;
|
||||
std::string remote_username;
|
||||
if (!GetStunMessage(data, size, addr, &msg, &remote_username)) {
|
||||
LOG_J(LS_ERROR, this) << "Received non-STUN packet from unknown address ("
|
||||
@ -325,7 +324,7 @@ size_t Port::AddPrflxCandidate(const Candidate& local) {
|
||||
bool Port::GetStunMessage(const char* data,
|
||||
size_t size,
|
||||
const rtc::SocketAddress& addr,
|
||||
rtc::scoped_ptr<IceMessage>* out_msg,
|
||||
std::unique_ptr<IceMessage>* out_msg,
|
||||
std::string* out_username) {
|
||||
// NOTE: This could clearly be optimized to avoid allocating any memory.
|
||||
// However, at the data rates we'll be looking at on the client side,
|
||||
@ -342,7 +341,7 @@ bool Port::GetStunMessage(const char* data,
|
||||
|
||||
// Parse the request message. If the packet is not a complete and correct
|
||||
// STUN message, then ignore it.
|
||||
rtc::scoped_ptr<IceMessage> stun_msg(new IceMessage());
|
||||
std::unique_ptr<IceMessage> stun_msg(new IceMessage());
|
||||
rtc::ByteBufferReader buf(data, size);
|
||||
if (!stun_msg->Read(&buf) || (buf.Length() > 0)) {
|
||||
return false;
|
||||
@ -895,7 +894,7 @@ void Connection::OnSendStunPacket(const void* data, size_t size,
|
||||
|
||||
void Connection::OnReadPacket(
|
||||
const char* data, size_t size, const rtc::PacketTime& packet_time) {
|
||||
rtc::scoped_ptr<IceMessage> msg;
|
||||
std::unique_ptr<IceMessage> msg;
|
||||
std::string remote_ufrag;
|
||||
const rtc::SocketAddress& addr(remote_candidate_.address());
|
||||
if (!port_->GetStunMessage(data, size, addr, &msg, &remote_ufrag)) {
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#define WEBRTC_P2P_BASE_PORT_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -336,7 +337,7 @@ class Port : public PortInterface, public rtc::MessageHandler,
|
||||
bool GetStunMessage(const char* data,
|
||||
size_t size,
|
||||
const rtc::SocketAddress& addr,
|
||||
rtc::scoped_ptr<IceMessage>* out_msg,
|
||||
std::unique_ptr<IceMessage>* out_msg,
|
||||
std::string* out_username);
|
||||
|
||||
// Checks if the address in addr is compatible with the port's ip.
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "webrtc/base/arraysize.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "webrtc/base/byteorder.h"
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/socket.h"
|
||||
#include "webrtc/base/stringutils.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
@ -518,7 +518,7 @@ IPseudoTcpNotify::WriteResult PseudoTcp::packet(uint32_t seq,
|
||||
|
||||
uint32_t now = Now();
|
||||
|
||||
rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[MAX_PACKET]);
|
||||
std::unique_ptr<uint8_t[]> buffer(new uint8_t[MAX_PACKET]);
|
||||
long_to_bytes(m_conv, buffer.get());
|
||||
long_to_bytes(seq, buffer.get() + 4);
|
||||
long_to_bytes(m_rcv_nxt, buffer.get() + 8);
|
||||
|
||||
@ -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/relayserver.h"
|
||||
@ -15,7 +17,6 @@
|
||||
#include "webrtc/base/helpers.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/physicalsocketserver.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/socketadapters.h"
|
||||
#include "webrtc/base/socketaddress.h"
|
||||
#include "webrtc/base/ssladapter.h"
|
||||
@ -179,7 +180,7 @@ class RelayPortTest : public testing::Test,
|
||||
|
||||
// Create a tcp server socket that listens on the fake address so
|
||||
// the relay port can attempt to connect to it.
|
||||
rtc::scoped_ptr<rtc::AsyncSocket> tcp_server_socket(
|
||||
std::unique_ptr<rtc::AsyncSocket> tcp_server_socket(
|
||||
CreateServerSocket(kRelayTcpAddr));
|
||||
|
||||
// Add server addresses to the relay port and let it start.
|
||||
@ -244,16 +245,15 @@ class RelayPortTest : public testing::Test,
|
||||
typedef std::map<rtc::AsyncPacketSocket*, int> PacketMap;
|
||||
|
||||
rtc::Thread* main_;
|
||||
rtc::scoped_ptr<rtc::PhysicalSocketServer>
|
||||
physical_socket_server_;
|
||||
rtc::scoped_ptr<rtc::VirtualSocketServer> virtual_socket_server_;
|
||||
std::unique_ptr<rtc::PhysicalSocketServer> physical_socket_server_;
|
||||
std::unique_ptr<rtc::VirtualSocketServer> virtual_socket_server_;
|
||||
rtc::SocketServerScope ss_scope_;
|
||||
rtc::Network network_;
|
||||
rtc::BasicPacketSocketFactory socket_factory_;
|
||||
std::string username_;
|
||||
std::string password_;
|
||||
rtc::scoped_ptr<cricket::RelayPort> relay_port_;
|
||||
rtc::scoped_ptr<cricket::RelayServer> relay_server_;
|
||||
std::unique_ptr<cricket::RelayPort> relay_port_;
|
||||
std::unique_ptr<cricket::RelayServer> relay_server_;
|
||||
std::vector<cricket::ProtocolAddress> failed_connections_;
|
||||
std::vector<cricket::ProtocolAddress> soft_timedout_connections_;
|
||||
PacketMap received_packet_count_;
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/p2p/base/relayserver.h"
|
||||
@ -60,16 +61,14 @@ class RelayServerTest : public testing::Test {
|
||||
}
|
||||
|
||||
void Allocate() {
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_ALLOCATE_REQUEST));
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_ALLOCATE_REQUEST));
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
AddLifetimeAttr(req.get(), LIFETIME);
|
||||
Send1(req.get());
|
||||
delete Receive1();
|
||||
}
|
||||
void Bind() {
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_BINDING_REQUEST));
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_BINDING_REQUEST));
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
Send2(req.get());
|
||||
delete Receive1();
|
||||
@ -172,12 +171,12 @@ class RelayServerTest : public testing::Test {
|
||||
msg->AddAttribute(attr);
|
||||
}
|
||||
|
||||
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::scoped_ptr<RelayServer> server_;
|
||||
rtc::scoped_ptr<rtc::TestClient> client1_;
|
||||
rtc::scoped_ptr<rtc::TestClient> client2_;
|
||||
std::unique_ptr<RelayServer> server_;
|
||||
std::unique_ptr<rtc::TestClient> client1_;
|
||||
std::unique_ptr<rtc::TestClient> client2_;
|
||||
std::string username_;
|
||||
std::string password_;
|
||||
};
|
||||
@ -190,8 +189,8 @@ TEST_F(RelayServerTest, TestBadRequest) {
|
||||
|
||||
// Send an allocate request without a username and verify it is rejected.
|
||||
TEST_F(RelayServerTest, TestAllocateNoUsername) {
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_ALLOCATE_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_ALLOCATE_REQUEST)),
|
||||
res;
|
||||
|
||||
Send1(req.get());
|
||||
res.reset(Receive1());
|
||||
@ -209,8 +208,8 @@ TEST_F(RelayServerTest, TestAllocateNoUsername) {
|
||||
|
||||
// Send a binding request and verify that it is rejected.
|
||||
TEST_F(RelayServerTest, TestBindingRequest) {
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_BINDING_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_BINDING_REQUEST)),
|
||||
res;
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
|
||||
Send1(req.get());
|
||||
@ -229,8 +228,8 @@ TEST_F(RelayServerTest, TestBindingRequest) {
|
||||
|
||||
// Send an allocate request and verify that it is accepted.
|
||||
TEST_F(RelayServerTest, TestAllocate) {
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_ALLOCATE_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_ALLOCATE_REQUEST)),
|
||||
res;
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
AddLifetimeAttr(req.get(), LIFETIME);
|
||||
|
||||
@ -259,8 +258,8 @@ TEST_F(RelayServerTest, TestAllocate) {
|
||||
TEST_F(RelayServerTest, TestReallocate) {
|
||||
Allocate();
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_ALLOCATE_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_ALLOCATE_REQUEST)),
|
||||
res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
|
||||
@ -289,8 +288,8 @@ TEST_F(RelayServerTest, TestReallocate) {
|
||||
TEST_F(RelayServerTest, TestRemoteBind) {
|
||||
Allocate();
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_BINDING_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_BINDING_REQUEST)),
|
||||
res;
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
|
||||
Send2(req.get());
|
||||
@ -304,7 +303,7 @@ TEST_F(RelayServerTest, TestRemoteBind) {
|
||||
ASSERT_TRUE(recv_data != NULL);
|
||||
|
||||
rtc::ByteBufferReader buf(recv_data->bytes(), recv_data->length());
|
||||
rtc::scoped_ptr<StunMessage> res2(new StunMessage());
|
||||
std::unique_ptr<StunMessage> res2(new StunMessage());
|
||||
EXPECT_TRUE(res2->Read(&buf));
|
||||
EXPECT_EQ(STUN_BINDING_REQUEST, res2->type());
|
||||
EXPECT_EQ(req->transaction_id(), res2->transaction_id());
|
||||
@ -335,8 +334,7 @@ TEST_F(RelayServerTest, TestSendRequestMissingUsername) {
|
||||
Allocate();
|
||||
Bind();
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
|
||||
Send1(req.get());
|
||||
@ -358,8 +356,7 @@ TEST_F(RelayServerTest, TestSendRequestBadUsername) {
|
||||
Allocate();
|
||||
Bind();
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
AddUsernameAttr(req.get(), "foobarbizbaz");
|
||||
|
||||
@ -383,8 +380,7 @@ TEST_F(RelayServerTest, TestSendRequestNoDestinationAddress) {
|
||||
Allocate();
|
||||
Bind();
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
|
||||
@ -407,8 +403,7 @@ TEST_F(RelayServerTest, TestSendRequestNoData) {
|
||||
Allocate();
|
||||
Bind();
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
AddDestinationAttr(req.get(), client2_addr);
|
||||
@ -432,8 +427,8 @@ TEST_F(RelayServerTest, TestSendRequestWrongType) {
|
||||
Allocate();
|
||||
Bind();
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_BINDING_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_BINDING_REQUEST)),
|
||||
res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
|
||||
@ -458,8 +453,7 @@ TEST_F(RelayServerTest, TestSendRaw) {
|
||||
Bind();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
AddDestinationAttr(req.get(), client2_addr);
|
||||
@ -501,8 +495,7 @@ TEST_F(RelayServerTest, DISABLED_TestExpiration) {
|
||||
// Wait twice the lifetime to make sure the server has expired the binding.
|
||||
rtc::Thread::Current()->ProcessMessages((LIFETIME * 2) * 1000);
|
||||
|
||||
rtc::scoped_ptr<StunMessage> req(
|
||||
CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
std::unique_ptr<StunMessage> req(CreateStunMessage(STUN_SEND_REQUEST)), res;
|
||||
AddMagicCookieAttr(req.get());
|
||||
AddUsernameAttr(req.get(), username_);
|
||||
AddDestinationAttr(req.get(), client2_addr);
|
||||
|
||||
@ -12,12 +12,13 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/byteorder.h"
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/base/crc32.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/messagedigest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/stringencode.h"
|
||||
|
||||
using rtc::ByteBufferReader;
|
||||
@ -173,7 +174,7 @@ bool StunMessage::ValidateMessageIntegrity(const char* data, size_t size,
|
||||
|
||||
// Getting length of the message to calculate Message Integrity.
|
||||
size_t mi_pos = current_pos;
|
||||
rtc::scoped_ptr<char[]> temp_data(new char[current_pos]);
|
||||
std::unique_ptr<char[]> temp_data(new char[current_pos]);
|
||||
memcpy(temp_data.get(), data, current_pos);
|
||||
if (size > mi_pos + kStunAttributeHeaderSize + kStunMessageIntegritySize) {
|
||||
// Stun message has other attributes after message integrity.
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/messagedigest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/socketaddress.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef WEBRTC_P2P_BASE_STUNPORT_H_
|
||||
#define WEBRTC_P2P_BASE_STUNPORT_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/p2p/base/port.h"
|
||||
@ -224,7 +225,7 @@ class UDPPort : public Port {
|
||||
StunRequestManager requests_;
|
||||
rtc::AsyncPacketSocket* socket_;
|
||||
int error_;
|
||||
rtc::scoped_ptr<AddressResolver> resolver_;
|
||||
std::unique_ptr<AddressResolver> resolver_;
|
||||
bool ready_;
|
||||
int stun_keepalive_delay_;
|
||||
int stun_keepalive_lifetime_;
|
||||
|
||||
@ -8,13 +8,14 @@
|
||||
* 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/stunport.h"
|
||||
#include "webrtc/p2p/base/teststunserver.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/helpers.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/virtualsocketserver.h"
|
||||
@ -155,15 +156,15 @@ class StunPortTest : public testing::Test,
|
||||
}
|
||||
|
||||
private:
|
||||
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<cricket::UDPPort> stun_port_;
|
||||
rtc::scoped_ptr<cricket::TestStunServer> stun_server_1_;
|
||||
rtc::scoped_ptr<cricket::TestStunServer> stun_server_2_;
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
std::unique_ptr<cricket::UDPPort> stun_port_;
|
||||
std::unique_ptr<cricket::TestStunServer> stun_server_1_;
|
||||
std::unique_ptr<cricket::TestStunServer> stun_server_2_;
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
bool done_;
|
||||
bool error_;
|
||||
int stun_keepalive_delay_;
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include "webrtc/p2p/base/stunrequest.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/base/helpers.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
@ -139,7 +141,7 @@ bool StunRequestManager::CheckResponse(const char* data, size_t size) {
|
||||
// Parse the STUN message and continue processing as usual.
|
||||
|
||||
rtc::ByteBufferReader buf(data, size);
|
||||
rtc::scoped_ptr<StunMessage> response(iter->second->msg_->CreateNew());
|
||||
std::unique_ptr<StunMessage> response(iter->second->msg_->CreateNew());
|
||||
if (!response->Read(&buf)) {
|
||||
LOG(LS_WARNING) << "Failed to read STUN response " << rtc::hex_encode(id);
|
||||
return false;
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_P2P_BASE_STUNSERVER_H_
|
||||
#define WEBRTC_P2P_BASE_STUNSERVER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/base/stun.h"
|
||||
#include "webrtc/base/asyncudpsocket.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
@ -58,7 +60,7 @@ class StunServer : public sigslot::has_slots<> {
|
||||
StunMessage* response) const;
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<rtc::AsyncUDPSocket> socket_;
|
||||
std::unique_ptr<rtc::AsyncUDPSocket> socket_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/p2p/base/stunserver.h"
|
||||
@ -62,11 +63,11 @@ class StunServerTest : public testing::Test {
|
||||
return msg;
|
||||
}
|
||||
private:
|
||||
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::Thread worker_;
|
||||
rtc::scoped_ptr<StunServer> server_;
|
||||
rtc::scoped_ptr<rtc::TestClient> client_;
|
||||
std::unique_ptr<StunServer> server_;
|
||||
std::unique_ptr<rtc::TestClient> client_;
|
||||
};
|
||||
|
||||
// Disable for TSan v2, see
|
||||
|
||||
@ -12,7 +12,9 @@
|
||||
#define WEBRTC_P2P_BASE_TCPPORT_H_
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/p2p/base/port.h"
|
||||
#include "webrtc/base/asyncpacketsocket.h"
|
||||
|
||||
@ -164,7 +166,7 @@ class TCPConnection : public Connection {
|
||||
const rtc::PacketTime& packet_time);
|
||||
void OnReadyToSend(rtc::AsyncPacketSocket* socket);
|
||||
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
int error_;
|
||||
bool outgoing_;
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_P2P_BASE_TESTRELAYSERVER_H_
|
||||
#define WEBRTC_P2P_BASE_TESTRELAYSERVER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/base/relayserver.h"
|
||||
#include "webrtc/base/asynctcpsocket.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
@ -90,10 +92,10 @@ class TestRelayServer : public sigslot::has_slots<> {
|
||||
}
|
||||
private:
|
||||
cricket::RelayServer server_;
|
||||
rtc::scoped_ptr<rtc::AsyncSocket> tcp_int_socket_;
|
||||
rtc::scoped_ptr<rtc::AsyncSocket> tcp_ext_socket_;
|
||||
rtc::scoped_ptr<rtc::AsyncSocket> ssl_int_socket_;
|
||||
rtc::scoped_ptr<rtc::AsyncSocket> ssl_ext_socket_;
|
||||
std::unique_ptr<rtc::AsyncSocket> tcp_int_socket_;
|
||||
std::unique_ptr<rtc::AsyncSocket> tcp_ext_socket_;
|
||||
std::unique_ptr<rtc::AsyncSocket> ssl_int_socket_;
|
||||
std::unique_ptr<rtc::AsyncSocket> ssl_ext_socket_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/fakesslidentity.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/network.h"
|
||||
@ -50,7 +52,7 @@ class TransportTest : public testing::Test,
|
||||
}
|
||||
|
||||
protected:
|
||||
rtc::scoped_ptr<FakeTransport> transport_;
|
||||
std::unique_ptr<FakeTransport> transport_;
|
||||
FakeTransportChannel* channel_;
|
||||
};
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#define WEBRTC_P2P_BASE_TRANSPORTDESCRIPTION_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -139,7 +140,7 @@ struct TransportDescription {
|
||||
IceMode ice_mode;
|
||||
ConnectionRole connection_role;
|
||||
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint> identity_fingerprint;
|
||||
std::unique_ptr<rtc::SSLFingerprint> identity_fingerprint;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/p2p/base/transportdescriptionfactory.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/base/transportdescription.h"
|
||||
#include "webrtc/base/helpers.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
@ -25,7 +27,7 @@ TransportDescriptionFactory::TransportDescriptionFactory()
|
||||
TransportDescription* TransportDescriptionFactory::CreateOffer(
|
||||
const TransportOptions& options,
|
||||
const TransportDescription* current_description) const {
|
||||
rtc::scoped_ptr<TransportDescription> desc(new TransportDescription());
|
||||
std::unique_ptr<TransportDescription> desc(new TransportDescription());
|
||||
|
||||
// Generate the ICE credentials if we don't already have them.
|
||||
if (!current_description || options.ice_restart) {
|
||||
@ -59,7 +61,7 @@ TransportDescription* TransportDescriptionFactory::CreateAnswer(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<TransportDescription> desc(new TransportDescription());
|
||||
std::unique_ptr<TransportDescription> desc(new TransportDescription());
|
||||
// Generate the ICE credentials if we don't already have them or ice is
|
||||
// being restarted.
|
||||
if (!current_description || options.ice_restart) {
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/base/basicpacketsocketfactory.h"
|
||||
#include "webrtc/p2p/base/p2pconstants.h"
|
||||
#include "webrtc/p2p/base/portallocator.h"
|
||||
@ -26,7 +28,6 @@
|
||||
#include "webrtc/base/helpers.h"
|
||||
#include "webrtc/base/logging.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/thread.h"
|
||||
@ -507,15 +508,15 @@ class TurnPortTest : public testing::Test,
|
||||
|
||||
protected:
|
||||
rtc::Thread* main_;
|
||||
rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
rtc::scoped_ptr<TurnPortTestVirtualSocketServer> ss_;
|
||||
std::unique_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
std::unique_ptr<TurnPortTestVirtualSocketServer> ss_;
|
||||
rtc::SocketServerScope ss_scope_;
|
||||
rtc::Network network_;
|
||||
rtc::BasicPacketSocketFactory socket_factory_;
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
cricket::TestTurnServer turn_server_;
|
||||
rtc::scoped_ptr<TurnPort> turn_port_;
|
||||
rtc::scoped_ptr<UDPPort> udp_port_;
|
||||
std::unique_ptr<TurnPort> turn_port_;
|
||||
std::unique_ptr<UDPPort> udp_port_;
|
||||
bool turn_ready_;
|
||||
bool turn_error_;
|
||||
bool turn_unknown_address_;
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
@ -125,7 +126,7 @@ class TurnServerAllocation : public rtc::MessageHandler,
|
||||
TurnServer* server_;
|
||||
rtc::Thread* thread_;
|
||||
TurnServerConnection conn_;
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> external_socket_;
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> external_socket_;
|
||||
std::string key_;
|
||||
std::string transaction_id_;
|
||||
std::string username_;
|
||||
@ -269,8 +270,7 @@ class TurnServer : public sigslot::has_slots<> {
|
||||
|
||||
InternalSocketMap server_sockets_;
|
||||
ServerSocketMap server_listen_sockets_;
|
||||
rtc::scoped_ptr<rtc::PacketSocketFactory>
|
||||
external_socket_factory_;
|
||||
std::unique_ptr<rtc::PacketSocketFactory> external_socket_factory_;
|
||||
rtc::SocketAddress external_addr_;
|
||||
|
||||
AllocationMap allocations_;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
|
||||
#define WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -185,7 +186,7 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
|
||||
|
||||
BasicPortAllocator* allocator_;
|
||||
rtc::Thread* network_thread_;
|
||||
rtc::scoped_ptr<rtc::PacketSocketFactory> owned_socket_factory_;
|
||||
std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_;
|
||||
rtc::PacketSocketFactory* socket_factory_;
|
||||
bool allocation_started_;
|
||||
bool network_manager_started_;
|
||||
@ -320,7 +321,7 @@ class AllocationSequence : public rtc::MessageHandler,
|
||||
State state_;
|
||||
uint32_t flags_;
|
||||
ProtocolList protocols_;
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> udp_socket_;
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_;
|
||||
// There will be only one udp port per AllocationSequence.
|
||||
UDPPort* udp_port_;
|
||||
std::vector<TurnPort*> turn_ports_;
|
||||
|
||||
@ -11,7 +11,9 @@
|
||||
#ifndef WEBRTC_P2P_CLIENT_FAKEPORTALLOCATOR_H_
|
||||
#define WEBRTC_P2P_CLIENT_FAKEPORTALLOCATOR_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/p2p/base/basicpacketsocketfactory.h"
|
||||
#include "webrtc/p2p/base/portallocator.h"
|
||||
#include "webrtc/p2p/base/udpport.h"
|
||||
@ -133,7 +135,7 @@ class FakePortAllocatorSession : public PortAllocatorSession {
|
||||
rtc::Thread* worker_thread_;
|
||||
rtc::PacketSocketFactory* factory_;
|
||||
rtc::Network network_;
|
||||
rtc::scoped_ptr<cricket::Port> port_;
|
||||
std::unique_ptr<cricket::Port> port_;
|
||||
bool running_;
|
||||
int port_config_count_;
|
||||
};
|
||||
@ -177,7 +179,7 @@ class FakePortAllocator : public cricket::PortAllocator {
|
||||
private:
|
||||
rtc::Thread* worker_thread_;
|
||||
rtc::PacketSocketFactory* factory_;
|
||||
rtc::scoped_ptr<rtc::BasicPacketSocketFactory> owned_factory_;
|
||||
std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_;
|
||||
ServerAddresses stun_servers_;
|
||||
std::vector<RelayServerConfig> turn_servers_;
|
||||
};
|
||||
|
||||
@ -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/p2pconstants.h"
|
||||
#include "webrtc/p2p/base/p2ptransportchannel.h"
|
||||
@ -370,19 +372,19 @@ class PortAllocatorTest : public testing::Test, public sigslot::has_slots<> {
|
||||
allocator().set_step_delay(cricket::kMinimumStepDelay);
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
|
||||
rtc::scoped_ptr<rtc::FirewallSocketServer> fss_;
|
||||
std::unique_ptr<rtc::PhysicalSocketServer> pss_;
|
||||
std::unique_ptr<rtc::VirtualSocketServer> vss_;
|
||||
std::unique_ptr<rtc::FirewallSocketServer> fss_;
|
||||
rtc::SocketServerScope ss_scope_;
|
||||
rtc::scoped_ptr<rtc::NATServer> nat_server_;
|
||||
std::unique_ptr<rtc::NATServer> nat_server_;
|
||||
rtc::NATSocketFactory nat_factory_;
|
||||
rtc::scoped_ptr<rtc::BasicPacketSocketFactory> nat_socket_factory_;
|
||||
rtc::scoped_ptr<cricket::TestStunServer> stun_server_;
|
||||
std::unique_ptr<rtc::BasicPacketSocketFactory> nat_socket_factory_;
|
||||
std::unique_ptr<cricket::TestStunServer> stun_server_;
|
||||
cricket::TestRelayServer relay_server_;
|
||||
cricket::TestTurnServer turn_server_;
|
||||
rtc::FakeNetworkManager network_manager_;
|
||||
rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_;
|
||||
rtc::scoped_ptr<cricket::PortAllocatorSession> session_;
|
||||
std::unique_ptr<cricket::BasicPortAllocator> allocator_;
|
||||
std::unique_ptr<cricket::PortAllocatorSession> session_;
|
||||
std::vector<cricket::PortInterface*> ports_;
|
||||
std::vector<cricket::Candidate> candidates_;
|
||||
bool candidate_allocation_done_;
|
||||
|
||||
@ -8,11 +8,12 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/p2p/quic/quicconnectionhelper.h"
|
||||
|
||||
#include "net/quic/quic_time.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
|
||||
using cricket::QuicAlarm;
|
||||
using cricket::QuicConnectionHelper;
|
||||
@ -89,7 +90,7 @@ class QuicAlarmTest : public ::testing::Test {
|
||||
// Used for setting clock time relative to alarm.
|
||||
MockClock clock_;
|
||||
|
||||
rtc::scoped_ptr<QuicAlarm> alarm_;
|
||||
std::unique_ptr<QuicAlarm> alarm_;
|
||||
};
|
||||
|
||||
// Test that the alarm is fired.
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
namespace cricket {
|
||||
|
||||
QuicSession::QuicSession(rtc::scoped_ptr<net::QuicConnection> connection,
|
||||
QuicSession::QuicSession(std::unique_ptr<net::QuicConnection> connection,
|
||||
const net::QuicConfig& config)
|
||||
: net::QuicSession(connection.release(), config) {}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef WEBRTC_P2P_QUIC_QUICSESSION_H_
|
||||
#define WEBRTC_P2P_QUIC_QUICSESSION_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "net/quic/quic_crypto_client_stream.h"
|
||||
@ -29,7 +30,7 @@ namespace cricket {
|
||||
// reading/writing of data using QUIC packets.
|
||||
class QuicSession : public net::QuicSession, public sigslot::has_slots<> {
|
||||
public:
|
||||
QuicSession(rtc::scoped_ptr<net::QuicConnection> connection,
|
||||
QuicSession(std::unique_ptr<net::QuicConnection> connection,
|
||||
const net::QuicConfig& config);
|
||||
~QuicSession() override;
|
||||
|
||||
@ -82,7 +83,7 @@ class QuicSession : public net::QuicSession, public sigslot::has_slots<> {
|
||||
virtual ReliableQuicStream* CreateDataStream(net::QuicStreamId id);
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<net::QuicCryptoStream> crypto_stream_;
|
||||
std::unique_ptr<net::QuicCryptoStream> crypto_stream_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(QuicSession);
|
||||
};
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include "webrtc/p2p/quic/quicsession.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -117,7 +118,7 @@ class FakeProofVerifier : public net::ProofVerifier {
|
||||
const std::string& signature,
|
||||
const net::ProofVerifyContext* verify_context,
|
||||
std::string* error_details,
|
||||
scoped_ptr<net::ProofVerifyDetails>* verify_details,
|
||||
std::unique_ptr<net::ProofVerifyDetails>* verify_details,
|
||||
net::ProofVerifierCallback* callback) override {
|
||||
return success_ ? net::QUIC_SUCCESS : net::QUIC_FAILURE;
|
||||
}
|
||||
@ -179,9 +180,9 @@ class FakeQuicPacketWriter : public QuicPacketWriter {
|
||||
// Wrapper for QuicSession and transport channel that stores incoming data.
|
||||
class QuicSessionForTest : public QuicSession {
|
||||
public:
|
||||
QuicSessionForTest(rtc::scoped_ptr<net::QuicConnection> connection,
|
||||
QuicSessionForTest(std::unique_ptr<net::QuicConnection> connection,
|
||||
const net::QuicConfig& config,
|
||||
rtc::scoped_ptr<FakeTransportChannel> channel)
|
||||
std::unique_ptr<FakeTransportChannel> channel)
|
||||
: QuicSession(std::move(connection), config),
|
||||
channel_(std::move(channel)) {
|
||||
channel_->SignalReadPacket.connect(
|
||||
@ -219,7 +220,7 @@ class QuicSessionForTest : public QuicSession {
|
||||
|
||||
private:
|
||||
// Transports QUIC packets to/from peer.
|
||||
rtc::scoped_ptr<FakeTransportChannel> channel_;
|
||||
std::unique_ptr<FakeTransportChannel> channel_;
|
||||
// Stores data received by peer once it is sent from the other peer.
|
||||
std::string last_received_data_;
|
||||
// Handles incoming streams from sender.
|
||||
@ -235,8 +236,8 @@ class QuicSessionTest : public ::testing::Test,
|
||||
// Instantiates |client_peer_| and |server_peer_|.
|
||||
void CreateClientAndServerSessions();
|
||||
|
||||
rtc::scoped_ptr<QuicSessionForTest> CreateSession(
|
||||
rtc::scoped_ptr<FakeTransportChannel> channel,
|
||||
std::unique_ptr<QuicSessionForTest> CreateSession(
|
||||
std::unique_ptr<FakeTransportChannel> channel,
|
||||
Perspective perspective);
|
||||
|
||||
QuicCryptoClientStream* CreateCryptoClientStream(QuicSessionForTest* session,
|
||||
@ -244,7 +245,7 @@ class QuicSessionTest : public ::testing::Test,
|
||||
QuicCryptoServerStream* CreateCryptoServerStream(QuicSessionForTest* session,
|
||||
bool handshake_success);
|
||||
|
||||
rtc::scoped_ptr<QuicConnection> CreateConnection(
|
||||
std::unique_ptr<QuicConnection> CreateConnection(
|
||||
FakeTransportChannel* channel,
|
||||
Perspective perspective);
|
||||
|
||||
@ -268,16 +269,16 @@ class QuicSessionTest : public ::testing::Test,
|
||||
QuicConfig config_;
|
||||
QuicClock clock_;
|
||||
|
||||
rtc::scoped_ptr<QuicSessionForTest> client_peer_;
|
||||
rtc::scoped_ptr<QuicSessionForTest> server_peer_;
|
||||
std::unique_ptr<QuicSessionForTest> client_peer_;
|
||||
std::unique_ptr<QuicSessionForTest> server_peer_;
|
||||
};
|
||||
|
||||
// Initializes "client peer" who begins crypto handshake and "server peer" who
|
||||
// establishes encryption with client.
|
||||
void QuicSessionTest::CreateClientAndServerSessions() {
|
||||
rtc::scoped_ptr<FakeTransportChannel> channel1(
|
||||
std::unique_ptr<FakeTransportChannel> channel1(
|
||||
new FakeTransportChannel("channel1", 0));
|
||||
rtc::scoped_ptr<FakeTransportChannel> channel2(
|
||||
std::unique_ptr<FakeTransportChannel> channel2(
|
||||
new FakeTransportChannel("channel2", 0));
|
||||
|
||||
// Prevent channel1->OnReadPacket and channel2->OnReadPacket from calling
|
||||
@ -294,12 +295,12 @@ void QuicSessionTest::CreateClientAndServerSessions() {
|
||||
server_peer_ = CreateSession(std::move(channel2), Perspective::IS_SERVER);
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<QuicSessionForTest> QuicSessionTest::CreateSession(
|
||||
rtc::scoped_ptr<FakeTransportChannel> channel,
|
||||
std::unique_ptr<QuicSessionForTest> QuicSessionTest::CreateSession(
|
||||
std::unique_ptr<FakeTransportChannel> channel,
|
||||
Perspective perspective) {
|
||||
rtc::scoped_ptr<QuicConnection> quic_connection =
|
||||
std::unique_ptr<QuicConnection> quic_connection =
|
||||
CreateConnection(channel.get(), perspective);
|
||||
return rtc::scoped_ptr<QuicSessionForTest>(new QuicSessionForTest(
|
||||
return std::unique_ptr<QuicSessionForTest>(new QuicSessionForTest(
|
||||
std::move(quic_connection), config_, std::move(channel)));
|
||||
}
|
||||
|
||||
@ -326,7 +327,7 @@ QuicCryptoServerStream* QuicSessionTest::CreateCryptoServerStream(
|
||||
return new QuicCryptoServerStream(server_config, session);
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<QuicConnection> QuicSessionTest::CreateConnection(
|
||||
std::unique_ptr<QuicConnection> QuicSessionTest::CreateConnection(
|
||||
FakeTransportChannel* channel,
|
||||
Perspective perspective) {
|
||||
FakeQuicPacketWriter* writer = new FakeQuicPacketWriter(channel);
|
||||
@ -334,7 +335,7 @@ rtc::scoped_ptr<QuicConnection> QuicSessionTest::CreateConnection(
|
||||
IPAddress ip(0, 0, 0, 0);
|
||||
bool owns_writer = true;
|
||||
|
||||
return rtc::scoped_ptr<QuicConnection>(new QuicConnection(
|
||||
return std::unique_ptr<QuicConnection>(new QuicConnection(
|
||||
0, net::IPEndPoint(ip, 0), &quic_helper_, writer, owns_writer,
|
||||
perspective, net::QuicSupportedVersions()));
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ class InsecureProofVerifier : public net::ProofVerifier {
|
||||
const std::string& signature,
|
||||
const net::ProofVerifyContext* verify_context,
|
||||
std::string* error_details,
|
||||
scoped_ptr<net::ProofVerifyDetails>* verify_details,
|
||||
std::unique_ptr<net::ProofVerifyDetails>* verify_details,
|
||||
net::ProofVerifierCallback* callback) override {
|
||||
LOG(LS_INFO) << "VerifyProof() ignoring credentials and returning success";
|
||||
return net::QUIC_SUCCESS;
|
||||
@ -435,7 +435,7 @@ bool QuicTransportChannel::CreateQuicSession() {
|
||||
? net::Perspective::IS_CLIENT
|
||||
: net::Perspective::IS_SERVER;
|
||||
bool owns_writer = false;
|
||||
rtc::scoped_ptr<net::QuicConnection> connection(new net::QuicConnection(
|
||||
std::unique_ptr<net::QuicConnection> connection(new net::QuicConnection(
|
||||
kConnectionId, kConnectionIpEndpoint, &helper_, this, owns_writer,
|
||||
perspective, net::QuicSupportedVersions()));
|
||||
quic_.reset(new QuicSession(std::move(connection), config_));
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef WEBRTC_P2P_QUIC_QUICTRANSPORTCHANNEL_H_
|
||||
#define WEBRTC_P2P_QUIC_QUICTRANSPORTCHANNEL_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -117,7 +118,7 @@ class QuicTransportChannel : public TransportChannelImpl,
|
||||
size_t result_len) override;
|
||||
// TODO(mikescarlett): Remove this method once TransportChannel does not
|
||||
// require defining it.
|
||||
rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate()
|
||||
std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate()
|
||||
const override {
|
||||
return nullptr;
|
||||
}
|
||||
@ -277,7 +278,7 @@ class QuicTransportChannel : public TransportChannelImpl,
|
||||
QuicTransportState quic_state_ = QUIC_TRANSPORT_NEW;
|
||||
// QUIC session which establishes the crypto handshake and converts data
|
||||
// to/from QUIC packets.
|
||||
rtc::scoped_ptr<QuicSession> quic_;
|
||||
std::unique_ptr<QuicSession> quic_;
|
||||
// Non-crypto config for |quic_|.
|
||||
net::QuicConfig config_;
|
||||
// Helper for net::QuicConnection that provides timing and
|
||||
@ -288,9 +289,9 @@ class QuicTransportChannel : public TransportChannelImpl,
|
||||
// the handshake. This must be set before we start QUIC.
|
||||
rtc::Optional<rtc::SSLRole> ssl_role_;
|
||||
// Config for QUIC crypto client stream, used when |ssl_role_| is SSL_CLIENT.
|
||||
rtc::scoped_ptr<net::QuicCryptoClientConfig> quic_crypto_client_config_;
|
||||
std::unique_ptr<net::QuicCryptoClientConfig> quic_crypto_client_config_;
|
||||
// Config for QUIC crypto server stream, used when |ssl_role_| is SSL_SERVER.
|
||||
rtc::scoped_ptr<net::QuicCryptoServerConfig> quic_crypto_server_config_;
|
||||
std::unique_ptr<net::QuicCryptoServerConfig> quic_crypto_server_config_;
|
||||
// This peer's certificate.
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_;
|
||||
// Fingerprint of the remote peer. This must be set before we start QUIC.
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
|
||||
#include "webrtc/p2p/quic/quictransportchannel.h"
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/sslidentity.h"
|
||||
#include "webrtc/p2p/base/faketransportcontroller.h"
|
||||
|
||||
@ -103,7 +103,7 @@ class QuicTestPeer : public sigslot::has_slots<> {
|
||||
quic_channel_.SignalClosed.connect(this, &QuicTestPeer::OnClosed);
|
||||
ice_channel_.SetAsync(true);
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> local_cert =
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate(name_, rtc::KT_DEFAULT)));
|
||||
quic_channel_.SetLocalCertificate(local_cert);
|
||||
local_fingerprint_.reset(CreateFingerprint(local_cert.get()));
|
||||
@ -148,7 +148,7 @@ class QuicTestPeer : public sigslot::has_slots<> {
|
||||
if (!get_digest_algorithm || digest_algorithm.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint> fingerprint(
|
||||
std::unique_ptr<rtc::SSLFingerprint> fingerprint(
|
||||
rtc::SSLFingerprint::Create(digest_algorithm, cert->identity()));
|
||||
if (digest_algorithm != rtc::DIGEST_SHA_256) {
|
||||
return nullptr;
|
||||
@ -198,7 +198,7 @@ class QuicTestPeer : public sigslot::has_slots<> {
|
||||
|
||||
QuicTransportChannel* quic_channel() { return &quic_channel_; }
|
||||
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint>& local_fingerprint() {
|
||||
std::unique_ptr<rtc::SSLFingerprint>& local_fingerprint() {
|
||||
return local_fingerprint_;
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ class QuicTestPeer : public sigslot::has_slots<> {
|
||||
size_t bytes_received_; // Bytes received by QUIC channel.
|
||||
FailableTransportChannel ice_channel_; // Simulates an ICE channel.
|
||||
QuicTransportChannel quic_channel_; // QUIC channel to test.
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint> local_fingerprint_;
|
||||
std::unique_ptr<rtc::SSLFingerprint> local_fingerprint_;
|
||||
ReliableQuicStream* incoming_quic_stream_ = nullptr;
|
||||
bool signal_closed_emitted_ = false;
|
||||
};
|
||||
@ -258,9 +258,9 @@ class QuicTransportChannelTest : public testing::Test {
|
||||
peer1_.quic_channel()->SetSslRole(peer1_ssl_role);
|
||||
peer2_.quic_channel()->SetSslRole(peer2_ssl_role);
|
||||
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint>& peer1_fingerprint =
|
||||
std::unique_ptr<rtc::SSLFingerprint>& peer1_fingerprint =
|
||||
peer1_.local_fingerprint();
|
||||
rtc::scoped_ptr<rtc::SSLFingerprint>& peer2_fingerprint =
|
||||
std::unique_ptr<rtc::SSLFingerprint>& peer2_fingerprint =
|
||||
peer2_.local_fingerprint();
|
||||
|
||||
peer1_.quic_channel()->SetRemoteFingerprint(
|
||||
@ -464,7 +464,7 @@ TEST_F(QuicTransportChannelTest, QuicRoleReversalAfterQuic) {
|
||||
// Set the SSL role, then test that GetSslRole returns the same value.
|
||||
TEST_F(QuicTransportChannelTest, SetGetSslRole) {
|
||||
ASSERT_TRUE(peer1_.quic_channel()->SetSslRole(rtc::SSL_SERVER));
|
||||
rtc::scoped_ptr<rtc::SSLRole> role(new rtc::SSLRole());
|
||||
std::unique_ptr<rtc::SSLRole> role(new rtc::SSLRole());
|
||||
ASSERT_TRUE(peer1_.quic_channel()->GetSslRole(role.get()));
|
||||
EXPECT_EQ(rtc::SSL_SERVER, *role);
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include "webrtc/p2p/quic/reliablequicstream.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "net/base/ip_address_number.h"
|
||||
@ -181,8 +182,8 @@ class ReliableQuicStreamTest : public ::testing::Test,
|
||||
}
|
||||
|
||||
protected:
|
||||
rtc::scoped_ptr<ReliableQuicStream> stream_;
|
||||
rtc::scoped_ptr<MockQuicSession> session_;
|
||||
std::unique_ptr<ReliableQuicStream> stream_;
|
||||
std::unique_ptr<MockQuicSession> session_;
|
||||
|
||||
// Data written by the ReliableQuicStream.
|
||||
std::string write_buffer_;
|
||||
|
||||
@ -14,13 +14,14 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/flags.h"
|
||||
#include "webrtc/base/helpers.h"
|
||||
#include "webrtc/base/nethelpers.h"
|
||||
#include "webrtc/base/network.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/ssladapter.h"
|
||||
#include "webrtc/base/stringutils.h"
|
||||
#include "webrtc/base/thread.h"
|
||||
@ -119,9 +120,9 @@ int main(int argc, char** argv) {
|
||||
rtc::InitializeSSL();
|
||||
rtc::InitRandom(rtc::Time32());
|
||||
rtc::Thread* thread = rtc::ThreadManager::Instance()->WrapCurrentThread();
|
||||
rtc::scoped_ptr<rtc::BasicPacketSocketFactory> socket_factory(
|
||||
std::unique_ptr<rtc::BasicPacketSocketFactory> socket_factory(
|
||||
new rtc::BasicPacketSocketFactory());
|
||||
rtc::scoped_ptr<rtc::BasicNetworkManager> network_manager(
|
||||
std::unique_ptr<rtc::BasicNetworkManager> network_manager(
|
||||
new rtc::BasicNetworkManager());
|
||||
rtc::NetworkManager::NetworkList networks;
|
||||
network_manager->GetNetworks(&networks);
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
@ -90,11 +91,11 @@ class StunProber::Requester : public sigslot::has_slots<> {
|
||||
StunProber* prober_;
|
||||
|
||||
// The socket for this session.
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> socket_;
|
||||
|
||||
// Temporary SocketAddress and buffer for RecvFrom.
|
||||
rtc::SocketAddress addr_;
|
||||
rtc::scoped_ptr<rtc::ByteBufferWriter> response_packet_;
|
||||
std::unique_ptr<rtc::ByteBufferWriter> response_packet_;
|
||||
|
||||
std::vector<Request*> requests_;
|
||||
std::vector<rtc::SocketAddress> server_ips_;
|
||||
@ -141,7 +142,7 @@ void StunProber::Requester::SendStunRequest() {
|
||||
rtc::CreateRandomString(cricket::kStunTransactionIdLength));
|
||||
message.SetType(cricket::STUN_BINDING_REQUEST);
|
||||
|
||||
rtc::scoped_ptr<rtc::ByteBufferWriter> request_packet(
|
||||
std::unique_ptr<rtc::ByteBufferWriter> request_packet(
|
||||
new rtc::ByteBufferWriter(nullptr, kMaxUdpBufferSize));
|
||||
if (!message.Write(request_packet.get())) {
|
||||
prober_->ReportOnFinished(WRITE_FAILED);
|
||||
@ -345,7 +346,7 @@ void StunProber::OnServerResolved(rtc::AsyncResolverInterface* resolver) {
|
||||
|
||||
// Prepare all the sockets beforehand. All of them will bind to "any" address.
|
||||
while (sockets_.size() < total_socket_required()) {
|
||||
rtc::scoped_ptr<rtc::AsyncPacketSocket> socket(
|
||||
std::unique_ptr<rtc::AsyncPacketSocket> socket(
|
||||
socket_factory_->CreateUdpSocket(rtc::SocketAddress(INADDR_ANY, 0), 0,
|
||||
0));
|
||||
if (!socket) {
|
||||
|
||||
@ -8,13 +8,14 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/asyncresolverinterface.h"
|
||||
#include "webrtc/base/basictypes.h"
|
||||
#include "webrtc/base/bind.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/physicalsocketserver.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/ssladapter.h"
|
||||
#include "webrtc/base/virtualsocketserver.h"
|
||||
#include "webrtc/p2p/base/basicpacketsocketfactory.h"
|
||||
@ -83,7 +84,7 @@ class StunProberTest : public testing::Test {
|
||||
rtc::NetworkManager::NetworkList networks;
|
||||
networks.push_back(&ipv4_network1);
|
||||
|
||||
rtc::scoped_ptr<rtc::BasicPacketSocketFactory> socket_factory(
|
||||
std::unique_ptr<rtc::BasicPacketSocketFactory> socket_factory(
|
||||
new rtc::BasicPacketSocketFactory());
|
||||
|
||||
// Set up the expected results for verification.
|
||||
@ -119,14 +120,14 @@ class StunProberTest : public testing::Test {
|
||||
}
|
||||
|
||||
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::scoped_ptr<StunProber> prober;
|
||||
std::unique_ptr<StunProber> prober;
|
||||
int result_ = 0;
|
||||
bool stopped_ = false;
|
||||
rtc::scoped_ptr<cricket::TestStunServer> stun_server_1_;
|
||||
rtc::scoped_ptr<cricket::TestStunServer> stun_server_2_;
|
||||
std::unique_ptr<cricket::TestStunServer> stun_server_1_;
|
||||
std::unique_ptr<cricket::TestStunServer> stun_server_2_;
|
||||
};
|
||||
|
||||
TEST_F(StunProberTest, NonSharedMode) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user