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

Unified Diff: webrtc/p2p/base/stunserver_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/p2p/base/stunserver_unittest.cc
diff --git a/webrtc/p2p/base/stunserver_unittest.cc b/webrtc/p2p/base/stunserver_unittest.cc
index 553ad8a0a7492211fa2bdb7bc0730bfa762975a8..c72a8812183f810b2da24f82017ea9169ad790db 100644
--- a/webrtc/p2p/base/stunserver_unittest.cc
+++ b/webrtc/p2p/base/stunserver_unittest.cc
@@ -11,13 +11,14 @@
#include <memory>
#include <string>
-#include "webrtc/p2p/base/stunserver.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/ptr_util.h"
#include "webrtc/base/testclient.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/virtualsocketserver.h"
+#include "webrtc/p2p/base/stunserver.h"
using namespace cricket;
@@ -35,7 +36,7 @@ class StunServerTest : public testing::Test {
server_.reset(new StunServer(
rtc::AsyncUDPSocket::Create(ss_.get(), server_addr)));
client_.reset(new rtc::TestClient(
- rtc::AsyncUDPSocket::Create(ss_.get(), client_addr)));
+ WrapUnique(rtc::AsyncUDPSocket::Create(ss_.get(), client_addr))));
network_.Start();
}
@@ -52,13 +53,12 @@ class StunServerTest : public testing::Test {
}
StunMessage* Receive() {
StunMessage* msg = NULL;
- rtc::TestClient::Packet* packet =
+ std::unique_ptr<rtc::TestClient::Packet> packet =
client_->NextPacket(rtc::TestClient::kTimeoutMs);
if (packet) {
rtc::ByteBufferReader buf(packet->buf, packet->size);
msg = new StunMessage();
msg->Read(&buf);
- delete packet;
}
return msg;
}
« webrtc/base/virtualsocket_unittest.cc ('K') | « webrtc/p2p/base/relayserver_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698