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

Unified Diff: chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc

Issue 6711046: Add an opt-out header for HTTP throttling. Never throttle for localhost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 9 years, 9 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
Index: chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc
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 ca30b3da0a3c5a3339cf029b13e1f7ac03485c50..3732dc65298e2cdde028046486a1766329f3169d 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));
wtc 2011/03/25 19:06:24 Just curious: is one second too long? How do we c
Jói 2011/03/25 21:26:51 It's dependent on the default exponential back-off
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);

Powered by Google App Engine
This is Rietveld 408576698