OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/host_resolver_impl.h" | 5 #include "net/dns/host_resolver_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 HostResolverImpl::Options options = DefaultOptions(); | 557 HostResolverImpl::Options options = DefaultOptions(); |
558 options.max_concurrent_resolves = max_concurrent_resolves; | 558 options.max_concurrent_resolves = max_concurrent_resolves; |
559 resolver_.reset(new TestHostResolverImpl(options, NULL)); | 559 resolver_.reset(new TestHostResolverImpl(options, NULL)); |
560 resolver_->set_proc_params_for_test(params); | 560 resolver_->set_proc_params_for_test(params); |
561 } | 561 } |
562 | 562 |
563 // The Request will not be made until a call to |Resolve()|, and the Job will | 563 // The Request will not be made until a call to |Resolve()|, and the Job will |
564 // not start until released by |proc_->SignalXXX|. | 564 // not start until released by |proc_->SignalXXX|. |
565 Request* CreateRequest(const HostResolver::RequestInfo& info, | 565 Request* CreateRequest(const HostResolver::RequestInfo& info, |
566 RequestPriority priority) { | 566 RequestPriority priority) { |
567 requests_.push_back(base::WrapUnique(new Request( | 567 requests_.push_back(base::MakeUnique<Request>( |
568 info, priority, requests_.size(), resolver_.get(), handler_.get()))); | 568 info, priority, requests_.size(), resolver_.get(), handler_.get())); |
569 return requests_.back().get(); | 569 return requests_.back().get(); |
570 } | 570 } |
571 | 571 |
572 Request* CreateRequest(const std::string& hostname, | 572 Request* CreateRequest(const std::string& hostname, |
573 int port, | 573 int port, |
574 RequestPriority priority, | 574 RequestPriority priority, |
575 AddressFamily family) { | 575 AddressFamily family) { |
576 HostResolver::RequestInfo info(HostPortPair(hostname, port)); | 576 HostResolver::RequestInfo info(HostPortPair(hostname, port)); |
577 info.set_address_family(family); | 577 info.set_address_family(family); |
578 return CreateRequest(info, priority); | 578 return CreateRequest(info, priority); |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 EXPECT_EQ(1, count2); | 2455 EXPECT_EQ(1, count2); |
2456 | 2456 |
2457 // Make another request to make sure both callbacks were cleared. | 2457 // Make another request to make sure both callbacks were cleared. |
2458 req = CreateRequest("just.testing", 80); | 2458 req = CreateRequest("just.testing", 80); |
2459 EXPECT_THAT(req->Resolve(), IsOk()); | 2459 EXPECT_THAT(req->Resolve(), IsOk()); |
2460 EXPECT_EQ(2, count1); | 2460 EXPECT_EQ(2, count1); |
2461 EXPECT_EQ(1, count2); | 2461 EXPECT_EQ(1, count2); |
2462 } | 2462 } |
2463 | 2463 |
2464 } // namespace net | 2464 } // namespace net |
OLD | NEW |