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

Unified Diff: components/prefs/testing_pref_service.h

Issue 2479113002: Make extensions DSE persistent in browser prefs (Closed)
Patch Set: Updated after review, round 2 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
« no previous file with comments | « components/pref_registry/testing_pref_service_syncable.cc ('k') | components/prefs/testing_pref_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/prefs/testing_pref_service.h
diff --git a/components/prefs/testing_pref_service.h b/components/prefs/testing_pref_service.h
index f29e506d853ae28a830a0ad68e49f1c30352f3ec..9abde598617def294e079b3d378178ac414da165 100644
--- a/components/prefs/testing_pref_service.h
+++ b/components/prefs/testing_pref_service.h
@@ -40,6 +40,13 @@ class TestingPrefServiceBase : public SuperPrefService {
// preference has been defined previously.
void RemoveManagedPref(const std::string& path);
+ // Similar to the above, but for extension preferences.
+ // Does not really know about extensions and their order of installation.
+ // Useful in tests that only checks that preference is overriden by extension.
+ const base::Value* GetExtensionPref(const std::string& path) const;
+ void SetExtensionPref(const std::string& path, base::Value* value);
+ void RemoveExtensionPref(const std::string& path);
+
// Similar to the above, but for user preferences.
const base::Value* GetUserPref(const std::string& path) const;
void SetUserPref(const std::string& path, base::Value* value);
@@ -54,12 +61,12 @@ class TestingPrefServiceBase : public SuperPrefService {
static void HandleReadError(PersistentPrefStore::PrefReadError error) {}
protected:
- TestingPrefServiceBase(
- TestingPrefStore* managed_prefs,
- TestingPrefStore* user_prefs,
- TestingPrefStore* recommended_prefs,
- ConstructionPrefRegistry* pref_registry,
- PrefNotifierImpl* pref_notifier);
+ TestingPrefServiceBase(TestingPrefStore* managed_prefs,
+ TestingPrefStore* extension_prefs,
+ TestingPrefStore* user_prefs,
+ TestingPrefStore* recommended_prefs,
+ ConstructionPrefRegistry* pref_registry,
+ PrefNotifierImpl* pref_notifier);
private:
// Reads the value of the preference indicated by |path| from |pref_store|.
@@ -77,6 +84,7 @@ class TestingPrefServiceBase : public SuperPrefService {
// Pointers to the pref stores our value store uses.
scoped_refptr<TestingPrefStore> managed_prefs_;
+ scoped_refptr<TestingPrefStore> extension_prefs_;
scoped_refptr<TestingPrefStore> user_prefs_;
scoped_refptr<TestingPrefStore> recommended_prefs_;
@@ -101,9 +109,10 @@ class TestingPrefServiceSimple
DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceSimple);
};
-template<>
+template <>
gab 2016/12/09 18:32:57 nit: rm extra space
Alexander Yashkin 2016/12/11 16:34:32 Removed
TestingPrefServiceBase<PrefService, PrefRegistry>::TestingPrefServiceBase(
TestingPrefStore* managed_prefs,
+ TestingPrefStore* extension_prefs,
TestingPrefStore* user_prefs,
TestingPrefStore* recommended_prefs,
PrefRegistry* pref_registry,
@@ -134,6 +143,25 @@ void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::
}
template <class SuperPrefService, class ConstructionPrefRegistry>
+const base::Value* TestingPrefServiceBase<
+ SuperPrefService,
+ ConstructionPrefRegistry>::GetExtensionPref(const std::string& path) const {
+ return GetPref(extension_prefs_.get(), path);
+}
+
+template <class SuperPrefService, class ConstructionPrefRegistry>
+void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::
+ SetExtensionPref(const std::string& path, base::Value* value) {
+ SetPref(extension_prefs_.get(), path, value);
+}
+
+template <class SuperPrefService, class ConstructionPrefRegistry>
+void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::
+ RemoveExtensionPref(const std::string& path) {
+ RemovePref(extension_prefs_.get(), path);
+}
+
+template <class SuperPrefService, class ConstructionPrefRegistry>
const base::Value*
TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::GetUserPref(
const std::string& path) const {
« no previous file with comments | « components/pref_registry/testing_pref_service_syncable.cc ('k') | components/prefs/testing_pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698