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

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

Issue 2176393004: Add expiration policy, code to check it, and a test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback per DougArnett 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
« no previous file with comments | « components/offline_pages/background/request_picker.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/background/request_picker_unittest.cc
diff --git a/components/offline_pages/background/request_picker_unittest.cc b/components/offline_pages/background/request_picker_unittest.cc
index e6c0092b4be3211b099fe653289225d74a91de91..633c1eb907d9f9b46de53302e24ac759ca2278ab 100644
--- a/components/offline_pages/background/request_picker_unittest.cc
+++ b/components/offline_pages/background/request_picker_unittest.cc
@@ -28,6 +28,7 @@ const GURL kUrl2("http://nytimes.com");
const ClientId kClientId2("bookmark", "5678");
const bool kUserRequested = true;
const int kAttemptCount = 1;
+const int kTwoWeeksInSeconds = 60 * 60 * 24 * 7 * 2;
// Constants for policy values - These settings represent the default values.
const bool kPreferUntried = false;
@@ -248,4 +249,19 @@ TEST_F(RequestPickerTest, ChooseLaterRequest) {
EXPECT_FALSE(request_queue_empty_called_);
}
+TEST_F(RequestPickerTest, ChooseUnexpiredRequest) {
+ base::Time creation_time1 =
+ base::Time::Now() - base::TimeDelta::FromSeconds(kTwoWeeksInSeconds);
+ base::Time creation_time2 = base::Time::Now();
+ SavePageRequest request1(kRequestId1, kUrl1, kClientId1, creation_time1,
+ kUserRequested);
+ SavePageRequest request2(kRequestId2, kUrl2, kClientId2, creation_time2,
+ kUserRequested);
+
+ QueueRequestsAndChooseOne(request1, request2);
+
+ EXPECT_EQ(kRequestId2, last_picked_->request_id());
+ EXPECT_FALSE(request_queue_empty_called_);
+}
+
} // namespace offline_pages
« no previous file with comments | « components/offline_pages/background/request_picker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698