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

Unified Diff: chrome/browser/prefs/profile_pref_store_manager_unittest.cc

Issue 2719833002: Convert TrackedPreferenceValidationDelegate into a mojo interface. (Closed)
Patch Set: rebase Created 3 years, 9 months 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
Index: chrome/browser/prefs/profile_pref_store_manager_unittest.cc
diff --git a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
index 49d38849602f9beb115998d9257b749e3bdcc2d1..01503e8d996ddae3a09c1361ccb525f873ec9804 100644
--- a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
+++ b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
@@ -99,6 +99,9 @@ class ProfilePrefStoreManagerTest : public testing::Test {
reset_recorded_(false) {}
void SetUp() override {
+ mock_validation_delegate_record_ = new MockValidationDelegateRecord;
+ mock_validation_delegate_ = base::MakeUnique<MockValidationDelegate>(
+ mock_validation_delegate_record_);
ProfilePrefStoreManager::RegisterProfilePrefs(profile_pref_registry_.get());
for (const PrefHashFilter::TrackedPreferenceMetadata* it = kConfiguration;
it != kConfiguration + arraysize(kConfiguration);
@@ -167,12 +170,15 @@ class ProfilePrefStoreManagerTest : public testing::Test {
void InitializePrefs() {
// According to the implementation of ProfilePrefStoreManager, this is
// actually a SegregatedPrefStore backed by two underlying pref stores.
+ std::unique_ptr<prefs::mojom::TrackedPreferenceValidationDelegate>
+ mock_validation_delegate = base::MakeUnique<MockValidationDelegate>(
dcheng 2017/03/07 08:14:15 Nit: using auto here is OK.
Sam McNally 2017/03/08 00:06:53 Done.
+ mock_validation_delegate_record_);
scoped_refptr<PersistentPrefStore> pref_store =
manager_->CreateProfilePrefStore(
main_message_loop_.task_runner(),
base::Bind(&ProfilePrefStoreManagerTest::RecordReset,
base::Unretained(this)),
- &mock_validation_delegate_);
+ mock_validation_delegate_.get());
InitializePrefStore(pref_store.get());
pref_store = NULL;
base::RunLoop().RunUntilIdle();
@@ -256,7 +262,7 @@ class ProfilePrefStoreManagerTest : public testing::Test {
// No validations are expected for platforms that do not support tracking.
if (!ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking)
return;
- if (!mock_validation_delegate_.GetEventForPath(pref_path))
+ if (!mock_validation_delegate_record_->GetEventForPath(pref_path))
ADD_FAILURE() << "No validation observed for preference: " << pref_path;
}
@@ -266,7 +272,8 @@ class ProfilePrefStoreManagerTest : public testing::Test {
TestingPrefServiceSimple local_state_;
scoped_refptr<user_prefs::PrefRegistrySyncable> profile_pref_registry_;
RegistryVerifier registry_verifier_;
- MockValidationDelegate mock_validation_delegate_;
+ scoped_refptr<MockValidationDelegateRecord> mock_validation_delegate_record_;
+ std::unique_ptr<MockValidationDelegate> mock_validation_delegate_;
std::unique_ptr<ProfilePrefStoreManager> manager_;
scoped_refptr<PersistentPrefStore> pref_store_;

Powered by Google App Engine
This is Rietveld 408576698