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

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

Issue 2493683002: [OfflinePages] Fixes RequestCoordinator bug not clearing state on timeout (Closed)
Patch Set: Broke out some OfflinerDoneCallback logic and reworked timeout handling Created 4 years, 1 month 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 af0ad232e6c97d91e9f16297d243a5072ac2581a..a82f71fc2019b7adce0aeca93814d70d301b2801 100644
--- a/components/offline_pages/background/request_coordinator_unittest.cc
+++ b/components/offline_pages/background/request_coordinator_unittest.cc
@@ -1071,6 +1071,10 @@ TEST_F(RequestCoordinatorTest, WatchdogTimeoutForScheduledProcessing) {
// Build a request to use with the pre-renderer, and put it on the queue.
offline_pages::SavePageRequest request(
kRequestId1, kUrl1, kClientId1, base::Time::Now(), kUserRequested);
+ // Set request to allow one more completed attempt.
+ int max_tries = coordinator()->policy()->GetMaxCompletedTries();
+ while (request.completed_attempt_count() < max_tries - 1)
+ request.MarkAttemptCompleted();
Pete Williamson 2016/11/11 00:24:04 Instead of calling MarkAttemptCompleted, why not j
dougarnett 2016/11/11 16:36:45 Done.
coordinator()->queue()->AddRequest(
request,
base::Bind(&RequestCoordinatorTest::AddRequestDone,
@@ -1107,6 +1111,7 @@ TEST_F(RequestCoordinatorTest, WatchdogTimeoutForScheduledProcessing) {
PumpLoop();
EXPECT_FALSE(is_starting());
+ EXPECT_FALSE(coordinator()->is_busy());
EXPECT_TRUE(OfflinerWasCanceled());
}

Powered by Google App Engine
This is Rietveld 408576698