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

Unified Diff: components/offline_pages/background/request_coordinator_unittest.cc

Issue 2176453002: Update the request count when a request fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 5 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: components/offline_pages/background/request_coordinator_unittest.cc
diff --git a/components/offline_pages/background/request_coordinator_unittest.cc b/components/offline_pages/background/request_coordinator_unittest.cc
index ea31b226de0d782a9a044561a43ab77c86991049..09f5a8cb232eb729961b8ca92a8b1bdaa1a653ec 100644
--- a/components/offline_pages/background/request_coordinator_unittest.cc
+++ b/components/offline_pages/background/request_coordinator_unittest.cc
@@ -363,11 +363,22 @@ TEST_F(RequestCoordinatorTest, OfflinerDoneRequestFailed) {
base::Unretained(this));
coordinator()->SetProcessingCallbackForTest(callback);
+ // Set up device conditions for the test.
+ DeviceConditions device_conditions(
+ false, 75, net::NetworkChangeNotifier::CONNECTION_3G);
+ SetDeviceConditionsForTest(device_conditions);
+
// Call the OfflinerDoneCallback to simulate the request failed, wait
// for callbacks.
EnableOfflinerCallback(true);
SendOfflinerDoneCallback(request,
Offliner::RequestStatus::PRERENDERING_FAILED);
+ // There will be one request left in the queue after the prerender fails, stop
+ // processing now so that it will remain in the queue for us to check. This
+ // won't affect the offliner done callback other than preventing
+ // TryNextRequest from doing anything.
+ coordinator()->StopProcessing();
+
PumpLoop();
// Verify the request is not removed from the queue, and wait for callbacks.
@@ -378,7 +389,9 @@ TEST_F(RequestCoordinatorTest, OfflinerDoneRequestFailed) {
// Still one request in the queue.
EXPECT_EQ(1UL, last_requests().size());
- // TODO(dougarnett): Verify retry count gets incremented.
+ // Verify retry count was incremented.
+ const SavePageRequest& found_request = last_requests().front();
+ EXPECT_EQ(1L, found_request.attempt_count());
}
// This tests a StopProcessing call before we have actually started the
« no previous file with comments | « components/offline_pages/background/request_coordinator.cc ('k') | components/offline_pages/background/request_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698