Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: net/base/host_resolver_impl_unittest.cc

Issue 7466031: AsyncHostResolver: integrated HostCache, temporarily, until we have RR cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright year. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/host_resolver_impl.cc ('k') | net/base/net_log_event_type_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver_impl_unittest.cc
diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc
index a833599f6cab9479014898fe45c7dab300a04c95..73567d3842b322a87f3729715e8d22d4a7656a2b 100644
--- a/net/base/host_resolver_impl_unittest.cc
+++ b/net/base/host_resolver_impl_unittest.cc
@@ -17,6 +17,7 @@
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/base/dns_test_util.h"
+#include "net/base/host_cache.h"
#include "net/base/mock_host_resolver.h"
#include "net/base/net_errors.h"
#include "net/base/net_log_unittest.h"
@@ -34,19 +35,12 @@ namespace net {
using base::TimeDelta;
using base::TimeTicks;
-HostCache* CreateDefaultCache() {
- return new HostCache(
- 100, // max cache entries.
- base::TimeDelta::FromMinutes(1),
- base::TimeDelta::FromSeconds(0));
-}
-
static const size_t kMaxJobs = 10u;
static const size_t kMaxRetryAttempts = 4u;
HostResolverImpl* CreateHostResolverImpl(HostResolverProc* resolver_proc) {
- return new HostResolverImpl(resolver_proc, CreateDefaultCache(), kMaxJobs,
- kMaxRetryAttempts, NULL);
+ return new HostResolverImpl(resolver_proc, HostCache::CreateDefaultCache(),
+ kMaxJobs, kMaxRetryAttempts, NULL);
}
// Helper to create a HostResolver::RequestInfo.
@@ -451,7 +445,7 @@ TEST_F(HostResolverImplTest, CanceledAsynchronousLookup) {
{
scoped_ptr<HostResolver> host_resolver(
new HostResolverImpl(resolver_proc,
- CreateDefaultCache(),
+ HostCache::CreateDefaultCache(),
kMaxJobs,
kMaxRetryAttempts,
&net_log));
@@ -1134,7 +1128,7 @@ TEST_F(HostResolverImplTest, CancellationObserver) {
// Test that IP address changes flush the cache.
TEST_F(HostResolverImplTest, FlushCacheOnIPAddressChange) {
scoped_ptr<HostResolver> host_resolver(
- new HostResolverImpl(NULL, CreateDefaultCache(), kMaxJobs,
+ new HostResolverImpl(NULL, HostCache::CreateDefaultCache(), kMaxJobs,
kMaxRetryAttempts, NULL));
AddressList addrlist;
@@ -1167,7 +1161,7 @@ TEST_F(HostResolverImplTest, FlushCacheOnIPAddressChange) {
TEST_F(HostResolverImplTest, AbortOnIPAddressChanged) {
scoped_refptr<WaitingHostResolverProc> resolver_proc(
new WaitingHostResolverProc(NULL));
- HostCache* cache = CreateDefaultCache();
+ HostCache* cache = HostCache::CreateDefaultCache();
scoped_ptr<HostResolver> host_resolver(
new HostResolverImpl(resolver_proc, cache, kMaxJobs, kMaxRetryAttempts,
NULL));
@@ -1295,8 +1289,8 @@ TEST_F(HostResolverImplTest, HigherPriorityRequestsStartedFirst) {
size_t kMaxJobs = 1u;
const size_t kRetryAttempts = 0u;
scoped_ptr<HostResolver> host_resolver(
- new HostResolverImpl(resolver_proc, CreateDefaultCache(), kMaxJobs,
- kRetryAttempts, NULL));
+ new HostResolverImpl(resolver_proc, HostCache::CreateDefaultCache(),
+ kMaxJobs, kRetryAttempts, NULL));
TestHostResolverObserver observer;
host_resolver->AddObserver(&observer);
@@ -1381,8 +1375,8 @@ TEST_F(HostResolverImplTest, CancelPendingRequest) {
const size_t kMaxJobs = 1u;
const size_t kRetryAttempts = 0u;
scoped_ptr<HostResolver> host_resolver(
- new HostResolverImpl(resolver_proc, CreateDefaultCache(), kMaxJobs,
- kRetryAttempts, NULL));
+ new HostResolverImpl(resolver_proc, HostCache::CreateDefaultCache(),
+ kMaxJobs, kRetryAttempts, NULL));
// Note that at this point the CapturingHostResolverProc is blocked, so any
// requests we make will not complete.
@@ -1445,8 +1439,8 @@ TEST_F(HostResolverImplTest, QueueOverflow) {
const size_t kMaxOutstandingJobs = 1u;
const size_t kRetryAttempts = 0u;
scoped_ptr<HostResolverImpl> host_resolver(new HostResolverImpl(
- resolver_proc, CreateDefaultCache(), kMaxOutstandingJobs, kRetryAttempts,
- NULL));
+ resolver_proc, HostCache::CreateDefaultCache(), kMaxOutstandingJobs,
+ kRetryAttempts, NULL));
// Only allow up to 3 requests to be enqueued at a time.
const size_t kMaxPendingRequests = 3u;
@@ -1525,8 +1519,8 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv4) {
const size_t kMaxOutstandingJobs = 1u;
const size_t kRetryAttempts = 0u;
scoped_ptr<HostResolverImpl> host_resolver(new HostResolverImpl(
- resolver_proc, CreateDefaultCache(), kMaxOutstandingJobs, kRetryAttempts,
- NULL));
+ resolver_proc, HostCache::CreateDefaultCache(), kMaxOutstandingJobs,
+ kRetryAttempts, NULL));
host_resolver->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV4);
@@ -1595,8 +1589,8 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv6) {
const size_t kMaxOutstandingJobs = 1u;
const size_t kRetryAttempts = 0u;
scoped_ptr<HostResolverImpl> host_resolver(new HostResolverImpl(
- resolver_proc, CreateDefaultCache(), kMaxOutstandingJobs, kRetryAttempts,
- NULL));
+ resolver_proc, HostCache::CreateDefaultCache(), kMaxOutstandingJobs,
+ kRetryAttempts, NULL));
host_resolver->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV6);
@@ -1661,7 +1655,8 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_Synchronous) {
new CapturingHostResolverProc(new EchoingHostResolverProc));
scoped_ptr<HostResolverImpl> host_resolver(new HostResolverImpl(
- resolver_proc, CreateDefaultCache(), kMaxJobs, kMaxRetryAttempts, NULL));
+ resolver_proc, HostCache::CreateDefaultCache(), kMaxJobs,
+ kMaxRetryAttempts, NULL));
host_resolver->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV4);
@@ -1758,7 +1753,7 @@ TEST_F(HostResolverImplTest, MultipleAttempts) {
scoped_refptr<LookupAttemptHostResolverProc> resolver_proc(
new LookupAttemptHostResolverProc(
NULL, kAttemptNumberToResolve, kTotalAttempts));
- HostCache* cache = CreateDefaultCache();
+ HostCache* cache = HostCache::CreateDefaultCache();
scoped_ptr<HostResolverImpl> host_resolver(
new HostResolverImpl(resolver_proc, cache, kMaxJobs, kMaxRetryAttempts,
NULL));
« no previous file with comments | « net/base/host_resolver_impl.cc ('k') | net/base/net_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698