From 693f35aa1676ba7ff2d3ba7e950f56f20d510fe0 Mon Sep 17 00:00:00 2001 From: noms Date: Thu, 5 Feb 2015 08:03:16 -0800 Subject: [PATCH] [Profiles] Delete test-only method from the ProfileInfoCache And move it to the only test that cares about it. BUG=363524 TEST=Existing unit tests. Review URL: https://codereview.chromium.org/884923004 Cr-Commit-Position: refs/heads/master@{#314820} --- chrome/browser/profiles/profile_info_cache.cc | 17 ----------------- chrome/browser/profiles/profile_info_cache.h | 6 ------ chrome/browser/profiles/profile_info_cache_unittest.cc | 15 ++++++++++++++- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index 824a8d8e243b..5335eb9cb566 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -850,23 +850,6 @@ const base::FilePath& ProfileInfoCache::GetUserDataDir() const { } // static -std::vector ProfileInfoCache::GetProfileNames() { - std::vector names; - PrefService* local_state = g_browser_process->local_state(); - const base::DictionaryValue* cache = local_state->GetDictionary( - prefs::kProfileInfoCache); - base::string16 name; - for (base::DictionaryValue::Iterator it(*cache); !it.IsAtEnd(); - it.Advance()) { - const base::DictionaryValue* info = NULL; - it.value().GetAsDictionary(&info); - info->GetString(kNameKey, &name); - names.push_back(name); - } - return names; -} - -// static void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterDictionaryPref(prefs::kProfileInfoCache); } diff --git a/chrome/browser/profiles/profile_info_cache.h b/chrome/browser/profiles/profile_info_cache.h index 95db92c438fa..1fe893723ef1 100644 --- a/chrome/browser/profiles/profile_info_cache.h +++ b/chrome/browser/profiles/profile_info_cache.h @@ -129,12 +129,6 @@ class ProfileInfoCache : public ProfileInfoInterface, const base::FilePath& GetUserDataDir() const; - // Gets all names of profiles associated with this instance of Chrome. - // Because this method will be called during uninstall, before the creation - // of the ProfileManager, it reads directly from the local state preferences, - // rather than going through the ProfileInfoCache object. - static std::vector GetProfileNames(); - // Register cache related preferences in Local State. static void RegisterPrefs(PrefRegistrySimple* registry); diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc index 57c2e338b013..d3e6d474ce67 100644 --- a/chrome/browser/profiles/profile_info_cache_unittest.cc +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc @@ -20,6 +20,7 @@ #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/pref_names.h" #include "chrome/test/base/testing_browser_process.h" #include "components/signin/core/common/profile_management_switches.h" #include "content/public/browser/notification_observer.h" @@ -530,7 +531,19 @@ TEST_F(ProfileInfoCacheTest, AddStubProfile) { ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); // Check that the profiles can be extracted from the local state. - std::vector names = ProfileInfoCache::GetProfileNames(); + std::vector names; + PrefService* local_state = g_browser_process->local_state(); + const base::DictionaryValue* cache = local_state->GetDictionary( + prefs::kProfileInfoCache); + base::string16 name; + for (base::DictionaryValue::Iterator it(*cache); !it.IsAtEnd(); + it.Advance()) { + const base::DictionaryValue* info = NULL; + it.value().GetAsDictionary(&info); + info->GetString("name", &name); + names.push_back(name); + } + for (size_t i = 0; i < 4; i++) ASSERT_FALSE(names[i].empty()); } -- 2.11.4.GIT