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

Unified Diff: webrtc/base/nat_unittest.cc

Issue 2859373003: Refactor TestClient to use std::unique_ptr, and fix VirtualSocketServerTest leaks. (Closed)
Patch Set: git cl format 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
« no previous file with comments | « no previous file | webrtc/base/proxy_unittest.cc » ('j') | webrtc/base/testclient.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/nat_unittest.cc
diff --git a/webrtc/base/nat_unittest.cc b/webrtc/base/nat_unittest.cc
index f585effdd95337e7313d2e96229f4d84e8d3b1a7..1295a3463751c72ce94bd66f538785e0c906cfa2 100644
--- a/webrtc/base/nat_unittest.cc
+++ b/webrtc/base/nat_unittest.cc
@@ -12,6 +12,7 @@
#include <memory>
#include <string>
+#include "webrtc/base/asynctcpsocket.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/natserver.h"
@@ -19,8 +20,8 @@
#include "webrtc/base/nethelpers.h"
#include "webrtc/base/network.h"
#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/ptr_util.h"
#include "webrtc/base/testclient.h"
-#include "webrtc/base/asynctcpsocket.h"
#include "webrtc/base/virtualsocketserver.h"
using namespace rtc;
@@ -34,13 +35,12 @@ bool CheckReceive(
TestClient* CreateTestClient(
SocketFactory* factory, const SocketAddress& local_addr) {
- AsyncUDPSocket* socket = AsyncUDPSocket::Create(factory, local_addr);
- return new TestClient(socket);
+ return new TestClient(
+ WrapUnique(AsyncUDPSocket::Create(factory, local_addr)));
}
TestClient* CreateTCPTestClient(AsyncSocket* socket) {
- AsyncTCPSocket* packet_socket = new AsyncTCPSocket(socket, false);
- return new TestClient(packet_socket);
+ return new TestClient(MakeUnique<AsyncTCPSocket>(socket, false));
}
// Tests that when sending from internal_addr to external_addrs through the
« no previous file with comments | « no previous file | webrtc/base/proxy_unittest.cc » ('j') | webrtc/base/testclient.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698