| Index: components/suggestions/suggestions_store.cc
|
| diff --git a/components/suggestions/suggestions_store.cc b/components/suggestions/suggestions_store.cc
|
| index 01c8e97050cf99a3f31ca5660348597cf50acaec..8685a64eae618cc3b71561122f0a29e1442e1494 100644
|
| --- a/components/suggestions/suggestions_store.cc
|
| +++ b/components/suggestions/suggestions_store.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/base64.h"
|
| #include "base/prefs/pref_service.h"
|
| +#include "base/time/default_clock.h"
|
| #include "base/time/time.h"
|
| #include "components/pref_registry/pref_registry_syncable.h"
|
| #include "components/suggestions/suggestions_pref_names.h"
|
| @@ -15,12 +16,19 @@
|
| namespace suggestions {
|
|
|
| SuggestionsStore::SuggestionsStore(PrefService* profile_prefs)
|
| - : pref_service_(profile_prefs) {
|
| + : pref_service_(profile_prefs), clock_(new base::DefaultClock()) {
|
| DCHECK(profile_prefs);
|
| }
|
|
|
| +SuggestionsStore::SuggestionsStore() {
|
| +}
|
| +
|
| SuggestionsStore::~SuggestionsStore() {}
|
|
|
| +void SuggestionsStore::SetClockForTesting(scoped_ptr<base::Clock> test_clock) {
|
| + this->clock_ = test_clock.Pass();
|
| +}
|
| +
|
| bool SuggestionsStore::LoadSuggestions(SuggestionsProfile* suggestions) {
|
| DCHECK(suggestions);
|
|
|
| @@ -61,8 +69,8 @@ bool SuggestionsStore::LoadSuggestions(SuggestionsProfile* suggestions) {
|
| void SuggestionsStore::FilterExpiredSuggestions(
|
| SuggestionsProfile* suggestions) {
|
| SuggestionsProfile filtered_suggestions;
|
| - int64 now_usec = (base::Time::NowFromSystemTime() - base::Time::UnixEpoch())
|
| - .ToInternalValue();
|
| + int64 now_usec =
|
| + (this->clock_->Now() - base::Time::UnixEpoch()).ToInternalValue();
|
|
|
| for (int i = 0; i < suggestions->suggestions_size(); ++i) {
|
| ChromeSuggestion* suggestion = suggestions->mutable_suggestions(i);
|
|
|