OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/dns/async_host_resolver.h" | 5 #include "net/dns/async_host_resolver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" |
9 #include "net/base/host_cache.h" | 11 #include "net/base/host_cache.h" |
| 12 #include "net/base/net_errors.h" |
10 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
11 #include "net/base/rand_callback.h" | |
12 #include "net/base/sys_addrinfo.h" | 14 #include "net/base/sys_addrinfo.h" |
| 15 #include "net/base/test_completion_callback.h" |
| 16 #include "net/dns/dns_client.h" |
| 17 #include "net/dns/dns_query.h" |
| 18 #include "net/dns/dns_response.h" |
13 #include "net/dns/dns_test_util.h" | 19 #include "net/dns/dns_test_util.h" |
14 #include "net/socket/socket_test_util.h" | |
15 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
16 | 21 |
17 namespace net { | 22 namespace net { |
18 | 23 |
19 namespace { | 24 namespace { |
20 | 25 |
| 26 const int kPortNum = 80; |
| 27 const size_t kMaxTransactions = 2; |
| 28 const size_t kMaxPendingRequests = 1; |
| 29 |
21 void VerifyAddressList(const std::vector<const char*>& ip_addresses, | 30 void VerifyAddressList(const std::vector<const char*>& ip_addresses, |
22 int port, | 31 int port, |
23 const AddressList& addrlist) { | 32 const AddressList& addrlist) { |
24 ASSERT_LT(0u, ip_addresses.size()); | 33 ASSERT_LT(0u, ip_addresses.size()); |
25 ASSERT_NE(static_cast<addrinfo*>(NULL), addrlist.head()); | 34 ASSERT_NE(static_cast<addrinfo*>(NULL), addrlist.head()); |
26 | 35 |
27 IPAddressNumber ip_number; | 36 IPAddressNumber ip_number; |
28 const struct addrinfo* ainfo = addrlist.head(); | 37 const struct addrinfo* ainfo = addrlist.head(); |
29 for (std::vector<const char*>::const_iterator i = ip_addresses.begin(); | 38 for (std::vector<const char*>::const_iterator i = ip_addresses.begin(); |
30 i != ip_addresses.end(); ++i, ainfo = ainfo->ai_next) { | 39 i != ip_addresses.end(); ++i, ainfo = ainfo->ai_next) { |
31 ASSERT_NE(static_cast<addrinfo*>(NULL), ainfo); | 40 ASSERT_NE(static_cast<addrinfo*>(NULL), ainfo); |
32 EXPECT_EQ(sizeof(struct sockaddr_in), ainfo->ai_addrlen); | 41 EXPECT_EQ(sizeof(struct sockaddr_in), ainfo->ai_addrlen); |
33 | 42 |
34 const struct sockaddr* sa = ainfo->ai_addr; | 43 const struct sockaddr* sa = ainfo->ai_addr; |
35 const struct sockaddr_in* sa_in = (const struct sockaddr_in*) sa; | 44 const struct sockaddr_in* sa_in = (const struct sockaddr_in*) sa; |
36 EXPECT_TRUE(htons(port) == sa_in->sin_port); | 45 EXPECT_TRUE(htons(port) == sa_in->sin_port); |
37 EXPECT_STREQ(*i, NetAddressToString(sa, ainfo->ai_addrlen).c_str()); | 46 EXPECT_STREQ(*i, NetAddressToString(sa, ainfo->ai_addrlen).c_str()); |
38 } | 47 } |
39 ASSERT_EQ(static_cast<addrinfo*>(NULL), ainfo); | 48 ASSERT_EQ(static_cast<addrinfo*>(NULL), ainfo); |
40 } | 49 } |
41 | 50 |
| 51 class MockDnsClient : public DnsClient, |
| 52 public base::SupportsWeakPtr<MockDnsClient> { |
| 53 public: |
| 54 // Using WeakPtr to support cancellation. |
| 55 // All MockRequests succeed unless canceled or MockDnsClient is destroyed. |
| 56 class MockRequest : public DnsClient::Request, |
| 57 public base::SupportsWeakPtr<MockRequest> { |
| 58 public: |
| 59 MockRequest(const base::StringPiece& qname, |
| 60 uint16 qtype, |
| 61 const RequestCallback& callback, |
| 62 const base::WeakPtr<MockDnsClient>& client) |
| 63 : Request(qname, qtype, callback), started_(false), client_(client) { |
| 64 } |
| 65 |
| 66 int Start() OVERRIDE { |
| 67 EXPECT_FALSE(started_); |
| 68 started_ = true; |
| 69 MessageLoop::current()->PostTask( |
| 70 FROM_HERE, |
| 71 base::Bind(&MockRequest::Finish, AsWeakPtr())); |
| 72 return ERR_IO_PENDING; |
| 73 } |
| 74 |
| 75 private: |
| 76 void Finish() { |
| 77 if (!client_) { |
| 78 DoCallback(ERR_DNS_SERVER_FAILED, NULL); |
| 79 return; |
| 80 } |
| 81 DoCallback(OK, client_->responses[Key(qname(), qtype())]); |
| 82 } |
| 83 |
| 84 bool started_; |
| 85 base::WeakPtr<MockDnsClient> client_; |
| 86 }; |
| 87 |
| 88 typedef std::pair<std::string, uint16> Key; |
| 89 |
| 90 MockDnsClient() : num_requests(0) {} |
| 91 ~MockDnsClient() { |
| 92 STLDeleteValues(&responses); |
| 93 } |
| 94 |
| 95 Request* CreateRequest(const base::StringPiece& qname, |
| 96 uint16 qtype, |
| 97 const RequestCallback& callback, |
| 98 const BoundNetLog&) { |
| 99 ++num_requests; |
| 100 return new MockRequest(qname, qtype, callback, AsWeakPtr()); |
| 101 } |
| 102 |
| 103 int num_requests; |
| 104 std::map<Key, DnsResponse*> responses; |
| 105 }; |
| 106 |
42 } // namespace | 107 } // namespace |
43 | 108 |
44 static const int kPortNum = 80; | |
45 static const size_t kMaxTransactions = 2; | |
46 static const size_t kMaxPendingRequests = 1; | |
47 static int transaction_ids[] = {0, 1, 2, 3}; | |
48 | 109 |
49 // The following fixture sets up an environment for four different lookups | 110 // The following fixture sets up an environment for four different lookups |
50 // with their data defined in dns_test_util.h. All tests make use of these | 111 // with their data defined in dns_test_util.h. All tests make use of these |
51 // predefined variables instead of each defining their own, to avoid | 112 // predefined variables instead of each defining their own, to avoid |
52 // boilerplate code in every test. Assuming every coming query is for a | 113 // boilerplate code in every test. Assuming every coming query is for a |
53 // distinct hostname, as |kMaxTransactions| is set to 2 and | 114 // distinct hostname, as |kMaxTransactions| is set to 2 and |
54 // |kMaxPendingRequests| is set to 1, first two queries start immediately | 115 // |kMaxPendingRequests| is set to 1, first two queries start immediately |
55 // and the next one is sent to pending queue; as a result, the next query | 116 // and the next one is sent to pending queue; as a result, the next query |
56 // should either fail itself or cause the pending query to fail depending | 117 // should either fail itself or cause the pending query to fail depending |
57 // on its priority. | 118 // on its priority. |
58 class AsyncHostResolverTest : public testing::Test { | 119 class AsyncHostResolverTest : public testing::Test { |
59 public: | 120 public: |
60 AsyncHostResolverTest() | 121 AsyncHostResolverTest() |
61 : info0_(HostPortPair(kT0HostName, kPortNum)), | 122 : info0_(HostPortPair(kT0HostName, kPortNum)), |
62 info1_(HostPortPair(kT1HostName, kPortNum)), | 123 info1_(HostPortPair(kT1HostName, kPortNum)), |
63 info2_(HostPortPair(kT2HostName, kPortNum)), | 124 info2_(HostPortPair(kT2HostName, kPortNum)), |
64 info3_(HostPortPair(kT3HostName, kPortNum)), | 125 info3_(HostPortPair(kT3HostName, kPortNum)), |
65 ip_addresses0_(kT0IpAddresses, | 126 ip_addresses0_(kT0IpAddresses, |
66 kT0IpAddresses + arraysize(kT0IpAddresses)), | 127 kT0IpAddresses + arraysize(kT0IpAddresses)), |
67 ip_addresses1_(kT1IpAddresses, | 128 ip_addresses1_(kT1IpAddresses, |
68 kT1IpAddresses + arraysize(kT1IpAddresses)), | 129 kT1IpAddresses + arraysize(kT1IpAddresses)), |
69 ip_addresses2_(kT2IpAddresses, | 130 ip_addresses2_(kT2IpAddresses, |
70 kT2IpAddresses + arraysize(kT2IpAddresses)), | 131 kT2IpAddresses + arraysize(kT2IpAddresses)), |
71 ip_addresses3_(kT3IpAddresses, | 132 ip_addresses3_(kT3IpAddresses, |
72 kT3IpAddresses + arraysize(kT3IpAddresses)), | 133 kT3IpAddresses + arraysize(kT3IpAddresses)) { |
73 test_prng_(std::deque<int>( | |
74 transaction_ids, transaction_ids + arraysize(transaction_ids))) { | |
75 rand_int_cb_ = base::Bind(&TestPrng::GetNext, | |
76 base::Unretained(&test_prng_)); | |
77 // AF_INET only for now. | 134 // AF_INET only for now. |
78 info0_.set_address_family(ADDRESS_FAMILY_IPV4); | 135 info0_.set_address_family(ADDRESS_FAMILY_IPV4); |
79 info1_.set_address_family(ADDRESS_FAMILY_IPV4); | 136 info1_.set_address_family(ADDRESS_FAMILY_IPV4); |
80 info2_.set_address_family(ADDRESS_FAMILY_IPV4); | 137 info2_.set_address_family(ADDRESS_FAMILY_IPV4); |
81 info3_.set_address_family(ADDRESS_FAMILY_IPV4); | 138 info3_.set_address_family(ADDRESS_FAMILY_IPV4); |
82 | 139 |
83 // Setup socket read/writes for transaction 0. | 140 client_.reset(new MockDnsClient()); |
84 writes0_.push_back( | |
85 MockWrite(true, reinterpret_cast<const char*>(kT0QueryDatagram), | |
86 arraysize(kT0QueryDatagram))); | |
87 reads0_.push_back( | |
88 MockRead(true, reinterpret_cast<const char*>(kT0ResponseDatagram), | |
89 arraysize(kT0ResponseDatagram))); | |
90 data0_.reset(new StaticSocketDataProvider(&reads0_[0], reads0_.size(), | |
91 &writes0_[0], writes0_.size())); | |
92 | 141 |
93 // Setup socket read/writes for transaction 1. | 142 AddResponse(std::string(kT0DnsName, arraysize(kT0DnsName)), kT0Qtype, |
94 writes1_.push_back( | 143 new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram), |
95 MockWrite(true, reinterpret_cast<const char*>(kT1QueryDatagram), | 144 arraysize(kT0ResponseDatagram), |
96 arraysize(kT1QueryDatagram))); | 145 arraysize(kT0QueryDatagram))); |
97 reads1_.push_back( | |
98 MockRead(true, reinterpret_cast<const char*>(kT1ResponseDatagram), | |
99 arraysize(kT1ResponseDatagram))); | |
100 data1_.reset(new StaticSocketDataProvider(&reads1_[0], reads1_.size(), | |
101 &writes1_[0], writes1_.size())); | |
102 | 146 |
103 // Setup socket read/writes for transaction 2. | 147 AddResponse(std::string(kT1DnsName, arraysize(kT1DnsName)), kT1Qtype, |
104 writes2_.push_back( | 148 new DnsResponse(reinterpret_cast<const char*>(kT1ResponseDatagram), |
105 MockWrite(true, reinterpret_cast<const char*>(kT2QueryDatagram), | 149 arraysize(kT1ResponseDatagram), |
106 arraysize(kT2QueryDatagram))); | 150 arraysize(kT1QueryDatagram))); |
107 reads2_.push_back( | |
108 MockRead(true, reinterpret_cast<const char*>(kT2ResponseDatagram), | |
109 arraysize(kT2ResponseDatagram))); | |
110 data2_.reset(new StaticSocketDataProvider(&reads2_[0], reads2_.size(), | |
111 &writes2_[0], writes2_.size())); | |
112 | 151 |
113 // Setup socket read/writes for transaction 3. | 152 AddResponse(std::string(kT2DnsName, arraysize(kT2DnsName)), kT2Qtype, |
114 writes3_.push_back( | 153 new DnsResponse(reinterpret_cast<const char*>(kT2ResponseDatagram), |
115 MockWrite(true, reinterpret_cast<const char*>(kT3QueryDatagram), | 154 arraysize(kT2ResponseDatagram), |
116 arraysize(kT3QueryDatagram))); | 155 arraysize(kT2QueryDatagram))); |
117 reads3_.push_back( | |
118 MockRead(true, reinterpret_cast<const char*>(kT3ResponseDatagram), | |
119 arraysize(kT3ResponseDatagram))); | |
120 data3_.reset(new StaticSocketDataProvider(&reads3_[0], reads3_.size(), | |
121 &writes3_[0], writes3_.size())); | |
122 | 156 |
123 factory_.AddSocketDataProvider(data0_.get()); | 157 AddResponse(std::string(kT3DnsName, arraysize(kT3DnsName)), kT3Qtype, |
124 factory_.AddSocketDataProvider(data1_.get()); | 158 new DnsResponse(reinterpret_cast<const char*>(kT3ResponseDatagram), |
125 factory_.AddSocketDataProvider(data2_.get()); | 159 arraysize(kT3ResponseDatagram), |
126 factory_.AddSocketDataProvider(data3_.get()); | 160 arraysize(kT3QueryDatagram))); |
127 | |
128 IPEndPoint dns_server; | |
129 bool rv0 = CreateDnsAddress(kDnsIp, kDnsPort, &dns_server); | |
130 DCHECK(rv0); | |
131 | 161 |
132 resolver_.reset( | 162 resolver_.reset( |
133 new AsyncHostResolver( | 163 new AsyncHostResolver(kMaxTransactions, kMaxPendingRequests, |
134 dns_server, kMaxTransactions, kMaxPendingRequests, rand_int_cb_, | 164 HostCache::CreateDefaultCache(), |
135 HostCache::CreateDefaultCache(), &factory_, NULL)); | 165 client_.get(), NULL)); |
| 166 } |
| 167 |
| 168 void AddResponse(const std::string& name, uint8 type, DnsResponse* response) { |
| 169 client_->responses[MockDnsClient::Key(name, type)] = response; |
136 } | 170 } |
137 | 171 |
138 protected: | 172 protected: |
139 AddressList addrlist0_, addrlist1_, addrlist2_, addrlist3_; | 173 AddressList addrlist0_, addrlist1_, addrlist2_, addrlist3_; |
140 HostResolver::RequestInfo info0_, info1_, info2_, info3_; | 174 HostResolver::RequestInfo info0_, info1_, info2_, info3_; |
141 std::vector<MockWrite> writes0_, writes1_, writes2_, writes3_; | |
142 std::vector<MockRead> reads0_, reads1_, reads2_, reads3_; | |
143 scoped_ptr<StaticSocketDataProvider> data0_, data1_, data2_, data3_; | |
144 std::vector<const char*> ip_addresses0_, ip_addresses1_, | 175 std::vector<const char*> ip_addresses0_, ip_addresses1_, |
145 ip_addresses2_, ip_addresses3_; | 176 ip_addresses2_, ip_addresses3_; |
146 MockClientSocketFactory factory_; | |
147 TestPrng test_prng_; | |
148 RandIntCallback rand_int_cb_; | |
149 scoped_ptr<HostResolver> resolver_; | 177 scoped_ptr<HostResolver> resolver_; |
| 178 scoped_ptr<MockDnsClient> client_; |
150 TestCompletionCallback callback0_, callback1_, callback2_, callback3_; | 179 TestCompletionCallback callback0_, callback1_, callback2_, callback3_; |
151 }; | 180 }; |
152 | 181 |
153 TEST_F(AsyncHostResolverTest, EmptyHostLookup) { | 182 TEST_F(AsyncHostResolverTest, EmptyHostLookup) { |
154 info0_.set_host_port_pair(HostPortPair("", kPortNum)); | 183 info0_.set_host_port_pair(HostPortPair("", kPortNum)); |
155 int rv = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), NULL, | 184 int rv = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), NULL, |
156 BoundNetLog()); | 185 BoundNetLog()); |
157 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); | 186 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); |
158 } | 187 } |
159 | 188 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 VerifyAddressList(ip_addresses0_, kPortNum, addrlist0_); | 264 VerifyAddressList(ip_addresses0_, kPortNum, addrlist0_); |
236 | 265 |
237 rv1 = callback1_.WaitForResult(); | 266 rv1 = callback1_.WaitForResult(); |
238 EXPECT_EQ(OK, rv1); | 267 EXPECT_EQ(OK, rv1); |
239 VerifyAddressList(ip_addresses1_, kPortNum, addrlist1_); | 268 VerifyAddressList(ip_addresses1_, kPortNum, addrlist1_); |
240 | 269 |
241 rv2 = callback2_.WaitForResult(); | 270 rv2 = callback2_.WaitForResult(); |
242 EXPECT_EQ(OK, rv2); | 271 EXPECT_EQ(OK, rv2); |
243 VerifyAddressList(ip_addresses2_, kPortNum, addrlist2_); | 272 VerifyAddressList(ip_addresses2_, kPortNum, addrlist2_); |
244 | 273 |
245 EXPECT_EQ(3u, factory_.udp_client_sockets().size()); | 274 EXPECT_EQ(3, client_->num_requests); |
246 } | 275 } |
247 | 276 |
248 TEST_F(AsyncHostResolverTest, SameHostLookupsConsumeSingleTransaction) { | 277 TEST_F(AsyncHostResolverTest, SameHostLookupsConsumeSingleTransaction) { |
249 // We pass the info0_ to all requests. | 278 // We pass the info0_ to all requests. |
250 int rv0 = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), NULL, | 279 int rv0 = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), NULL, |
251 BoundNetLog()); | 280 BoundNetLog()); |
252 int rv1 = resolver_->Resolve(info0_, &addrlist1_, callback1_.callback(), NULL, | 281 int rv1 = resolver_->Resolve(info0_, &addrlist1_, callback1_.callback(), NULL, |
253 BoundNetLog()); | 282 BoundNetLog()); |
254 int rv2 = resolver_->Resolve(info0_, &addrlist2_, callback2_.callback(), NULL, | 283 int rv2 = resolver_->Resolve(info0_, &addrlist2_, callback2_.callback(), NULL, |
255 BoundNetLog()); | 284 BoundNetLog()); |
256 EXPECT_EQ(ERR_IO_PENDING, rv0); | 285 EXPECT_EQ(ERR_IO_PENDING, rv0); |
257 EXPECT_EQ(ERR_IO_PENDING, rv1); | 286 EXPECT_EQ(ERR_IO_PENDING, rv1); |
258 EXPECT_EQ(ERR_IO_PENDING, rv2); | 287 EXPECT_EQ(ERR_IO_PENDING, rv2); |
259 | 288 |
260 rv0 = callback0_.WaitForResult(); | 289 rv0 = callback0_.WaitForResult(); |
261 EXPECT_EQ(OK, rv0); | 290 EXPECT_EQ(OK, rv0); |
262 VerifyAddressList(ip_addresses0_, kPortNum, addrlist0_); | 291 VerifyAddressList(ip_addresses0_, kPortNum, addrlist0_); |
263 | 292 |
264 rv1 = callback1_.WaitForResult(); | 293 rv1 = callback1_.WaitForResult(); |
265 EXPECT_EQ(OK, rv1); | 294 EXPECT_EQ(OK, rv1); |
266 VerifyAddressList(ip_addresses0_, kPortNum, addrlist1_); | 295 VerifyAddressList(ip_addresses0_, kPortNum, addrlist1_); |
267 | 296 |
268 rv2 = callback2_.WaitForResult(); | 297 rv2 = callback2_.WaitForResult(); |
269 EXPECT_EQ(OK, rv2); | 298 EXPECT_EQ(OK, rv2); |
270 VerifyAddressList(ip_addresses0_, kPortNum, addrlist2_); | 299 VerifyAddressList(ip_addresses0_, kPortNum, addrlist2_); |
271 | 300 |
272 // Although we have three lookups, a single UDP socket was used. | 301 // Although we have three lookups, a single UDP socket was used. |
273 EXPECT_EQ(1u, factory_.udp_client_sockets().size()); | 302 EXPECT_EQ(1, client_->num_requests); |
274 } | 303 } |
275 | 304 |
276 TEST_F(AsyncHostResolverTest, CancelLookup) { | 305 TEST_F(AsyncHostResolverTest, CancelLookup) { |
277 HostResolver::RequestHandle req0 = NULL, req2 = NULL; | 306 HostResolver::RequestHandle req0 = NULL, req2 = NULL; |
278 int rv0 = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), | 307 int rv0 = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), |
279 &req0, BoundNetLog()); | 308 &req0, BoundNetLog()); |
280 int rv1 = resolver_->Resolve(info1_, &addrlist1_, callback1_.callback(), NULL, | 309 int rv1 = resolver_->Resolve(info1_, &addrlist1_, callback1_.callback(), NULL, |
281 BoundNetLog()); | 310 BoundNetLog()); |
282 int rv2 = resolver_->Resolve(info2_, &addrlist2_, callback2_.callback(), | 311 int rv2 = resolver_->Resolve(info2_, &addrlist2_, callback2_.callback(), |
283 &req2, BoundNetLog()); | 312 &req2, BoundNetLog()); |
(...skipping 28 matching lines...) Expand all Loading... |
312 EXPECT_EQ(ERR_IO_PENDING, rv1); | 341 EXPECT_EQ(ERR_IO_PENDING, rv1); |
313 | 342 |
314 resolver_->CancelRequest(req0); | 343 resolver_->CancelRequest(req0); |
315 MessageLoop::current()->RunAllPending(); | 344 MessageLoop::current()->RunAllPending(); |
316 EXPECT_FALSE(callback0_.have_result()); | 345 EXPECT_FALSE(callback0_.have_result()); |
317 | 346 |
318 rv1 = callback1_.WaitForResult(); | 347 rv1 = callback1_.WaitForResult(); |
319 EXPECT_EQ(OK, rv1); | 348 EXPECT_EQ(OK, rv1); |
320 VerifyAddressList(ip_addresses0_, kPortNum, addrlist1_); | 349 VerifyAddressList(ip_addresses0_, kPortNum, addrlist1_); |
321 | 350 |
322 EXPECT_EQ(1u, factory_.udp_client_sockets().size()); | 351 EXPECT_EQ(1, client_->num_requests); |
323 } | 352 } |
324 | 353 |
325 // Test that a queued lookup completes. | 354 // Test that a queued lookup completes. |
326 TEST_F(AsyncHostResolverTest, QueuedLookup) { | 355 TEST_F(AsyncHostResolverTest, QueuedLookup) { |
327 // kMaxTransactions is 2, thus the following requests consume all | 356 // kMaxTransactions is 2, thus the following requests consume all |
328 // available transactions. | 357 // available transactions. |
329 int rv0 = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), NULL, | 358 int rv0 = resolver_->Resolve(info0_, &addrlist0_, callback0_.callback(), NULL, |
330 BoundNetLog()); | 359 BoundNetLog()); |
331 int rv1 = resolver_->Resolve(info1_, &addrlist1_, callback1_.callback(), NULL, | 360 int rv1 = resolver_->Resolve(info1_, &addrlist1_, callback1_.callback(), NULL, |
332 BoundNetLog()); | 361 BoundNetLog()); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 rv_fail = callback_fail.WaitForResult(); | 510 rv_fail = callback_fail.WaitForResult(); |
482 EXPECT_EQ(ERR_HOST_RESOLVER_QUEUE_TOO_LARGE, rv_fail); | 511 EXPECT_EQ(ERR_HOST_RESOLVER_QUEUE_TOO_LARGE, rv_fail); |
483 EXPECT_EQ(static_cast<addrinfo*>(NULL), addrlist_fail.head()); | 512 EXPECT_EQ(static_cast<addrinfo*>(NULL), addrlist_fail.head()); |
484 | 513 |
485 rv2 = callback2_.WaitForResult(); | 514 rv2 = callback2_.WaitForResult(); |
486 EXPECT_EQ(OK, rv2); | 515 EXPECT_EQ(OK, rv2); |
487 VerifyAddressList(ip_addresses2_, kPortNum, addrlist2_); | 516 VerifyAddressList(ip_addresses2_, kPortNum, addrlist2_); |
488 } | 517 } |
489 | 518 |
490 } // namespace net | 519 } // namespace net |
OLD | NEW |