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

Unified Diff: net/dns/host_resolver_impl_unittest.cc

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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: net/dns/host_resolver_impl_unittest.cc
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc
index 58065c6bb3d4ae0a42168b6d8d3204c331656273..8a0eddf2ef8eb6c842b7dc07c884feb061c6a0ff 100644
--- a/net/dns/host_resolver_impl_unittest.cc
+++ b/net/dns/host_resolver_impl_unittest.cc
@@ -225,7 +225,7 @@ class Request {
handler_(handler),
quit_on_complete_(false),
result_(ERR_UNEXPECTED),
- handle_(NULL) {}
+ handle_(nullptr) {}
int Resolve() {
DCHECK(resolver_);
@@ -259,15 +259,14 @@ class Request {
void ChangePriority(RequestPriority priority) {
DCHECK(resolver_);
DCHECK(handle_);
- resolver_->ChangeRequestPriority(handle_, priority);
+ handle_->ChangeRequestPriority(priority);
priority_ = priority;
}
void Cancel() {
DCHECK(resolver_);
DCHECK(handle_);
- resolver_->CancelRequest(handle_);
- handle_ = NULL;
+ handle_.reset();
}
const HostResolver::RequestInfo& info() const { return info_; }
@@ -315,7 +314,7 @@ class Request {
EXPECT_THAT(result_, IsError(ERR_IO_PENDING));
EXPECT_NE(ERR_IO_PENDING, rv);
result_ = rv;
- handle_ = NULL;
+ handle_.reset();
if (!list_.empty()) {
EXPECT_THAT(result_, IsOk());
EXPECT_EQ(info_.port(), list_.front().port());
@@ -337,7 +336,7 @@ class Request {
AddressList list_;
int result_;
- HostResolver::RequestHandle handle_;
+ std::unique_ptr<HostResolver::Request> handle_;
HostCache::EntryStaleness staleness_;
DISALLOW_COPY_AND_ASSIGN(Request);
@@ -640,7 +639,6 @@ TEST_F(HostResolverImplTest, AsynchronousLookup) {
EXPECT_THAT(req->WaitForResult(), IsOk());
EXPECT_TRUE(req->HasOneAddress("192.168.1.42", 80));
-
EXPECT_EQ("just.testing", proc_->GetCaptureList()[0].hostname);
}

Powered by Google App Engine
This is Rietveld 408576698