summaryrefslogtreecommitdiffstats
path: root/chrome/common/net/url_fetcher_unittest.cc
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 15:35:07 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 15:35:07 +0000
commitcade5686b5ec6a116543bbc29dc4f6a1068d5c17 (patch)
treed0f59d8c3218ca749c6378fcab26431df24e723d /chrome/common/net/url_fetcher_unittest.cc
parent47f1c5806ddbdf336db68b4274a7d9f3fba5b3ba (diff)
downloadchromium_src-cade5686b5ec6a116543bbc29dc4f6a1068d5c17.zip
chromium_src-cade5686b5ec6a116543bbc29dc4f6a1068d5c17.tar.gz
chromium_src-cade5686b5ec6a116543bbc29dc4f6a1068d5c17.tar.bz2
Extracting core back-off logic into a separate class,
BackoffEntry. Simplifying the logic slightly while I'm there, removing special support for "after the fact" malformed bodies (the error count doesn't need to be 100% accurate) and removing a constant value added to back-off times (it was only being added once anyway, had close to zero effect). Modifying URLRequestThrottlerEntry and related tests to use the new class instead of co-mingling sliding window logic and exponential back-off logic. Removing now-unnecessary StressTest and associated ugly wart "SetEntryLifetimeMsForTest" method on the URLRequestThrottlerEntryInterface class. Fixing up a few minor things e.g. #pragma once while I'm in there. BUG=none TEST=net_unittests.exe, unit_tests.exe Review URL: http://codereview.chromium.org/6697001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/net/url_fetcher_unittest.cc')
-rw-r--r--chrome/common/net/url_fetcher_unittest.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/chrome/common/net/url_fetcher_unittest.cc b/chrome/common/net/url_fetcher_unittest.cc
index 8e86d93..c52ad33 100644
--- a/chrome/common/net/url_fetcher_unittest.cc
+++ b/chrome/common/net/url_fetcher_unittest.cc
@@ -577,7 +577,7 @@ TEST_F(URLFetcherProtectTest, Overload) {
// Registers an entry for test url. It only allows 3 requests to be sent
// in 200 milliseconds.
scoped_refptr<net::URLRequestThrottlerEntry> entry(
- new net::URLRequestThrottlerEntry(200, 3, 1, 0, 2.0, 0.0, 256));
+ new net::URLRequestThrottlerEntry(200, 3, 1, 2.0, 0.0, 256));
net::URLRequestThrottlerManager::GetInstance()->OverrideEntryForTests(
url, entry);
@@ -599,7 +599,7 @@ TEST_F(URLFetcherProtectTest, ServerUnavailable) {
// and maximum backoff time is 256 milliseconds.
// Maximum retries allowed is set to 11.
scoped_refptr<net::URLRequestThrottlerEntry> entry(
- new net::URLRequestThrottlerEntry(200, 3, 1, 0, 2.0, 0.0, 256));
+ new net::URLRequestThrottlerEntry(200, 3, 1, 2.0, 0.0, 256));
net::URLRequestThrottlerManager::GetInstance()->OverrideEntryForTests(
url, entry);
@@ -621,7 +621,7 @@ TEST_F(URLFetcherProtectTestPassedThrough, ServerUnavailablePropagateResponse) {
// and maximum backoff time is 150000 milliseconds.
// Maximum retries allowed is set to 11.
scoped_refptr<net::URLRequestThrottlerEntry> entry(
- new net::URLRequestThrottlerEntry(200, 3, 100, 0, 2.0, 0.0, 150000));
+ new net::URLRequestThrottlerEntry(200, 3, 100, 2.0, 0.0, 150000));
// Total time if *not* for not doing automatic backoff would be 150s.
// In reality it should be "as soon as server responds".
net::URLRequestThrottlerManager::GetInstance()->OverrideEntryForTests(
@@ -665,7 +665,7 @@ TEST_F(URLFetcherCancelTest, ReleasesContext) {
// The initial backoff is 2 seconds and maximum backoff is 4 seconds.
// Maximum retries allowed is set to 2.
scoped_refptr<net::URLRequestThrottlerEntry> entry(
- new net::URLRequestThrottlerEntry(200, 3, 2000, 0, 2.0, 0.0, 4000));
+ new net::URLRequestThrottlerEntry(200, 3, 2000, 2.0, 0.0, 4000));
net::URLRequestThrottlerManager::GetInstance()->OverrideEntryForTests(
url, entry);
@@ -693,7 +693,7 @@ TEST_F(URLFetcherCancelTest, CancelWhileDelayedStartTaskPending) {
// Using a sliding window of 4 seconds, and max of 1 request, under a fast
// run we expect to have a 4 second delay when posting the Start task.
scoped_refptr<net::URLRequestThrottlerEntry> entry(
- new net::URLRequestThrottlerEntry(4000, 1, 2000, 0, 2.0, 0.0, 4000));
+ new net::URLRequestThrottlerEntry(4000, 1, 2000, 2.0, 0.0, 4000));
net::URLRequestThrottlerManager::GetInstance()->OverrideEntryForTests(
url, entry);
// Fake that a request has just started.