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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void AddRuleForAllFamilies(const std::string& hostname, | 118 void AddRuleForAllFamilies(const std::string& hostname, |
119 const std::string& ip_list) { | 119 const std::string& ip_list) { |
120 AddressList result; | 120 AddressList result; |
121 int rv = ParseAddressList(ip_list, std::string(), &result); | 121 int rv = ParseAddressList(ip_list, std::string(), &result); |
122 DCHECK_EQ(OK, rv); | 122 DCHECK_EQ(OK, rv); |
123 AddRule(hostname, ADDRESS_FAMILY_UNSPECIFIED, result); | 123 AddRule(hostname, ADDRESS_FAMILY_UNSPECIFIED, result); |
124 AddRule(hostname, ADDRESS_FAMILY_IPV4, result); | 124 AddRule(hostname, ADDRESS_FAMILY_IPV4, result); |
125 AddRule(hostname, ADDRESS_FAMILY_IPV6, result); | 125 AddRule(hostname, ADDRESS_FAMILY_IPV6, result); |
126 } | 126 } |
127 | 127 |
128 virtual int Resolve(const std::string& hostname, | 128 int Resolve(const std::string& hostname, |
129 AddressFamily address_family, | 129 AddressFamily address_family, |
130 HostResolverFlags host_resolver_flags, | 130 HostResolverFlags host_resolver_flags, |
131 AddressList* addrlist, | 131 AddressList* addrlist, |
132 int* os_error) override { | 132 int* os_error) override { |
133 base::AutoLock lock(lock_); | 133 base::AutoLock lock(lock_); |
134 capture_list_.push_back(ResolveKey(hostname, address_family)); | 134 capture_list_.push_back(ResolveKey(hostname, address_family)); |
135 ++num_requests_waiting_; | 135 ++num_requests_waiting_; |
136 requests_waiting_.Broadcast(); | 136 requests_waiting_.Broadcast(); |
137 while (!num_slots_available_) | 137 while (!num_slots_available_) |
138 slots_available_.Wait(); | 138 slots_available_.Wait(); |
139 DCHECK_GT(num_requests_waiting_, 0u); | 139 DCHECK_GT(num_requests_waiting_, 0u); |
140 --num_slots_available_; | 140 --num_slots_available_; |
141 --num_requests_waiting_; | 141 --num_requests_waiting_; |
142 if (rules_.empty()) { | 142 if (rules_.empty()) { |
(...skipping 16 matching lines...) Expand all Loading... |
159 } | 159 } |
160 return copy; | 160 return copy; |
161 } | 161 } |
162 | 162 |
163 bool HasBlockedRequests() const { | 163 bool HasBlockedRequests() const { |
164 base::AutoLock lock(lock_); | 164 base::AutoLock lock(lock_); |
165 return num_requests_waiting_ > num_slots_available_; | 165 return num_requests_waiting_ > num_slots_available_; |
166 } | 166 } |
167 | 167 |
168 protected: | 168 protected: |
169 virtual ~MockHostResolverProc() {} | 169 ~MockHostResolverProc() override {} |
170 | 170 |
171 private: | 171 private: |
172 mutable base::Lock lock_; | 172 mutable base::Lock lock_; |
173 std::map<ResolveKey, AddressList> rules_; | 173 std::map<ResolveKey, AddressList> rules_; |
174 CaptureList capture_list_; | 174 CaptureList capture_list_; |
175 unsigned num_requests_waiting_; | 175 unsigned num_requests_waiting_; |
176 unsigned num_slots_available_; | 176 unsigned num_slots_available_; |
177 base::ConditionVariable requests_waiting_; | 177 base::ConditionVariable requests_waiting_; |
178 base::ConditionVariable slots_available_; | 178 base::ConditionVariable slots_available_; |
179 | 179 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 all_done_.Broadcast(); // Tell all waiting attempts to proceed. | 354 all_done_.Broadcast(); // Tell all waiting attempts to proceed. |
355 } | 355 } |
356 | 356 |
357 // Returns the number of attempts that have finished the Resolve() method. | 357 // Returns the number of attempts that have finished the Resolve() method. |
358 int total_attempts_resolved() { return total_attempts_resolved_; } | 358 int total_attempts_resolved() { return total_attempts_resolved_; } |
359 | 359 |
360 // Returns the first attempt that that has resolved the host. | 360 // Returns the first attempt that that has resolved the host. |
361 int resolved_attempt_number() { return resolved_attempt_number_; } | 361 int resolved_attempt_number() { return resolved_attempt_number_; } |
362 | 362 |
363 // HostResolverProc methods. | 363 // HostResolverProc methods. |
364 virtual int Resolve(const std::string& host, | 364 int Resolve(const std::string& host, |
365 AddressFamily address_family, | 365 AddressFamily address_family, |
366 HostResolverFlags host_resolver_flags, | 366 HostResolverFlags host_resolver_flags, |
367 AddressList* addrlist, | 367 AddressList* addrlist, |
368 int* os_error) override { | 368 int* os_error) override { |
369 bool wait_for_right_attempt_to_complete = true; | 369 bool wait_for_right_attempt_to_complete = true; |
370 { | 370 { |
371 base::AutoLock auto_lock(lock_); | 371 base::AutoLock auto_lock(lock_); |
372 ++current_attempt_number_; | 372 ++current_attempt_number_; |
373 if (current_attempt_number_ == attempt_number_to_resolve_) { | 373 if (current_attempt_number_ == attempt_number_to_resolve_) { |
374 resolved_attempt_number_ = current_attempt_number_; | 374 resolved_attempt_number_ = current_attempt_number_; |
375 wait_for_right_attempt_to_complete = false; | 375 wait_for_right_attempt_to_complete = false; |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
(...skipping 15 matching lines...) Expand all Loading... |
394 // special meaning (ERR_IO_PENDING). We could return the attempt that has | 394 // special meaning (ERR_IO_PENDING). We could return the attempt that has |
395 // resolved the host as a negative number. For example, if attempt number 3 | 395 // resolved the host as a negative number. For example, if attempt number 3 |
396 // resolves the host, then this method returns -4. | 396 // resolves the host, then this method returns -4. |
397 if (result == OK) | 397 if (result == OK) |
398 return -1 - resolved_attempt_number_; | 398 return -1 - resolved_attempt_number_; |
399 else | 399 else |
400 return result; | 400 return result; |
401 } | 401 } |
402 | 402 |
403 protected: | 403 protected: |
404 virtual ~LookupAttemptHostResolverProc() {} | 404 ~LookupAttemptHostResolverProc() override {} |
405 | 405 |
406 private: | 406 private: |
407 int attempt_number_to_resolve_; | 407 int attempt_number_to_resolve_; |
408 int current_attempt_number_; // Incremented whenever Resolve is called. | 408 int current_attempt_number_; // Incremented whenever Resolve is called. |
409 int total_attempts_; | 409 int total_attempts_; |
410 int total_attempts_resolved_; | 410 int total_attempts_resolved_; |
411 int resolved_attempt_number_; | 411 int resolved_attempt_number_; |
412 | 412 |
413 // All attempts wait for right attempt to be resolve. | 413 // All attempts wait for right attempt to be resolve. |
414 base::Lock lock_; | 414 base::Lock lock_; |
(...skipping 17 matching lines...) Expand all Loading... |
432 // perform no retries. | 432 // perform no retries. |
433 void CreateSerialResolver() { | 433 void CreateSerialResolver() { |
434 HostResolverImpl::ProcTaskParams params = DefaultParams(proc_.get()); | 434 HostResolverImpl::ProcTaskParams params = DefaultParams(proc_.get()); |
435 params.max_retry_attempts = 0u; | 435 params.max_retry_attempts = 0u; |
436 CreateResolverWithLimitsAndParams(1u, params); | 436 CreateResolverWithLimitsAndParams(1u, params); |
437 } | 437 } |
438 | 438 |
439 protected: | 439 protected: |
440 // A Request::Handler which is a proxy to the HostResolverImplTest fixture. | 440 // A Request::Handler which is a proxy to the HostResolverImplTest fixture. |
441 struct Handler : public Request::Handler { | 441 struct Handler : public Request::Handler { |
442 virtual ~Handler() {} | 442 ~Handler() override {} |
443 | 443 |
444 // Proxy functions so that classes derived from Handler can access them. | 444 // Proxy functions so that classes derived from Handler can access them. |
445 Request* CreateRequest(const HostResolver::RequestInfo& info, | 445 Request* CreateRequest(const HostResolver::RequestInfo& info, |
446 RequestPriority priority) { | 446 RequestPriority priority) { |
447 return test->CreateRequest(info, priority); | 447 return test->CreateRequest(info, priority); |
448 } | 448 } |
449 Request* CreateRequest(const std::string& hostname, int port) { | 449 Request* CreateRequest(const std::string& hostname, int port) { |
450 return test->CreateRequest(hostname, port); | 450 return test->CreateRequest(hostname, port); |
451 } | 451 } |
452 Request* CreateRequest(const std::string& hostname) { | 452 Request* CreateRequest(const std::string& hostname) { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 725 |
726 proc_->SignalAll(); | 726 proc_->SignalAll(); |
727 | 727 |
728 size_t num_requests = requests_.size(); | 728 size_t num_requests = requests_.size(); |
729 EXPECT_EQ(OK, requests_[num_requests - 1]->WaitForResult()); | 729 EXPECT_EQ(OK, requests_[num_requests - 1]->WaitForResult()); |
730 EXPECT_EQ(OK, requests_[num_requests - 2]->result()); | 730 EXPECT_EQ(OK, requests_[num_requests - 2]->result()); |
731 } | 731 } |
732 | 732 |
733 TEST_F(HostResolverImplTest, CancelWithinCallback) { | 733 TEST_F(HostResolverImplTest, CancelWithinCallback) { |
734 struct MyHandler : public Handler { | 734 struct MyHandler : public Handler { |
735 virtual void Handle(Request* req) override { | 735 void Handle(Request* req) override { |
736 // Port 80 is the first request that the callback will be invoked for. | 736 // Port 80 is the first request that the callback will be invoked for. |
737 // While we are executing within that callback, cancel the other requests | 737 // While we are executing within that callback, cancel the other requests |
738 // in the job and start another request. | 738 // in the job and start another request. |
739 if (req->index() == 0) { | 739 if (req->index() == 0) { |
740 // Once "a:80" completes, it will cancel "a:81" and "a:82". | 740 // Once "a:80" completes, it will cancel "a:81" and "a:82". |
741 requests()[1]->Cancel(); | 741 requests()[1]->Cancel(); |
742 requests()[2]->Cancel(); | 742 requests()[2]->Cancel(); |
743 } | 743 } |
744 } | 744 } |
745 }; | 745 }; |
746 set_handler(new MyHandler()); | 746 set_handler(new MyHandler()); |
747 | 747 |
748 for (size_t i = 0; i < 4; ++i) { | 748 for (size_t i = 0; i < 4; ++i) { |
749 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 80 + i)->Resolve()) << i; | 749 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 80 + i)->Resolve()) << i; |
750 } | 750 } |
751 | 751 |
752 proc_->SignalMultiple(2u); // One for "a". One for "finalrequest". | 752 proc_->SignalMultiple(2u); // One for "a". One for "finalrequest". |
753 | 753 |
754 EXPECT_EQ(OK, requests_[0]->WaitForResult()); | 754 EXPECT_EQ(OK, requests_[0]->WaitForResult()); |
755 | 755 |
756 Request* final_request = CreateRequest("finalrequest", 70); | 756 Request* final_request = CreateRequest("finalrequest", 70); |
757 EXPECT_EQ(ERR_IO_PENDING, final_request->Resolve()); | 757 EXPECT_EQ(ERR_IO_PENDING, final_request->Resolve()); |
758 EXPECT_EQ(OK, final_request->WaitForResult()); | 758 EXPECT_EQ(OK, final_request->WaitForResult()); |
759 EXPECT_TRUE(requests_[3]->completed()); | 759 EXPECT_TRUE(requests_[3]->completed()); |
760 } | 760 } |
761 | 761 |
762 TEST_F(HostResolverImplTest, DeleteWithinCallback) { | 762 TEST_F(HostResolverImplTest, DeleteWithinCallback) { |
763 struct MyHandler : public Handler { | 763 struct MyHandler : public Handler { |
764 virtual void Handle(Request* req) override { | 764 void Handle(Request* req) override { |
765 EXPECT_EQ("a", req->info().hostname()); | 765 EXPECT_EQ("a", req->info().hostname()); |
766 EXPECT_EQ(80, req->info().port()); | 766 EXPECT_EQ(80, req->info().port()); |
767 | 767 |
768 DeleteResolver(); | 768 DeleteResolver(); |
769 | 769 |
770 // Quit after returning from OnCompleted (to give it a chance at | 770 // Quit after returning from OnCompleted (to give it a chance at |
771 // incorrectly running the cancelled tasks). | 771 // incorrectly running the cancelled tasks). |
772 base::MessageLoop::current()->PostTask(FROM_HERE, | 772 base::MessageLoop::current()->PostTask(FROM_HERE, |
773 base::MessageLoop::QuitClosure()); | 773 base::MessageLoop::QuitClosure()); |
774 } | 774 } |
775 }; | 775 }; |
776 set_handler(new MyHandler()); | 776 set_handler(new MyHandler()); |
777 | 777 |
778 for (size_t i = 0; i < 4; ++i) { | 778 for (size_t i = 0; i < 4; ++i) { |
779 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 80 + i)->Resolve()) << i; | 779 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 80 + i)->Resolve()) << i; |
780 } | 780 } |
781 | 781 |
782 proc_->SignalMultiple(1u); // One for "a". | 782 proc_->SignalMultiple(1u); // One for "a". |
783 | 783 |
784 // |MyHandler| will send quit message once all the requests have finished. | 784 // |MyHandler| will send quit message once all the requests have finished. |
785 base::MessageLoop::current()->Run(); | 785 base::MessageLoop::current()->Run(); |
786 } | 786 } |
787 | 787 |
788 TEST_F(HostResolverImplTest, DeleteWithinAbortedCallback) { | 788 TEST_F(HostResolverImplTest, DeleteWithinAbortedCallback) { |
789 struct MyHandler : public Handler { | 789 struct MyHandler : public Handler { |
790 virtual void Handle(Request* req) override { | 790 void Handle(Request* req) override { |
791 EXPECT_EQ("a", req->info().hostname()); | 791 EXPECT_EQ("a", req->info().hostname()); |
792 EXPECT_EQ(80, req->info().port()); | 792 EXPECT_EQ(80, req->info().port()); |
793 | 793 |
794 DeleteResolver(); | 794 DeleteResolver(); |
795 | 795 |
796 // Quit after returning from OnCompleted (to give it a chance at | 796 // Quit after returning from OnCompleted (to give it a chance at |
797 // incorrectly running the cancelled tasks). | 797 // incorrectly running the cancelled tasks). |
798 base::MessageLoop::current()->PostTask(FROM_HERE, | 798 base::MessageLoop::current()->PostTask(FROM_HERE, |
799 base::MessageLoop::QuitClosure()); | 799 base::MessageLoop::QuitClosure()); |
800 } | 800 } |
(...skipping 19 matching lines...) Expand all Loading... |
820 EXPECT_EQ(ERR_NETWORK_CHANGED, requests_[0]->result()); | 820 EXPECT_EQ(ERR_NETWORK_CHANGED, requests_[0]->result()); |
821 EXPECT_EQ(ERR_IO_PENDING, requests_[1]->result()); | 821 EXPECT_EQ(ERR_IO_PENDING, requests_[1]->result()); |
822 EXPECT_EQ(ERR_IO_PENDING, requests_[2]->result()); | 822 EXPECT_EQ(ERR_IO_PENDING, requests_[2]->result()); |
823 EXPECT_EQ(ERR_IO_PENDING, requests_[3]->result()); | 823 EXPECT_EQ(ERR_IO_PENDING, requests_[3]->result()); |
824 // Clean up. | 824 // Clean up. |
825 proc_->SignalMultiple(requests_.size()); | 825 proc_->SignalMultiple(requests_.size()); |
826 } | 826 } |
827 | 827 |
828 TEST_F(HostResolverImplTest, StartWithinCallback) { | 828 TEST_F(HostResolverImplTest, StartWithinCallback) { |
829 struct MyHandler : public Handler { | 829 struct MyHandler : public Handler { |
830 virtual void Handle(Request* req) override { | 830 void Handle(Request* req) override { |
831 if (req->index() == 0) { | 831 if (req->index() == 0) { |
832 // On completing the first request, start another request for "a". | 832 // On completing the first request, start another request for "a". |
833 // Since caching is disabled, this will result in another async request. | 833 // Since caching is disabled, this will result in another async request. |
834 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 70)->Resolve()); | 834 EXPECT_EQ(ERR_IO_PENDING, CreateRequest("a", 70)->Resolve()); |
835 } | 835 } |
836 } | 836 } |
837 }; | 837 }; |
838 set_handler(new MyHandler()); | 838 set_handler(new MyHandler()); |
839 | 839 |
840 // Turn off caching for this host resolver. | 840 // Turn off caching for this host resolver. |
(...skipping 10 matching lines...) Expand all Loading... |
851 | 851 |
852 EXPECT_EQ(OK, requests_[0]->WaitForResult()); | 852 EXPECT_EQ(OK, requests_[0]->WaitForResult()); |
853 ASSERT_EQ(5u, requests_.size()); | 853 ASSERT_EQ(5u, requests_.size()); |
854 EXPECT_EQ(OK, requests_.back()->WaitForResult()); | 854 EXPECT_EQ(OK, requests_.back()->WaitForResult()); |
855 | 855 |
856 EXPECT_EQ(2u, proc_->GetCaptureList().size()); | 856 EXPECT_EQ(2u, proc_->GetCaptureList().size()); |
857 } | 857 } |
858 | 858 |
859 TEST_F(HostResolverImplTest, BypassCache) { | 859 TEST_F(HostResolverImplTest, BypassCache) { |
860 struct MyHandler : public Handler { | 860 struct MyHandler : public Handler { |
861 virtual void Handle(Request* req) override { | 861 void Handle(Request* req) override { |
862 if (req->index() == 0) { | 862 if (req->index() == 0) { |
863 // On completing the first request, start another request for "a". | 863 // On completing the first request, start another request for "a". |
864 // Since caching is enabled, this should complete synchronously. | 864 // Since caching is enabled, this should complete synchronously. |
865 std::string hostname = req->info().hostname(); | 865 std::string hostname = req->info().hostname(); |
866 EXPECT_EQ(OK, CreateRequest(hostname, 70)->Resolve()); | 866 EXPECT_EQ(OK, CreateRequest(hostname, 70)->Resolve()); |
867 EXPECT_EQ(OK, CreateRequest(hostname, 75)->ResolveFromCache()); | 867 EXPECT_EQ(OK, CreateRequest(hostname, 75)->ResolveFromCache()); |
868 | 868 |
869 // Ok good. Now make sure that if we ask to bypass the cache, it can no | 869 // Ok good. Now make sure that if we ask to bypass the cache, it can no |
870 // longer service the request synchronously. | 870 // longer service the request synchronously. |
871 HostResolver::RequestInfo info(HostPortPair(hostname, 71)); | 871 HostResolver::RequestInfo info(HostPortPair(hostname, 71)); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 EXPECT_FALSE(requests_[2]->completed()); | 949 EXPECT_FALSE(requests_[2]->completed()); |
950 | 950 |
951 EXPECT_EQ(OK, requests_[2]->WaitForResult()); | 951 EXPECT_EQ(OK, requests_[2]->WaitForResult()); |
952 EXPECT_EQ(OK, requests_[1]->result()); | 952 EXPECT_EQ(OK, requests_[1]->result()); |
953 } | 953 } |
954 | 954 |
955 // Tests that a new Request made from the callback of a previously aborted one | 955 // Tests that a new Request made from the callback of a previously aborted one |
956 // will not be aborted. | 956 // will not be aborted. |
957 TEST_F(HostResolverImplTest, AbortOnlyExistingRequestsOnIPAddressChange) { | 957 TEST_F(HostResolverImplTest, AbortOnlyExistingRequestsOnIPAddressChange) { |
958 struct MyHandler : public Handler { | 958 struct MyHandler : public Handler { |
959 virtual void Handle(Request* req) override { | 959 void Handle(Request* req) override { |
960 // Start new request for a different hostname to ensure that the order | 960 // Start new request for a different hostname to ensure that the order |
961 // of jobs in HostResolverImpl is not stable. | 961 // of jobs in HostResolverImpl is not stable. |
962 std::string hostname; | 962 std::string hostname; |
963 if (req->index() == 0) | 963 if (req->index() == 0) |
964 hostname = "zzz"; | 964 hostname = "zzz"; |
965 else if (req->index() == 1) | 965 else if (req->index() == 1) |
966 hostname = "aaa"; | 966 hostname = "aaa"; |
967 else if (req->index() == 2) | 967 else if (req->index() == 2) |
968 hostname = "eee"; | 968 hostname = "eee"; |
969 else | 969 else |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 AddDnsRule("4slow_4timeout", dns_protocol::kTypeAAAA, MockDnsClientRule::OK, | 1372 AddDnsRule("4slow_4timeout", dns_protocol::kTypeAAAA, MockDnsClientRule::OK, |
1373 false); | 1373 false); |
1374 AddDnsRule("4slow_6timeout", dns_protocol::kTypeA, | 1374 AddDnsRule("4slow_6timeout", dns_protocol::kTypeA, |
1375 MockDnsClientRule::OK, true); | 1375 MockDnsClientRule::OK, true); |
1376 AddDnsRule("4slow_6timeout", dns_protocol::kTypeAAAA, | 1376 AddDnsRule("4slow_6timeout", dns_protocol::kTypeAAAA, |
1377 MockDnsClientRule::TIMEOUT, false); | 1377 MockDnsClientRule::TIMEOUT, false); |
1378 CreateResolver(); | 1378 CreateResolver(); |
1379 } | 1379 } |
1380 | 1380 |
1381 // HostResolverImplTest implementation: | 1381 // HostResolverImplTest implementation: |
1382 virtual void CreateResolverWithLimitsAndParams( | 1382 void CreateResolverWithLimitsAndParams( |
1383 size_t max_concurrent_resolves, | 1383 size_t max_concurrent_resolves, |
1384 const HostResolverImpl::ProcTaskParams& params) override { | 1384 const HostResolverImpl::ProcTaskParams& params) override { |
1385 HostResolverImpl::Options options = DefaultOptions(); | 1385 HostResolverImpl::Options options = DefaultOptions(); |
1386 options.max_concurrent_resolves = max_concurrent_resolves; | 1386 options.max_concurrent_resolves = max_concurrent_resolves; |
1387 resolver_.reset(new HostResolverImpl(options, NULL)); | 1387 resolver_.reset(new HostResolverImpl(options, NULL)); |
1388 resolver_->set_proc_params_for_test(params); | 1388 resolver_->set_proc_params_for_test(params); |
1389 // Disable IPv6 support probing. | 1389 // Disable IPv6 support probing. |
1390 resolver_->SetDefaultAddressFamily(ADDRESS_FAMILY_UNSPECIFIED); | 1390 resolver_->SetDefaultAddressFamily(ADDRESS_FAMILY_UNSPECIFIED); |
1391 dns_client_ = new MockDnsClient(DnsConfig(), dns_rules_); | 1391 dns_client_ = new MockDnsClient(DnsConfig(), dns_rules_); |
1392 resolver_->SetDnsClient(scoped_ptr<DnsClient>(dns_client_)); | 1392 resolver_->SetDnsClient(scoped_ptr<DnsClient>(dns_client_)); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 | 2098 |
2099 EXPECT_EQ(OK, requests_[0]->WaitForResult()); | 2099 EXPECT_EQ(OK, requests_[0]->WaitForResult()); |
2100 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); | 2100 EXPECT_TRUE(requests_[0]->HasOneAddress("192.168.0.1", 80)); |
2101 EXPECT_EQ(OK, requests_[1]->WaitForResult()); | 2101 EXPECT_EQ(OK, requests_[1]->WaitForResult()); |
2102 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); | 2102 EXPECT_TRUE(requests_[1]->HasOneAddress("192.168.0.2", 80)); |
2103 EXPECT_EQ(OK, requests_[2]->WaitForResult()); | 2103 EXPECT_EQ(OK, requests_[2]->WaitForResult()); |
2104 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); | 2104 EXPECT_TRUE(requests_[2]->HasOneAddress("192.168.0.3", 80)); |
2105 } | 2105 } |
2106 | 2106 |
2107 } // namespace net | 2107 } // namespace net |
OLD | NEW |