Index: chrome/browser/prefs/tracked/tracked_preferences_migration_unittest.cc |
diff --git a/chrome/browser/prefs/tracked/tracked_preferences_migration_unittest.cc b/chrome/browser/prefs/tracked/tracked_preferences_migration_unittest.cc |
index 1c93a39fc0920e8cdfb6c93dc9538add9f755c5c..c2e3f02cc340a10bc8645dcb82096b6614c1107c 100644 |
--- a/chrome/browser/prefs/tracked/tracked_preferences_migration_unittest.cc |
+++ b/chrome/browser/prefs/tracked/tracked_preferences_migration_unittest.cc |
@@ -49,9 +49,9 @@ class SimpleInterceptablePrefFilter : public InterceptablePrefFilter { |
// InterceptablePrefFilter implementation. |
virtual void FinalizeFilterOnLoad( |
const PostFilterOnLoadCallback& post_filter_on_load_callback, |
- scoped_ptr<base::DictionaryValue> pref_store_contents, |
+ base::DictionaryValue* pref_store_contents, |
bool prefs_altered) OVERRIDE { |
- post_filter_on_load_callback.Run(pref_store_contents.Pass(), prefs_altered); |
+ post_filter_on_load_callback.Run(prefs_altered); |
} |
}; |
@@ -71,9 +71,7 @@ class TrackedPreferencesMigrationTest : public testing::Test { |
}; |
TrackedPreferencesMigrationTest() |
- : unprotected_prefs_(new base::DictionaryValue), |
- protected_prefs_(new base::DictionaryValue), |
- migration_modified_unprotected_store_(false), |
+ : migration_modified_unprotected_store_(false), |
migration_modified_protected_store_(false), |
unprotected_store_migration_complete_(false), |
protected_store_migration_complete_(false) {} |
@@ -103,8 +101,6 @@ class TrackedPreferencesMigrationTest : public testing::Test { |
&mock_protected_pref_filter_); |
// Verify initial expectations are met. |
- EXPECT_TRUE(HasPrefs(MOCK_UNPROTECTED_PREF_STORE)); |
- EXPECT_TRUE(HasPrefs(MOCK_PROTECTED_PREF_STORE)); |
EXPECT_FALSE( |
WasOnSuccessfulWriteCallbackRegistered(MOCK_UNPROTECTED_PREF_STORE)); |
EXPECT_FALSE( |
@@ -124,13 +120,12 @@ class TrackedPreferencesMigrationTest : public testing::Test { |
base::DictionaryValue* store = NULL; |
switch (store_id) { |
case MOCK_UNPROTECTED_PREF_STORE: |
- store = unprotected_prefs_.get(); |
+ store = &unprotected_prefs_; |
break; |
case MOCK_PROTECTED_PREF_STORE: |
- store = protected_prefs_.get(); |
+ store = &protected_prefs_; |
break; |
} |
- DCHECK(store); |
store->SetString(key, value); |
} |
@@ -157,13 +152,12 @@ class TrackedPreferencesMigrationTest : public testing::Test { |
base::DictionaryValue* store = NULL; |
switch (store_id) { |
case MOCK_UNPROTECTED_PREF_STORE: |
- store = unprotected_prefs_.get(); |
+ store = &unprotected_prefs_; |
break; |
case MOCK_PROTECTED_PREF_STORE: |
- store = protected_prefs_.get(); |
+ store = &protected_prefs_; |
break; |
} |
- DCHECK(store); |
for (std::vector<std::pair<std::string, std::string> >::const_iterator it = |
expected_prefs_in_store.begin(); |
@@ -183,29 +177,18 @@ class TrackedPreferencesMigrationTest : public testing::Test { |
base::Bind(&TrackedPreferencesMigrationTest::GetPrefsBack, |
base::Unretained(this), |
MOCK_UNPROTECTED_PREF_STORE), |
- unprotected_prefs_.Pass()); |
+ &unprotected_prefs_); |
break; |
case MOCK_PROTECTED_PREF_STORE: |
mock_protected_pref_filter_.FilterOnLoad( |
base::Bind(&TrackedPreferencesMigrationTest::GetPrefsBack, |
base::Unretained(this), |
MOCK_PROTECTED_PREF_STORE), |
- protected_prefs_.Pass()); |
+ &protected_prefs_); |
break; |
} |
} |
- bool HasPrefs(MockPrefStoreID store_id) { |
gab
2014/06/11 21:12:55
See my previous comment on the main CL; we need so
|
- switch (store_id) { |
- case MOCK_UNPROTECTED_PREF_STORE: |
- return unprotected_prefs_; |
- case MOCK_PROTECTED_PREF_STORE: |
- return protected_prefs_; |
- } |
- NOTREACHED(); |
- return false; |
- } |
- |
bool StoreModifiedByMigration(MockPrefStoreID store_id) { |
switch (store_id) { |
case MOCK_UNPROTECTED_PREF_STORE: |
@@ -256,18 +239,13 @@ class TrackedPreferencesMigrationTest : public testing::Test { |
// Helper given as an InterceptablePrefFilter::FinalizeFilterOnLoadCallback |
// to the migrator to be invoked when it's done. |
void GetPrefsBack(MockPrefStoreID store_id, |
gab
2014/06/11 21:12:56
The name of this method no longer makes sense with
|
- scoped_ptr<base::DictionaryValue> prefs, |
bool prefs_altered) { |
switch (store_id) { |
case MOCK_UNPROTECTED_PREF_STORE: |
- EXPECT_FALSE(unprotected_prefs_); |
- unprotected_prefs_ = prefs.Pass(); |
migration_modified_unprotected_store_ = prefs_altered; |
unprotected_store_migration_complete_ = true; |
break; |
case MOCK_PROTECTED_PREF_STORE: |
- EXPECT_FALSE(protected_prefs_); |
- protected_prefs_ = prefs.Pass(); |
migration_modified_protected_store_ = prefs_altered; |
protected_store_migration_complete_ = true; |
break; |
@@ -278,18 +256,16 @@ class TrackedPreferencesMigrationTest : public testing::Test { |
void RemovePathFromStore(MockPrefStoreID store_id, const std::string& key) { |
switch (store_id) { |
case MOCK_UNPROTECTED_PREF_STORE: |
- ASSERT_TRUE(unprotected_prefs_); |
- unprotected_prefs_->RemovePath(key, NULL); |
+ unprotected_prefs_.RemovePath(key, NULL); |
break; |
case MOCK_PROTECTED_PREF_STORE: |
- ASSERT_TRUE(protected_prefs_); |
- protected_prefs_->RemovePath(key, NULL); |
+ protected_prefs_.RemovePath(key, NULL); |
break; |
} |
} |
- scoped_ptr<base::DictionaryValue> unprotected_prefs_; |
- scoped_ptr<base::DictionaryValue> protected_prefs_; |
+ base::DictionaryValue unprotected_prefs_; |
+ base::DictionaryValue protected_prefs_; |
SimpleInterceptablePrefFilter mock_unprotected_pref_filter_; |
SimpleInterceptablePrefFilter mock_protected_pref_filter_; |
@@ -315,8 +291,6 @@ TEST_F(TrackedPreferencesMigrationTest, NoMigrationRequired) { |
// Hand unprotected prefs to the migrator which should wait for the protected |
// prefs. |
HandPrefsToMigrator(MOCK_UNPROTECTED_PREF_STORE); |
- EXPECT_FALSE(HasPrefs(MOCK_UNPROTECTED_PREF_STORE)); |
- EXPECT_TRUE(HasPrefs(MOCK_PROTECTED_PREF_STORE)); |
EXPECT_FALSE(MigrationCompleted()); |
// Hand protected prefs to the migrator which should proceed with the |
@@ -325,8 +299,6 @@ TEST_F(TrackedPreferencesMigrationTest, NoMigrationRequired) { |
EXPECT_TRUE(MigrationCompleted()); |
// Prefs should have been handed back over. |
- EXPECT_TRUE(HasPrefs(MOCK_UNPROTECTED_PREF_STORE)); |
- EXPECT_TRUE(HasPrefs(MOCK_PROTECTED_PREF_STORE)); |
EXPECT_FALSE( |
WasOnSuccessfulWriteCallbackRegistered(MOCK_UNPROTECTED_PREF_STORE)); |
EXPECT_FALSE( |
@@ -358,15 +330,11 @@ TEST_F(TrackedPreferencesMigrationTest, FullMigration) { |
kPreviouslyProtectedPrefValue); |
HandPrefsToMigrator(MOCK_UNPROTECTED_PREF_STORE); |
- EXPECT_FALSE(HasPrefs(MOCK_UNPROTECTED_PREF_STORE)); |
- EXPECT_TRUE(HasPrefs(MOCK_PROTECTED_PREF_STORE)); |
EXPECT_FALSE(MigrationCompleted()); |
HandPrefsToMigrator(MOCK_PROTECTED_PREF_STORE); |
EXPECT_TRUE(MigrationCompleted()); |
- EXPECT_TRUE(HasPrefs(MOCK_UNPROTECTED_PREF_STORE)); |
- EXPECT_TRUE(HasPrefs(MOCK_PROTECTED_PREF_STORE)); |
EXPECT_TRUE( |
WasOnSuccessfulWriteCallbackRegistered(MOCK_UNPROTECTED_PREF_STORE)); |
EXPECT_TRUE( |
@@ -463,15 +431,11 @@ TEST_F(TrackedPreferencesMigrationTest, CleanupOnly) { |
kPreviouslyUnprotectedPrefValue); |
HandPrefsToMigrator(MOCK_UNPROTECTED_PREF_STORE); |
- EXPECT_FALSE(HasPrefs(MOCK_UNPROTECTED_PREF_STORE)); |
- EXPECT_TRUE(HasPrefs(MOCK_PROTECTED_PREF_STORE)); |
EXPECT_FALSE(MigrationCompleted()); |
HandPrefsToMigrator(MOCK_PROTECTED_PREF_STORE); |
EXPECT_TRUE(MigrationCompleted()); |
- EXPECT_TRUE(HasPrefs(MOCK_UNPROTECTED_PREF_STORE)); |
- EXPECT_TRUE(HasPrefs(MOCK_PROTECTED_PREF_STORE)); |
EXPECT_FALSE( |
WasOnSuccessfulWriteCallbackRegistered(MOCK_UNPROTECTED_PREF_STORE)); |
EXPECT_FALSE( |