Index: chrome/browser/extensions/test_extension_prefs.cc |
diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc |
index 2cbb2d16857e1db7e58a60001988a81f1d76913d..5d3fc10d897cebe6812cc23e6a980fc87b6f10ba 100644 |
--- a/chrome/browser/extensions/test_extension_prefs.cc |
+++ b/chrome/browser/extensions/test_extension_prefs.cc |
@@ -17,6 +17,22 @@ |
#include "chrome/common/json_pref_store.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+// Mock ExtensionPrefs class with artificial clock. |
Mattias Nissler (ping if slow)
2010/11/19 16:52:20
Please put the reason why that is needed into the
battre (please use the other)
2010/11/19 18:00:39
Done.
|
+class ExtensionPrefsFake : public ExtensionPrefs { |
Mattias Nissler (ping if slow)
2010/11/19 16:52:20
Typically we call a subclass of class Foo that is
battre (please use the other)
2010/11/19 18:00:39
Done.
|
+ public: |
+ explicit ExtensionPrefsFake(PrefService* prefs, const FilePath& root_dir_) |
Mattias Nissler (ping if slow)
2010/11/19 16:52:20
No need for explicit, has two arguments.
battre (please use the other)
2010/11/19 18:00:39
Done.
|
+ : ExtensionPrefs(prefs, root_dir_), currentTime(base::Time::Now()) {} |
+ ~ExtensionPrefsFake() {} |
+ |
+ protected: |
+ mutable base::Time currentTime; |
+ // For unit testing |
Mattias Nissler (ping if slow)
2010/11/19 16:52:20
Missing period. Furthermore, this comment doesn't
battre (please use the other)
2010/11/19 18:00:39
Done.
|
+ virtual base::Time GetCurrentTime() const { |
+ currentTime += base::TimeDelta::FromSeconds(10); |
+ return currentTime; |
+ } |
+}; |
+ |
TestExtensionPrefs::TestExtensionPrefs() { |
EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
preferences_file_ = temp_dir_.path().AppendASCII("Preferences"); |
@@ -42,7 +58,7 @@ void TestExtensionPrefs::RecreateExtensionPrefs() { |
// Create a |PrefService| instance that contains only user defined values. |
pref_service_.reset(PrefService::CreateUserPrefService(preferences_file_)); |
ExtensionPrefs::RegisterUserPrefs(pref_service_.get()); |
- prefs_.reset(new ExtensionPrefs(pref_service_.get(), temp_dir_.path())); |
+ prefs_.reset(new ExtensionPrefsFake(pref_service_.get(), temp_dir_.path())); |
} |
scoped_refptr<Extension> TestExtensionPrefs::AddExtension(std::string name) { |