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

Side by Side Diff: chromeos/network/host_resolver_impl_chromeos_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: mmenke's comments and rebasing 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/network/host_resolver_impl_chromeos.h" 5 #include "chromeos/network/host_resolver_impl_chromeos.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 private: 93 private:
94 // Run from IO message loop. 94 // Run from IO message loop.
95 void InitializeHostResolver() { 95 void InitializeHostResolver() {
96 net::HostResolver::Options options; 96 net::HostResolver::Options options;
97 host_resolver_ = 97 host_resolver_ =
98 chromeos::HostResolverImplChromeOS::CreateHostResolverForTest( 98 chromeos::HostResolverImplChromeOS::CreateHostResolverForTest(
99 base::ThreadTaskRunnerHandle::Get(), network_state_handler_.get()); 99 base::ThreadTaskRunnerHandle::Get(), network_state_handler_.get());
100 } 100 }
101 101
102 // Run from IO message loop. 102 // Run from IO message loop.
103 std::unique_ptr<net::HostResolver::Request> request_;
mmenke 2016/07/21 16:00:40 This should be moved below all methods in this cla
maksims (do not use this acc) 2016/07/22 10:16:00 Done.
103 void Resolve(net::HostResolver::RequestInfo info) { 104 void Resolve(net::HostResolver::RequestInfo info) {
104 result_ = host_resolver_->Resolve( 105 result_ = host_resolver_->Resolve(info, net::DEFAULT_PRIORITY, &addresses_,
105 info, 106 base::Bind(&ResolveCompletionCallback),
106 net::DEFAULT_PRIORITY, 107 &request_, net_log_);
107 &addresses_,
108 base::Bind(&ResolveCompletionCallback),
109 NULL,
110 net_log_);
111 } 108 }
112 109
113 void SetDefaultIPConfigs(const std::string& default_device_path) { 110 void SetDefaultIPConfigs(const std::string& default_device_path) {
114 const std::string kTestIPv4ConfigPath("test_ip_v4_config_path"); 111 const std::string kTestIPv4ConfigPath("test_ip_v4_config_path");
115 const std::string kTestIPv6ConfigPath("test_ip_v6_config_path"); 112 const std::string kTestIPv6ConfigPath("test_ip_v6_config_path");
116 113
117 SetIPConfig(kTestIPv4ConfigPath, shill::kTypeIPv4, kTestIPv4Address); 114 SetIPConfig(kTestIPv4ConfigPath, shill::kTypeIPv4, kTestIPv4Address);
118 SetIPConfig(kTestIPv6ConfigPath, shill::kTypeIPv6, kTestIPv6Address); 115 SetIPConfig(kTestIPv6ConfigPath, shill::kTypeIPv6, kTestIPv6Address);
119 base::RunLoop().RunUntilIdle(); 116 base::RunLoop().RunUntilIdle();
120 117
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 EXPECT_EQ(expected, addresses_[0].ToString()); 162 EXPECT_EQ(expected, addresses_[0].ToString());
166 163
167 info.set_address_family(net::ADDRESS_FAMILY_IPV6); 164 info.set_address_family(net::ADDRESS_FAMILY_IPV6);
168 EXPECT_EQ(net::OK, CallResolve(info)); 165 EXPECT_EQ(net::OK, CallResolve(info));
169 ASSERT_EQ(2u, addresses_.size()); 166 ASSERT_EQ(2u, addresses_.size());
170 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); 167 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0);
171 EXPECT_EQ(expected, addresses_[0].ToString()); 168 EXPECT_EQ(expected, addresses_[0].ToString());
172 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); 169 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0);
173 EXPECT_EQ(expected, addresses_[1].ToString()); 170 EXPECT_EQ(expected, addresses_[1].ToString());
174 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698