Index: chrome/browser/search_engines/template_url_service.h |
=================================================================== |
--- chrome/browser/search_engines/template_url_service.h (revision 90021) |
+++ chrome/browser/search_engines/template_url_service.h (working copy) |
@@ -62,6 +62,8 @@ |
public: |
typedef std::map<std::string, std::string> QueryTerms; |
typedef std::vector<const TemplateURL*> TemplateURLVector; |
+ // Type for a static function pointer that acts as a time source. |
+ typedef base::Time(TimeProvider)(); |
// Struct used for initializing the data store with fake data. |
// Each initializer is mapped to a TemplateURL. |
@@ -240,6 +242,14 @@ |
// Registers the preferences used to save a TemplateURL to prefs. |
static void RegisterUserPrefs(PrefService* prefs); |
+#if defined(UNIT_TEST) |
+ // Set a different time provider function, such as |
+ // base::MockTimeProvider::StaticNow, when testing calls to base::Time::Now. |
+ void set_time_provider(TimeProvider* time_provider) { |
+ time_provider_ = time_provider; |
+ } |
+#endif |
+ |
protected: |
// Cover method for the method of the same name on the HistoryService. |
// url is the one that was visited with the given search terms. |
@@ -440,6 +450,9 @@ |
// List of extension IDs waiting for Load to have keywords registered. |
std::vector<std::string> pending_extension_ids_; |
+ // Function returning current time in base::Time units. |
+ TimeProvider* time_provider_; |
+ |
DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
}; |