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

Side by Side Diff: components/suggestions/suggestions_store.h

Issue 816693003: SuggestionsStore unittests not using real time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SUGGESTIONS_SUGGESTIONS_STORE_H_ 5 #ifndef COMPONENTS_SUGGESTIONS_SUGGESTIONS_STORE_H_
6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_STORE_H_ 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_STORE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/clock.h"
9 #include "components/suggestions/proto/suggestions.pb.h" 11 #include "components/suggestions/proto/suggestions.pb.h"
10 12
11 class PrefService; 13 class PrefService;
12 14
13 namespace user_prefs { 15 namespace user_prefs {
14 class PrefRegistrySyncable; 16 class PrefRegistrySyncable;
15 } // namespace user_prefs 17 } // namespace user_prefs
16 18
17 namespace suggestions { 19 namespace suggestions {
18 20
(...skipping 13 matching lines...) Expand all
32 // Stores the provided |suggestions| to the profile's preferences, using 34 // Stores the provided |suggestions| to the profile's preferences, using
33 // a base64 encoding of its protobuf serialization. 35 // a base64 encoding of its protobuf serialization.
34 virtual bool StoreSuggestions(const SuggestionsProfile& suggestions); 36 virtual bool StoreSuggestions(const SuggestionsProfile& suggestions);
35 37
36 // Clears any suggestion data from the profile's preferences. 38 // Clears any suggestion data from the profile's preferences.
37 virtual void ClearSuggestions(); 39 virtual void ClearSuggestions();
38 40
39 // Register SuggestionsStore related prefs in the Profile prefs. 41 // Register SuggestionsStore related prefs in the Profile prefs.
40 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 42 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
41 43
44 // Gains ownership of |clock|.
Matt Giuca 2014/12/18 22:51:13 Nit: This comment is not necessary (the ownership
gayane -on leave until 09-2017 2014/12/22 16:29:38 Done.
45 void SetClockForTesting(scoped_ptr<base::Clock> clock);
46
42 protected: 47 protected:
43 // Test seam. For simplicity of mock creation. 48 // Test seam. For simplicity of mock creation.
44 SuggestionsStore() {} 49 SuggestionsStore();
45 50
46 private: 51 private:
47 // The pref service used to persist the suggestions data. 52 // The pref service used to persist the suggestions data.
48 PrefService* pref_service_; 53 PrefService* pref_service_;
54 // Can be set for testing.
55 scoped_ptr<base::Clock> clock_;
49 56
50 DISALLOW_COPY_AND_ASSIGN(SuggestionsStore); 57 DISALLOW_COPY_AND_ASSIGN(SuggestionsStore);
51 58
52 // Filters expired suggestions. 59 // Filters expired suggestions.
53 void FilterExpiredSuggestions(SuggestionsProfile* suggestions); 60 void FilterExpiredSuggestions(SuggestionsProfile* suggestions);
54 }; 61 };
55 62
56 } // namespace suggestions 63 } // namespace suggestions
57 64
58 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_STORE_H_ 65 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | components/suggestions/suggestions_store.cc » ('j') | components/suggestions/suggestions_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698