Commit 7921deea authored by Nikita Podguzov's avatar Nikita Podguzov Committed by Commit Bot

Add explicit initialization of TestingPrefServiceSimple pref stores

This helper method is needed to fully complete TestingPrefServiceSimple
initialization in unit tests.

Bug: 992889
Change-Id: I752b2a3333375177448cbe37e4945e08cfdbbdc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1810917
Commit-Queue: Nikita Podguzov <nikitapodguzov@google.com>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697644}
parent 0220c3bc
...@@ -64,6 +64,9 @@ class TestingPrefServiceBase : public SuperPrefService { ...@@ -64,6 +64,9 @@ class TestingPrefServiceBase : public SuperPrefService {
// Do-nothing implementation for TestingPrefService. // Do-nothing implementation for TestingPrefService.
static void HandleReadError(PersistentPrefStore::PrefReadError error) {} static void HandleReadError(PersistentPrefStore::PrefReadError error) {}
// Set initialization status of pref stores.
void SetInitializationCompleted();
protected: protected:
TestingPrefServiceBase(TestingPrefStore* managed_prefs, TestingPrefServiceBase(TestingPrefStore* managed_prefs,
TestingPrefStore* extension_prefs, TestingPrefStore* extension_prefs,
...@@ -230,4 +233,14 @@ void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>:: ...@@ -230,4 +233,14 @@ void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::
pref_store->RemoveValue(path, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); pref_store->RemoveValue(path, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} }
template <class SuperPrefService, class ConstructionPrefRegistry>
void TestingPrefServiceBase<SuperPrefService, ConstructionPrefRegistry>::
SetInitializationCompleted() {
managed_prefs_->SetInitializationCompleted();
extension_prefs_->SetInitializationCompleted();
recommended_prefs_->SetInitializationCompleted();
// |user_prefs_| is initialized in PrefService constructor so no need to
// set initialization status again.
}
#endif // COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_ #endif // COMPONENTS_PREFS_TESTING_PREF_SERVICE_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment