Commit b751bb0f authored by Victor Hugo Vianna Silva's avatar Victor Hugo Vianna Silva Committed by Commit Bot

Remove migration code for sync.local_device_guids pref

The code to migrate sync.local_device_guids to the new
sync.local_device_guids_with_timestamp has been active for 1 year
(crrev.com/1827435), so it can be removed now.

TBR=treib@chromium.org
TBR=droger@chromium.org

Fixed: 994339
Change-Id: If6fed35ada178808a4171d790f51451f5a8192df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464934
Commit-Queue: Victor Vianna <victorvianna@google.com>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816117}
parent 8997ea79
......@@ -1065,8 +1065,6 @@ void MigrateObsoleteProfilePrefs(Profile* profile) {
profile_prefs->ClearPref(
kDataReductionProxySavingsClearedNegativeSystemClock);
// Added 10/2019.
syncer::DeviceInfoPrefs::MigrateRecentLocalCacheGuidsPref(profile_prefs);
#if defined(OS_CHROMEOS)
// Added 10/2019.
profile_prefs->ClearPref(kDisplayRotationAcceleratorDialogHasBeenAccepted);
......
......@@ -17,10 +17,6 @@
namespace syncer {
namespace {
// Name of obsolete preference that stores most recently used past cache
// GUIDs, most recent first.
const char kObsoleteDeviceInfoRecentGUIDs[] = "sync.local_device_guids";
// Preference name for storing recently used cache GUIDs and their timestamps
// in days since Windows epoch. Most recent first.
const char kDeviceInfoRecentGUIDsWithTimestamps[] =
......@@ -54,25 +50,6 @@ bool MatchesGuidInDictionary(const base::Value& dict,
// static
void DeviceInfoPrefs::RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterListPref(kDeviceInfoRecentGUIDsWithTimestamps);
registry->RegisterListPref(kObsoleteDeviceInfoRecentGUIDs);
}
// static
void DeviceInfoPrefs::MigrateRecentLocalCacheGuidsPref(
PrefService* pref_service) {
base::Value::ConstListView obsolete_cache_guids =
pref_service->GetList(kObsoleteDeviceInfoRecentGUIDs)->GetList();
DeviceInfoPrefs prefs(pref_service, base::DefaultClock::GetInstance());
// Iterate in reverse order to maintain original order.
for (auto it = obsolete_cache_guids.rbegin();
it != obsolete_cache_guids.rend(); ++it) {
if (it->is_string()) {
prefs.AddLocalCacheGuid(it->GetString());
}
}
pref_service->ClearPref(kObsoleteDeviceInfoRecentGUIDs);
}
DeviceInfoPrefs::DeviceInfoPrefs(PrefService* pref_service,
......
......@@ -24,8 +24,6 @@ class DeviceInfoPrefs {
public:
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
static void MigrateRecentLocalCacheGuidsPref(PrefService* pref_service);
// |pref_service| and |clock| must outlive this class and be non null.
DeviceInfoPrefs(PrefService* pref_service, const base::Clock* clock);
~DeviceInfoPrefs();
......
......@@ -27,26 +27,6 @@ class DeviceInfoPrefsTest : public testing::Test {
TestingPrefServiceSimple pref_service_;
};
TEST_F(DeviceInfoPrefsTest, ShouldMigrateFromObsoletePref) {
const char kObsoleteDeviceInfoRecentGUIDs[] = "sync.local_device_guids";
ListPrefUpdate cache_guids_update(&pref_service_,
kObsoleteDeviceInfoRecentGUIDs);
cache_guids_update->Insert(cache_guids_update->GetList().begin(),
base::Value("old_guid1"));
cache_guids_update->Insert(cache_guids_update->GetList().begin(),
base::Value("old_guid2"));
ASSERT_FALSE(device_info_prefs_.IsRecentLocalCacheGuid("old_guid1"));
ASSERT_FALSE(device_info_prefs_.IsRecentLocalCacheGuid("old_guid2"));
DeviceInfoPrefs::MigrateRecentLocalCacheGuidsPref(&pref_service_);
EXPECT_TRUE(device_info_prefs_.IsRecentLocalCacheGuid("old_guid1"));
EXPECT_TRUE(device_info_prefs_.IsRecentLocalCacheGuid("old_guid2"));
}
TEST_F(DeviceInfoPrefsTest, ShouldGarbageCollectExpiredCacheGuids) {
const base::TimeDelta kMaxDaysLocalCacheGuidsStored =
base::TimeDelta::FromDays(10);
......
......@@ -268,9 +268,6 @@ void MigrateObsoleteBrowserStatePrefs(PrefService* prefs) {
prefs->ClearPref(kGoogleServicesUsername);
prefs->ClearPref(kGoogleServicesUserAccountId);
// Added 10/2019.
syncer::DeviceInfoPrefs::MigrateRecentLocalCacheGuidsPref(prefs);
// Added 1/2020.
prefs->ClearPref(kGCMChannelStatus);
prefs->ClearPref(kGCMChannelPollIntervalSeconds);
......
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