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

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

Issue 2543093002: Split the RequestPicker task into two separate tasks. (Closed)
Patch Set: CR feedback per FGorski and DougArnett Created 4 years 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_queue_unittest.cc
diff --git a/components/offline_pages/background/request_queue_unittest.cc b/components/offline_pages/background/request_queue_unittest.cc
index 8ba805a9b7f3c95c95e6ef263462cc81f76f5819..cbe106f6dadff389aa547396c9a3c47839c74d3d 100644
--- a/components/offline_pages/background/request_queue_unittest.cc
+++ b/components/offline_pages/background/request_queue_unittest.cc
@@ -535,8 +535,6 @@ TEST_F(RequestQueueTest, MarkAttemptCompleted) {
update_requests_result()->updated_items.at(0).request_state());
}
-// Request expiration is detected during the call to pick a request, which
-// is why this test calls PickNextRequest().
TEST_F(RequestQueueTest, CleanStaleRequests) {
// Create a request that is already expired.
base::Time creation_time =
@@ -554,21 +552,14 @@ TEST_F(RequestQueueTest, CleanStaleRequests) {
OfflinerPolicy policy;
RequestNotifierStub notifier;
RequestCoordinatorEventLogger event_logger;
- std::unique_ptr<PickRequestTaskFactory> picker_factory(
- new PickRequestTaskFactory(&policy, &notifier, &event_logger));
- queue()->SetPickerFactory(std::move(picker_factory));
+ std::unique_ptr<CleanupTaskFactory> cleanup_factory(
+ new CleanupTaskFactory(&policy, &notifier, &event_logger));
+ queue()->SetCleanupFactory(std::move(cleanup_factory));
// Do a pick and clean operation, which will remove stale entries.
DeviceConditions conditions;
std::set<int64_t> disabled_list;
- queue()->PickNextRequest(
- base::Bind(&RequestQueueTest::RequestPickedCallback,
- base::Unretained(this)),
- base::Bind(&RequestQueueTest::RequestNotPickedCallback,
- base::Unretained(this)),
- base::Bind(&RequestQueueTest::RequestCountCallback,
- base::Unretained(this)),
- conditions, disabled_list);
+ queue()->CleanupRequestQueue(0UL);
this->PumpLoop();

Powered by Google App Engine
This is Rietveld 408576698