| Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| index 9b7a92ad8be4c44313f5c07d3c5ba2953558de90..e9d4be60f1801987f9722dac81b65a555c127c65 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
|
| @@ -24,12 +24,13 @@
|
| #include "webrtc/base/natsocketfactory.h"
|
| #include "webrtc/base/physicalsocketserver.h"
|
| #include "webrtc/base/proxyserver.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"
|
| @@ -3043,13 +3044,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());
|
| @@ -3246,11 +3248,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,
|
| @@ -3415,11 +3417,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);
|
| @@ -3558,11 +3560,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);
|
| @@ -3600,7 +3602,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);
|
| @@ -3655,12 +3658,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);
|
|
|