| Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| index da0bfb041402acf87c178b8c2a1ee108d97e3f0b..843713247e7a110c9748666c971e13937160bf10 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| @@ -23,12 +23,13 @@
|
| #include "webrtc/base/natserver.h"
|
| #include "webrtc/base/natsocketfactory.h"
|
| #include "webrtc/base/physicalsocketserver.h"
|
| +#include "webrtc/base/ptr_util.h"
|
| #include "webrtc/base/socketaddress.h"
|
| #include "webrtc/base/ssladapter.h"
|
| #include "webrtc/base/thread.h"
|
| #include "webrtc/base/virtualsocketserver.h"
|
| -#include "webrtc/p2p/base/icetransportinternal.h"
|
| #include "webrtc/p2p/base/fakeportallocator.h"
|
| +#include "webrtc/p2p/base/icetransportinternal.h"
|
| #include "webrtc/p2p/base/p2ptransportchannel.h"
|
| #include "webrtc/p2p/base/packettransportinternal.h"
|
| #include "webrtc/p2p/base/testrelayserver.h"
|
| @@ -2977,13 +2978,14 @@ class P2PTransportChannelPingTest : public testing::Test,
|
| uint32_t nomination = 0) {
|
| IceMessage msg;
|
| msg.SetType(STUN_BINDING_REQUEST);
|
| - msg.AddAttribute(new StunByteStringAttribute(
|
| + msg.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
|
| STUN_ATTR_USERNAME,
|
| conn->local_candidate().username() + ":" + remote_ufrag));
|
| - msg.AddAttribute(new StunUInt32Attribute(STUN_ATTR_PRIORITY, priority));
|
| + msg.AddAttribute(
|
| + rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, priority));
|
| if (nomination != 0) {
|
| - msg.AddAttribute(
|
| - new StunUInt32Attribute(STUN_ATTR_NOMINATION, nomination));
|
| + msg.AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
|
| + STUN_ATTR_NOMINATION, nomination));
|
| }
|
| msg.SetTransactionID(rtc::CreateRandomString(kStunTransactionIdLength));
|
| msg.AddMessageIntegrity(conn->local_candidate().password());
|
| @@ -3180,11 +3182,11 @@ TEST_F(P2PTransportChannelPingTest, PingingStartedAsSoonAsPossible) {
|
| // candidate pair while we still don't have remote ICE parameters.
|
| IceMessage request;
|
| request.SetType(STUN_BINDING_REQUEST);
|
| - request.AddAttribute(
|
| - new StunByteStringAttribute(STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| + request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
|
| + STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
|
| request.AddAttribute(
|
| - new StunUInt32Attribute(STUN_ATTR_PRIORITY, prflx_priority));
|
| + rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
|
| Port* port = GetPort(&ch);
|
| ASSERT_NE(nullptr, port);
|
| port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP,
|
| @@ -3349,11 +3351,11 @@ TEST_F(P2PTransportChannelPingTest, ConnectionResurrection) {
|
| // Create a minimal STUN message with prflx priority.
|
| IceMessage request;
|
| request.SetType(STUN_BINDING_REQUEST);
|
| - request.AddAttribute(
|
| - new StunByteStringAttribute(STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| + request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
|
| + STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
|
| request.AddAttribute(
|
| - new StunUInt32Attribute(STUN_ATTR_PRIORITY, prflx_priority));
|
| + rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
|
| EXPECT_NE(prflx_priority, remote_priority);
|
|
|
| Port* port = GetPort(&ch);
|
| @@ -3492,11 +3494,11 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionFromUnknownAddress) {
|
| // A minimal STUN message with prflx priority.
|
| IceMessage request;
|
| request.SetType(STUN_BINDING_REQUEST);
|
| - request.AddAttribute(
|
| - new StunByteStringAttribute(STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| + request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
|
| + STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
|
| request.AddAttribute(
|
| - new StunUInt32Attribute(STUN_ATTR_PRIORITY, prflx_priority));
|
| + rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
|
| TestUDPPort* port = static_cast<TestUDPPort*>(GetPort(&ch));
|
| port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP,
|
| &request, kIceUfrag[1], false);
|
| @@ -3534,7 +3536,8 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionFromUnknownAddress) {
|
|
|
| // However if the request contains use_candidate attribute, it will be
|
| // selected as the selected connection.
|
| - request.AddAttribute(new StunByteStringAttribute(STUN_ATTR_USE_CANDIDATE));
|
| + request.AddAttribute(
|
| + rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
|
| port->SignalUnknownAddress(port, rtc::SocketAddress("4.4.4.4", 4), PROTO_UDP,
|
| &request, kIceUfrag[1], false);
|
| Connection* conn4 = WaitForConnectionTo(&ch, "4.4.4.4", 4);
|
| @@ -3589,12 +3592,13 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) {
|
| // nominate the selected connection.
|
| IceMessage request;
|
| request.SetType(STUN_BINDING_REQUEST);
|
| - request.AddAttribute(
|
| - new StunByteStringAttribute(STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| + request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
|
| + STUN_ATTR_USERNAME, kIceUfrag[1]));
|
| uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
|
| request.AddAttribute(
|
| - new StunUInt32Attribute(STUN_ATTR_PRIORITY, prflx_priority));
|
| - request.AddAttribute(new StunByteStringAttribute(STUN_ATTR_USE_CANDIDATE));
|
| + rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
|
| + request.AddAttribute(
|
| + rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
|
| Port* port = GetPort(&ch);
|
| port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3), PROTO_UDP,
|
| &request, kIceUfrag[1], false);
|
|
|