Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: webrtc/p2p/base/relayserver_unittest.cc

Issue 2757893003: Add MakeUnique from chromium and change StunMessage::AddAttribute to take a unique_ptr. (Closed)
Patch Set: add ptr_util.h to rtc_base_approved build target Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/relayserver.cc ('k') | webrtc/p2p/base/stun.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « webrtc/p2p/base/relayserver.cc ('k') | webrtc/p2p/base/stun.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698