| 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/mock_host_resolver.h" | 5 #include "net/dns/mock_host_resolver.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 addresses->SetDefaultCanonicalName(); | 168 addresses->SetDefaultCanonicalName(); |
| 169 return OK; | 169 return OK; |
| 170 } | 170 } |
| 171 int rv = ERR_DNS_CACHE_MISS; | 171 int rv = ERR_DNS_CACHE_MISS; |
| 172 if (cache_.get() && info.allow_cached_response()) { | 172 if (cache_.get() && info.allow_cached_response()) { |
| 173 HostCache::Key key(info.hostname(), | 173 HostCache::Key key(info.hostname(), |
| 174 info.address_family(), | 174 info.address_family(), |
| 175 info.host_resolver_flags()); | 175 info.host_resolver_flags()); |
| 176 const HostCache::Entry* entry = cache_->Lookup(key, base::TimeTicks::Now()); | 176 const HostCache::Entry* entry = cache_->Lookup(key, base::TimeTicks::Now()); |
| 177 if (entry) { | 177 if (entry) { |
| 178 rv = entry->error; | 178 rv = entry->error(); |
| 179 if (rv == OK) | 179 if (rv == OK) |
| 180 *addresses = AddressList::CopyWithPort(entry->addrlist, info.port()); | 180 *addresses = AddressList::CopyWithPort(entry->addresses(), info.port()); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 return rv; | 183 return rv; |
| 184 } | 184 } |
| 185 | 185 |
| 186 int MockHostResolverBase::ResolveProc(size_t id, | 186 int MockHostResolverBase::ResolveProc(size_t id, |
| 187 const RequestInfo& info, | 187 const RequestInfo& info, |
| 188 AddressList* addresses) { | 188 AddressList* addresses) { |
| 189 AddressList addr; | 189 AddressList addr; |
| 190 int rv = rules_->Resolve(info.hostname(), | 190 int rv = rules_->Resolve(info.hostname(), |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 CHECK_EQ(old_proc, current_proc_.get()); | 452 CHECK_EQ(old_proc, current_proc_.get()); |
| 453 } | 453 } |
| 454 | 454 |
| 455 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { | 455 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { |
| 456 current_proc_ = proc; | 456 current_proc_ = proc; |
| 457 previous_proc_ = HostResolverProc::SetDefault(current_proc_.get()); | 457 previous_proc_ = HostResolverProc::SetDefault(current_proc_.get()); |
| 458 current_proc_->SetLastProc(previous_proc_.get()); | 458 current_proc_->SetLastProc(previous_proc_.get()); |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace net | 461 } // namespace net |
| OLD | NEW |