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

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

Issue 2111253002: Clean up old legacy preference migration logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove now unused kHashStoreId in unit test Created 4 years, 5 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
« no previous file with comments | « chrome/browser/prefs/profile_pref_store_manager.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7e0d6dcc84e68a57c9e2ac80cefc5c1ebaa72432..69aeac01ab8de56c353adab97b4b08f3ec01ebb2 100644
--- a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
+++ b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
@@ -29,7 +29,6 @@
#include "components/user_prefs/tracked/mock_validation_delegate.h"
#include "components/user_prefs/tracked/pref_hash_filter.h"
#include "components/user_prefs/tracked/pref_names.h"
-#include "components/user_prefs/tracked/pref_service_hash_store_contents.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -99,7 +98,6 @@ class ProfilePrefStoreManagerTest : public testing::Test {
reset_recorded_(false) {}
void SetUp() override {
- ProfilePrefStoreManager::RegisterPrefs(local_state_.registry());
ProfilePrefStoreManager::RegisterProfilePrefs(profile_pref_registry_.get());
for (const PrefHashFilter::TrackedPreferenceMetadata* it = kConfiguration;
it != kConfiguration + arraysize(kConfiguration);
@@ -198,15 +196,6 @@ class ProfilePrefStoreManagerTest : public testing::Test {
}
}
- void InitializeDeprecatedCombinedProfilePrefStore() {
- scoped_refptr<PersistentPrefStore> pref_store =
- manager_->CreateDeprecatedCombinedProfilePrefStore(
- main_message_loop_.task_runner());
- InitializePrefStore(pref_store.get());
- pref_store = NULL;
- base::RunLoop().RunUntilIdle();
- }
-
void InitializePrefStore(PersistentPrefStore* pref_store) {
pref_store->AddObserver(&registry_verifier_);
PersistentPrefStore::PrefReadError error = pref_store->ReadPrefs();
@@ -332,83 +321,6 @@ TEST_F(ProfilePrefStoreManagerTest, ProtectValues) {
ExpectValidationObserved(kProtectedAtomic);
}
-TEST_F(ProfilePrefStoreManagerTest, MigrateFromOneFile) {
- InitializeDeprecatedCombinedProfilePrefStore();
-
- // The deprecated model stores hashes in local state (on supported
- // platforms)..
- ASSERT_EQ(
- ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
- local_state_.GetUserPrefValue(
- PrefServiceHashStoreContents::kProfilePreferenceHashes) != NULL);
-
- LoadExistingPrefs();
-
- // After a first migration, the hashes were copied to the two user preference
- // files but were not cleaned.
- ASSERT_EQ(
- ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
- local_state_.GetUserPrefValue(
- PrefServiceHashStoreContents::kProfilePreferenceHashes) != NULL);
-
- ExpectStringValueEquals(kTrackedAtomic, kFoobar);
- ExpectStringValueEquals(kProtectedAtomic, kHelloWorld);
- VerifyResetRecorded(false);
-
- LoadExistingPrefs();
-
- // In a subsequent launch, the local state hash store should be reset.
- ASSERT_FALSE(local_state_.GetUserPrefValue(
- PrefServiceHashStoreContents::kProfilePreferenceHashes));
-
- ExpectStringValueEquals(kTrackedAtomic, kFoobar);
- ExpectStringValueEquals(kProtectedAtomic, kHelloWorld);
- VerifyResetRecorded(false);
-}
-
-TEST_F(ProfilePrefStoreManagerTest, MigrateWithTampering) {
- InitializeDeprecatedCombinedProfilePrefStore();
-
- ReplaceStringInPrefs(kFoobar, kBarfoo);
- ReplaceStringInPrefs(kHelloWorld, kGoodbyeWorld);
-
- // The deprecated model stores hashes in local state (on supported
- // platforms)..
- ASSERT_EQ(
- ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
- local_state_.GetUserPrefValue(
- PrefServiceHashStoreContents::kProfilePreferenceHashes) != NULL);
-
- LoadExistingPrefs();
-
- // After a first migration, the hashes were copied to the two user preference
- // files but were not cleaned.
- ASSERT_EQ(
- ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
- local_state_.GetUserPrefValue(
- PrefServiceHashStoreContents::kProfilePreferenceHashes) != NULL);
-
- // kTrackedAtomic is unprotected and thus will be loaded as it appears on
- // disk.
- ExpectStringValueEquals(kTrackedAtomic, kBarfoo);
-
- // If preference tracking is supported, the tampered value of kProtectedAtomic
- // will be discarded at load time, leaving this preference undefined.
- EXPECT_NE(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
- pref_store_->GetValue(kProtectedAtomic, NULL));
- VerifyResetRecorded(
- ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking);
-
- LoadExistingPrefs();
-
- // In a subsequent launch, the local state hash store would be reset.
- ASSERT_FALSE(local_state_.GetUserPrefValue(
- PrefServiceHashStoreContents::kProfilePreferenceHashes));
-
- ExpectStringValueEquals(kTrackedAtomic, kBarfoo);
- VerifyResetRecorded(false);
-}
-
TEST_F(ProfilePrefStoreManagerTest, InitializePrefsFromMasterPrefs) {
base::DictionaryValue master_prefs;
master_prefs.Set(kTrackedAtomic, new base::StringValue(kFoobar));
« no previous file with comments | « chrome/browser/prefs/profile_pref_store_manager.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698