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

Unified Diff: components/ntp_snippets/remote/remote_suggestions_provider.h

Issue 2549163002: RemoteContentSuggestions: Stores the time of the last successful background fetch in a pref (Closed)
Patch Set: Address comments treib 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/ntp_snippets/remote/remote_suggestions_provider.h
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider.h b/components/ntp_snippets/remote/remote_suggestions_provider.h
index a8081b7ee9ffdadb3b853164edd1d175b786d2c6..1c76a5862a7b95d1aab0cfb49257e2b5d742cd94 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider.h
+++ b/components/ntp_snippets/remote/remote_suggestions_provider.h
@@ -151,6 +151,11 @@ class RemoteSuggestionsProvider final
return category_contents_.find(category)->second.dismissed;
}
+ // Overrides internal clock for testing purposes.
+ void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock) {
+ tick_clock_ = std::move(tick_clock);
tschumann 2016/12/08 18:18:51 nit: Couldn't we dependency-inject this into the c
+ }
+
private:
friend class RemoteSuggestionsProviderTest;
@@ -261,10 +266,13 @@ class RemoteSuggestionsProvider final
// Callback for fetch-more requests with the NTPSnippetsFetcher.
void OnFetchMoreFinished(
const FetchDoneCallback& fetching_callback,
+ NTPSnippetsFetcher::FetchResult fetch_result,
NTPSnippetsFetcher::OptionalFetchedCategories fetched_categories);
// Callback for regular fetch requests with the NTPSnippetsFetcher.
void OnFetchFinished(
+ bool interactive_request,
+ NTPSnippetsFetcher::FetchResult fetch_status,
NTPSnippetsFetcher::OptionalFetchedCategories fetched_categories);
// Moves all snippets from |to_archive| into the archive of the |content|.
@@ -407,6 +415,9 @@ class RemoteSuggestionsProvider final
// Request throttler for limiting requests to thumbnail images.
RequestThrottler thumbnail_requests_throttler_;
+ // A clock for getting the time. This allows to inject a tick clock in tests.
+ std::unique_ptr<base::TickClock> tick_clock_;
+
DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsProvider);
};

Powered by Google App Engine
This is Rietveld 408576698