Index: webrtc/p2p/base/relayserver_unittest.cc |
diff --git a/webrtc/p2p/base/relayserver_unittest.cc b/webrtc/p2p/base/relayserver_unittest.cc |
index 1d07a07c7fbf1866f857400e7d5f5d1dfb145501..0c98286af9507d6d097a824691becf38f9d9407a 100644 |
--- a/webrtc/p2p/base/relayserver_unittest.cc |
+++ b/webrtc/p2p/base/relayserver_unittest.cc |
@@ -146,29 +146,25 @@ class RelayServerTest : public testing::Test { |
return msg; |
} |
static void AddMagicCookieAttr(StunMessage* msg) { |
- StunByteStringAttribute* attr = |
- StunAttribute::CreateByteString(STUN_ATTR_MAGIC_COOKIE); |
+ auto attr = StunAttribute::CreateByteString(STUN_ATTR_MAGIC_COOKIE); |
attr->CopyBytes(TURN_MAGIC_COOKIE_VALUE, sizeof(TURN_MAGIC_COOKIE_VALUE)); |
- msg->AddAttribute(attr); |
+ msg->AddAttribute(std::move(attr)); |
} |
static void AddUsernameAttr(StunMessage* msg, const std::string& val) { |
- StunByteStringAttribute* attr = |
- StunAttribute::CreateByteString(STUN_ATTR_USERNAME); |
+ auto attr = StunAttribute::CreateByteString(STUN_ATTR_USERNAME); |
attr->CopyBytes(val.c_str(), val.size()); |
- msg->AddAttribute(attr); |
+ msg->AddAttribute(std::move(attr)); |
} |
static void AddLifetimeAttr(StunMessage* msg, int val) { |
- StunUInt32Attribute* attr = |
- StunAttribute::CreateUInt32(STUN_ATTR_LIFETIME); |
+ auto attr = StunAttribute::CreateUInt32(STUN_ATTR_LIFETIME); |
attr->SetValue(val); |
- msg->AddAttribute(attr); |
+ msg->AddAttribute(std::move(attr)); |
} |
static void AddDestinationAttr(StunMessage* msg, const SocketAddress& addr) { |
- StunAddressAttribute* attr = |
- StunAttribute::CreateAddress(STUN_ATTR_DESTINATION_ADDRESS); |
+ auto attr = StunAttribute::CreateAddress(STUN_ATTR_DESTINATION_ADDRESS); |
attr->SetIP(addr.ipaddr()); |
attr->SetPort(addr.port()); |
- msg->AddAttribute(attr); |
+ msg->AddAttribute(std::move(attr)); |
} |
std::unique_ptr<rtc::PhysicalSocketServer> pss_; |
@@ -458,10 +454,9 @@ TEST_F(RelayServerTest, TestSendRaw) { |
AddUsernameAttr(req.get(), username_); |
AddDestinationAttr(req.get(), client2_addr); |
- StunByteStringAttribute* send_data = |
- StunAttribute::CreateByteString(STUN_ATTR_DATA); |
+ auto send_data = StunAttribute::CreateByteString(STUN_ATTR_DATA); |
send_data->CopyBytes(msg1); |
- req->AddAttribute(send_data); |
+ req->AddAttribute(std::move(send_data)); |
Send1(req.get()); |
EXPECT_EQ(msg1, ReceiveRaw2()); |
@@ -500,10 +495,9 @@ TEST_F(RelayServerTest, DISABLED_TestExpiration) { |
AddUsernameAttr(req.get(), username_); |
AddDestinationAttr(req.get(), client2_addr); |
- StunByteStringAttribute* data_attr = |
- StunAttribute::CreateByteString(STUN_ATTR_DATA); |
+ auto data_attr = StunAttribute::CreateByteString(STUN_ATTR_DATA); |
data_attr->CopyBytes(msg1); |
- req->AddAttribute(data_attr); |
+ req->AddAttribute(std::move(data_attr)); |
Send1(req.get()); |
res.reset(Receive1()); |