summaryrefslogtreecommitdiffstats
path: root/net/base/host_resolver_impl_unittest.cc
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 00:37:37 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 00:37:37 +0000
commit243a8eeb4a5b7421cf2cc66ed77e8480a41bfc43 (patch)
tree4917fff31e68f31b2358ae5a79e5c0df048f296d /net/base/host_resolver_impl_unittest.cc
parent542cc177b9a20f9d7dc66c3c030bbaa54637642e (diff)
downloadchromium_src-243a8eeb4a5b7421cf2cc66ed77e8480a41bfc43.zip
chromium_src-243a8eeb4a5b7421cf2cc66ed77e8480a41bfc43.tar.gz
chromium_src-243a8eeb4a5b7421cf2cc66ed77e8480a41bfc43.tar.bz2
Revert 85852 - Add a command line option ("host-resolver-retry-attempts")
to specify the number of retry attempts to resolve host. BUG=82580 TEST=host resolver unit tests R=eroman Review URL: http://codereview.chromium.org/7011044 TBR=rtenneti@chromium.org Review URL: http://codereview.chromium.org/7044027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_impl_unittest.cc')
-rw-r--r--net/base/host_resolver_impl_unittest.cc46
1 files changed, 18 insertions, 28 deletions
diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc
index 52b7f89..7b72d1d 100644
--- a/net/base/host_resolver_impl_unittest.cc
+++ b/net/base/host_resolver_impl_unittest.cc
@@ -41,11 +41,10 @@ HostCache* CreateDefaultCache() {
}
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);
+ NULL);
}
// Helper to create a HostResolver::RequestInfo.
@@ -452,7 +451,6 @@ TEST_F(HostResolverImplTest, CanceledAsynchronousLookup) {
new HostResolverImpl(resolver_proc,
CreateDefaultCache(),
kMaxJobs,
- kMaxRetryAttempts,
&net_log));
AddressList addrlist;
const int kPortnum = 80;
@@ -899,8 +897,7 @@ TEST_F(HostResolverImplTest, StartWithinCallback) {
// Turn off caching for this host resolver.
scoped_ptr<HostResolver> host_resolver(
- new HostResolverImpl(resolver_proc, NULL, kMaxJobs, kMaxRetryAttempts,
- NULL));
+ new HostResolverImpl(resolver_proc, NULL, kMaxJobs, NULL));
// The class will receive callbacks for when each resolve completes. It
// checks that the right things happened.
@@ -1200,8 +1197,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,
- kMaxRetryAttempts, NULL));
+ new HostResolverImpl(NULL, CreateDefaultCache(), kMaxJobs, NULL));
AddressList addrlist;
@@ -1235,8 +1231,7 @@ TEST_F(HostResolverImplTest, AbortOnIPAddressChanged) {
new WaitingHostResolverProc(NULL));
HostCache* cache = CreateDefaultCache();
scoped_ptr<HostResolver> host_resolver(
- new HostResolverImpl(resolver_proc, cache, kMaxJobs, kMaxRetryAttempts,
- NULL));
+ new HostResolverImpl(resolver_proc, cache, kMaxJobs, NULL));
// Resolve "host1".
HostResolver::RequestInfo info(HostPortPair("host1", 70));
@@ -1359,10 +1354,9 @@ TEST_F(HostResolverImplTest, HigherPriorityRequestsStartedFirst) {
// This HostResolverImpl will only allow 1 outstanding resolve at a time.
size_t kMaxJobs = 1u;
- const size_t kRetryAttempts = 0u;
scoped_ptr<HostResolver> host_resolver(
new HostResolverImpl(resolver_proc, CreateDefaultCache(), kMaxJobs,
- kRetryAttempts, NULL));
+ NULL));
CapturingObserver observer;
host_resolver->AddObserver(&observer);
@@ -1445,10 +1439,9 @@ TEST_F(HostResolverImplTest, CancelPendingRequest) {
// This HostResolverImpl will only allow 1 outstanding resolve at a time.
const size_t kMaxJobs = 1u;
- const size_t kRetryAttempts = 0u;
scoped_ptr<HostResolver> host_resolver(
new HostResolverImpl(resolver_proc, CreateDefaultCache(), kMaxJobs,
- kRetryAttempts, NULL));
+ NULL));
// Note that at this point the CapturingHostResolverProc is blocked, so any
// requests we make will not complete.
@@ -1509,10 +1502,8 @@ TEST_F(HostResolverImplTest, QueueOverflow) {
// This HostResolverImpl will only allow 1 outstanding resolve at a time.
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, CreateDefaultCache(), kMaxOutstandingJobs, NULL));
// Only allow up to 3 requests to be enqueued at a time.
const size_t kMaxPendingRequests = 3u;
@@ -1589,10 +1580,8 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv4) {
// This HostResolverImpl will only allow 1 outstanding resolve at a time.
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, CreateDefaultCache(), kMaxOutstandingJobs, NULL));
host_resolver->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV4);
@@ -1659,10 +1648,8 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv6) {
// This HostResolverImpl will only allow 1 outstanding resolve at a time.
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, CreateDefaultCache(), kMaxOutstandingJobs, NULL));
host_resolver->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV6);
@@ -1726,8 +1713,9 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_Synchronous) {
scoped_refptr<CapturingHostResolverProc> resolver_proc(
new CapturingHostResolverProc(new EchoingHostResolverProc));
+ const size_t kMaxOutstandingJobs = 10u;
scoped_ptr<HostResolverImpl> host_resolver(new HostResolverImpl(
- resolver_proc, CreateDefaultCache(), kMaxJobs, kMaxRetryAttempts, NULL));
+ resolver_proc, CreateDefaultCache(), kMaxOutstandingJobs, NULL));
host_resolver->SetDefaultAddressFamily(ADDRESS_FAMILY_IPV4);
@@ -1826,14 +1814,16 @@ TEST_F(HostResolverImplTest, MultipleAttempts) {
NULL, kAttemptNumberToResolve, kTotalAttempts));
HostCache* cache = CreateDefaultCache();
scoped_ptr<HostResolverImpl> host_resolver(
- new HostResolverImpl(resolver_proc, cache, kMaxJobs, kMaxRetryAttempts,
- NULL));
+ new HostResolverImpl(resolver_proc, cache, kMaxJobs, NULL));
- // Specify smaller interval for unresponsive_delay_ for HostResolverImpl so
- // that unit test runs faster. For example, this test finishes in 1.5 secs
- // (500ms * 3).
+ // Specify smaller interval for unresponsive_delay_ and
+ // maximum_unresponsive_delay_ for HostResolverImpl so that unit test
+ // runs faster. For example, this test finishes in 1.5 secs (500ms * 3).
TimeDelta kUnresponsiveTime = TimeDelta::FromMilliseconds(500);
+ TimeDelta kMaximumUnresponsiveTime = TimeDelta::FromMilliseconds(2500);
+
host_resolver->set_unresponsive_delay(kUnresponsiveTime);
+ host_resolver->set_maximum_unresponsive_delay(kMaximumUnresponsiveTime);
// Resolve "host1".
HostResolver::RequestInfo info(HostPortPair("host1", 70));