diff options
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/cloud_print/cloud_print_url_fetcher.cc | 11 | ||||
-rw-r--r-- | chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.cc b/chrome/service/cloud_print/cloud_print_url_fetcher.cc index 731acd3..13af5f7 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher.cc @@ -102,12 +102,11 @@ void CloudPrintURLFetcher::OnURLFetchComplete( } // Retry the request if needed. if (action == RETRY_REQUEST) { - // If the response code is greater than or equal to 500, then the back-off - // period has been increased at the network level; otherwise, explicitly - // call ReceivedContentWasMalformed() to count the current request as a - // failure and increase the back-off period. - if (response_code < 500) - request_->ReceivedContentWasMalformed(); + // Explicitly call ReceivedContentWasMalformed() to ensure the current + // request gets counted as a failure for calculation of the back-off + // period. If it was already a failure by status code, this call will + // be ignored. + request_->ReceivedContentWasMalformed(); ++num_retries_; if ((-1 != source->max_retries()) && 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 6a2637d..9fd4318 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc @@ -324,7 +324,7 @@ TEST_F(CloudPrintURLFetcherOverloadTest, Protect) { net::URLRequestThrottlerManager* manager = net::URLRequestThrottlerManager::GetInstance(); scoped_refptr<net::URLRequestThrottlerEntry> entry( - new net::URLRequestThrottlerEntry(manager, 200, 3, 1, 2.0, 0.0, 256)); + new net::URLRequestThrottlerEntry(manager, "", 200, 3, 1, 2.0, 0.0, 256)); manager->OverrideEntryForTests(url, entry); CreateFetcher(url, 11); @@ -348,7 +348,7 @@ TEST_F(CloudPrintURLFetcherRetryBackoffTest, FLAKY_GiveUp) { net::URLRequestThrottlerManager* manager = net::URLRequestThrottlerManager::GetInstance(); scoped_refptr<net::URLRequestThrottlerEntry> entry( - new net::URLRequestThrottlerEntry(manager, 200, 3, 1, 2.0, 0.0, 256)); + new net::URLRequestThrottlerEntry(manager, "", 200, 3, 1, 2.0, 0.0, 256)); manager->OverrideEntryForTests(url, entry); CreateFetcher(url, 11); |