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

Unified Diff: webrtc/base/socket_unittest.cc

Issue 2859373003: Refactor TestClient to use std::unique_ptr, and fix VirtualSocketServerTest leaks. (Closed)
Patch Set: Comment fix, 0 -> null. Created 3 years, 7 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
Index: webrtc/base/socket_unittest.cc
diff --git a/webrtc/base/socket_unittest.cc b/webrtc/base/socket_unittest.cc
index 762a88a42a5ef01d8edfb805ba77cba5d31e51b9..f1a8ecb184155124493b8f02150a421b033bacbe 100644
--- a/webrtc/base/socket_unittest.cc
+++ b/webrtc/base/socket_unittest.cc
@@ -13,10 +13,11 @@
#include "webrtc/base/socket_unittest.h"
#include "webrtc/base/arraysize.h"
-#include "webrtc/base/buffer.h"
#include "webrtc/base/asyncudpsocket.h"
+#include "webrtc/base/buffer.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/nethelpers.h"
+#include "webrtc/base/ptr_util.h"
#include "webrtc/base/socketserver.h"
#include "webrtc/base/testclient.h"
#include "webrtc/base/testutils.h"
@@ -903,9 +904,9 @@ void SocketTest::UdpInternal(const IPAddress& loopback) {
// Test send/receive behavior.
std::unique_ptr<TestClient> client1(
- new TestClient(AsyncUDPSocket::Create(ss_, addr1)));
+ new TestClient(WrapUnique(AsyncUDPSocket::Create(ss_, addr1))));
std::unique_ptr<TestClient> client2(
- new TestClient(AsyncUDPSocket::Create(ss_, empty)));
+ new TestClient(WrapUnique(AsyncUDPSocket::Create(ss_, empty))));
SocketAddress addr2;
EXPECT_EQ(3, client2->SendTo("foo", 3, addr1));
@@ -917,7 +918,8 @@ void SocketTest::UdpInternal(const IPAddress& loopback) {
EXPECT_EQ(addr3, addr1);
// TODO: figure out what the intent is here
for (int i = 0; i < 10; ++i) {
- client2.reset(new TestClient(AsyncUDPSocket::Create(ss_, empty)));
+ client2.reset(
+ new TestClient(WrapUnique(AsyncUDPSocket::Create(ss_, empty))));
SocketAddress addr4;
EXPECT_EQ(3, client2->SendTo("foo", 3, addr1));
@@ -944,7 +946,7 @@ void SocketTest::UdpReadyToSend(const IPAddress& loopback) {
// Test send
std::unique_ptr<TestClient> client(
- new TestClient(AsyncUDPSocket::Create(ss_, empty)));
+ new TestClient(WrapUnique(AsyncUDPSocket::Create(ss_, empty))));
int test_packet_size = 1200;
std::unique_ptr<char[]> test_packet(new char[test_packet_size]);
// Init the test packet just to avoid memcheck warning.

Powered by Google App Engine
This is Rietveld 408576698