| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/base/host_resolver_impl.h" | 5 #include "net/base/host_resolver_impl.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <ws2tcpip.h> | 8 #include <ws2tcpip.h> |
| 9 #include <wspiapi.h> | 9 #include <wspiapi.h> |
| 10 #elif defined(OS_POSIX) | 10 #elif defined(OS_POSIX) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 class CapturingHostResolverProc : public HostResolverProc { | 39 class CapturingHostResolverProc : public HostResolverProc { |
| 40 public: | 40 public: |
| 41 explicit CapturingHostResolverProc(HostResolverProc* previous) | 41 explicit CapturingHostResolverProc(HostResolverProc* previous) |
| 42 : HostResolverProc(previous), event_(true, false) { | 42 : HostResolverProc(previous), event_(true, false) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void Signal() { | 45 void Signal() { |
| 46 event_.Signal(); | 46 event_.Signal(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual int Resolve(const std::string& host, AddressList* addrlist) { | 49 virtual int Resolve(const std::string& host, |
| 50 AddressFamily address_family, |
| 51 AddressList* addrlist) { |
| 50 event_.Wait(); | 52 event_.Wait(); |
| 51 { | 53 { |
| 52 AutoLock l(lock_); | 54 AutoLock l(lock_); |
| 53 capture_list_.push_back(host); | 55 capture_list_.push_back(host); |
| 54 } | 56 } |
| 55 return ResolveUsingPrevious(host, addrlist); | 57 return ResolveUsingPrevious(host, address_family, addrlist); |
| 56 } | 58 } |
| 57 | 59 |
| 58 std::vector<std::string> GetCaptureList() const { | 60 std::vector<std::string> GetCaptureList() const { |
| 59 std::vector<std::string> copy; | 61 std::vector<std::string> copy; |
| 60 { | 62 { |
| 61 AutoLock l(lock_); | 63 AutoLock l(lock_); |
| 62 copy = capture_list_; | 64 copy = capture_list_; |
| 63 } | 65 } |
| 64 return copy; | 66 return copy; |
| 65 } | 67 } |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 EXPECT_EQ(0U, observer.finish_log.size()); | 954 EXPECT_EQ(0U, observer.finish_log.size()); |
| 953 EXPECT_EQ(2U, observer.cancel_log.size()); | 955 EXPECT_EQ(2U, observer.cancel_log.size()); |
| 954 | 956 |
| 955 HostResolver::RequestInfo info("host2", 60); | 957 HostResolver::RequestInfo info("host2", 60); |
| 956 EXPECT_TRUE(observer.cancel_log[1] == | 958 EXPECT_TRUE(observer.cancel_log[1] == |
| 957 CapturingObserver::StartOrCancelEntry(1, info)); | 959 CapturingObserver::StartOrCancelEntry(1, info)); |
| 958 } | 960 } |
| 959 | 961 |
| 960 } // namespace | 962 } // namespace |
| 961 } // namespace net | 963 } // namespace net |
| OLD | NEW |