diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 22:30:21 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 22:30:21 +0000 |
commit | 2fd33ee9acea0037b010901af1601616c21cc37d (patch) | |
tree | 9109f46ae1e4efe4ec8d345853064113e6379915 /chrome/service | |
parent | 49a9415f1fd04e05c2d75e884a0aced8e0d76063 (diff) | |
download | chromium_src-2fd33ee9acea0037b010901af1601616c21cc37d.zip chromium_src-2fd33ee9acea0037b010901af1601616c21cc37d.tar.gz chromium_src-2fd33ee9acea0037b010901af1601616c21cc37d.tar.bz2 |
Add an opt-out header for HTTP throttling. Never throttle for localhost.
Added net::IsLocalhost() function to net/base/net_utils.h
Unit tests for the above. Also fix flakiness in the ReceivedContentMalformed test that was caused by non-zero jitter.
Modify back-off policy to ignore first 4 errors to help avoid back-off from erroneously kicking in on flaky connections. Make maximum back-off period 15 minutes instead of 60. Added documentation of results of analyzing behavior this new policy will give.
Add a simple server for manual testing of the throttling feature.
BUG=66062
TEST=net_unittests
Review URL: http://codereview.chromium.org/6711046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index ca30b3d..3732dc6 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc @@ -285,9 +285,8 @@ CloudPrintURLFetcherRetryBackoffTest::HandleRawData(const URLFetcher* source, } void CloudPrintURLFetcherRetryBackoffTest::OnRequestGiveUp() { - const TimeDelta one_second = TimeDelta::FromMilliseconds(1000); - // It takes more than 1 second to finish all 11 requests. - EXPECT_TRUE(Time::Now() - start_time_ >= one_second); + // It takes more than 200 ms to finish all 11 requests. + EXPECT_TRUE(Time::Now() - start_time_ >= TimeDelta::FromMilliseconds(200)); io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); } @@ -319,10 +318,11 @@ TEST_F(CloudPrintURLFetcherOverloadTest, Protect) { // Registers an entry for test url. It only allows 3 requests to be sent // in 200 milliseconds. + net::URLRequestThrottlerManager* manager = + net::URLRequestThrottlerManager::GetInstance(); scoped_refptr<net::URLRequestThrottlerEntry> entry( - new net::URLRequestThrottlerEntry(200, 3, 1, 2.0, 0.0, 256)); - net::URLRequestThrottlerManager::GetInstance()->OverrideEntryForTests( - url, entry); + new net::URLRequestThrottlerEntry(manager, 200, 3, 1, 2.0, 0.0, 256)); + manager->OverrideEntryForTests(url, entry); CreateFetcher(url, 11); @@ -342,10 +342,11 @@ TEST_F(CloudPrintURLFetcherRetryBackoffTest, FLAKY_GiveUp) { // new_backoff = 2.0 * old_backoff + 0 // and maximum backoff time is 256 milliseconds. // Maximum retries allowed is set to 11. + net::URLRequestThrottlerManager* manager = + net::URLRequestThrottlerManager::GetInstance(); scoped_refptr<net::URLRequestThrottlerEntry> entry( - new net::URLRequestThrottlerEntry(200, 3, 1, 2.0, 0.0, 256)); - net::URLRequestThrottlerManager::GetInstance()->OverrideEntryForTests( - url, entry); + new net::URLRequestThrottlerEntry(manager, 200, 3, 1, 2.0, 0.0, 256)); + manager->OverrideEntryForTests(url, entry); CreateFetcher(url, 11); |