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

Unified Diff: chrome/browser/profiles/profile_list_desktop_browsertest.cc

Issue 1242793005: Refactor most c/b/profiles calls to ProfileInfoCache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows unit test and ChromeOS build Created 5 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
Index: chrome/browser/profiles/profile_list_desktop_browsertest.cc
diff --git a/chrome/browser/profiles/profile_list_desktop_browsertest.cc b/chrome/browser/profiles/profile_list_desktop_browsertest.cc
index b49e226cf5f1bee24308d42f8052c6a725b97e44..64fafdd931e407b0babb2bc38c6f6be42c584af6 100644
--- a/chrome/browser/profiles/profile_list_desktop_browsertest.cc
+++ b/chrome/browser/profiles/profile_list_desktop_browsertest.cc
@@ -33,8 +33,8 @@ class ProfileListDesktopBrowserTest : public InProcessBrowserTest {
public:
ProfileListDesktopBrowserTest() {}
- scoped_ptr<AvatarMenu> CreateAvatarMenu(ProfileInfoCache* cache) {
- return scoped_ptr<AvatarMenu>(new AvatarMenu(cache, NULL, browser()));
+ scoped_ptr<AvatarMenu> CreateAvatarMenu(ProfileAttributesStorage* storage) {
+ return scoped_ptr<AvatarMenu>(new AvatarMenu(storage, NULL, browser()));
}
private:
@@ -59,10 +59,10 @@ IN_PROC_BROWSER_TEST_F(ProfileListDesktopBrowserTest, MAYBE_SignOut) {
ProfileManager* profile_manager = g_browser_process->profile_manager();
Profile* current_profile = browser()->profile();
- ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(current_profile->GetPath());
+ ProfileAttributesStorage& storage =
+ profile_manager->GetProfileAttributesStorage();
- scoped_ptr<AvatarMenu> menu = CreateAvatarMenu(&cache);
+ scoped_ptr<AvatarMenu> menu = CreateAvatarMenu(&storage);
menu->RebuildMenu();
BrowserList* browser_list =
@@ -72,11 +72,14 @@ IN_PROC_BROWSER_TEST_F(ProfileListDesktopBrowserTest, MAYBE_SignOut) {
chrome::NOTIFICATION_BROWSER_CLOSED,
content::Source<Browser>(browser()));
- EXPECT_FALSE(cache.ProfileIsSigninRequiredAtIndex(index));
+ ProfileAttributesEntry* entry;
+ ASSERT_TRUE(
+ storage.GetProfileAttributesWithPath(current_profile->GetPath(), &entry));
+ EXPECT_FALSE(entry->IsSigninRequired());
profiles::LockProfile(current_profile);
window_close_observer.Wait(); // rely on test time-out for failure indication
- EXPECT_TRUE(cache.ProfileIsSigninRequiredAtIndex(index));
+ EXPECT_TRUE(entry->IsSigninRequired());
EXPECT_EQ(0U, browser_list->size());
// Signing out brings up the User Manager which we should close before exit.
@@ -103,9 +106,10 @@ IN_PROC_BROWSER_TEST_F(ProfileListDesktopBrowserTest, MAYBE_SwitchToProfile) {
ProfileManager* profile_manager = g_browser_process->profile_manager();
Profile* current_profile = browser()->profile();
- ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
+ ProfileAttributesStorage& storage =
+ profile_manager->GetProfileAttributesStorage();
base::FilePath path_profile1 = current_profile->GetPath();
- base::FilePath user_dir = cache.GetUserDataDir();
+ base::FilePath user_dir = storage.GetUserDataDir();
// Create an additional profile.
base::FilePath path_profile2 = user_dir.Append(
@@ -118,9 +122,9 @@ IN_PROC_BROWSER_TEST_F(ProfileListDesktopBrowserTest, MAYBE_SwitchToProfile) {
// Spin to allow profile creation to take place, loop is terminated
// by OnUnblockOnProfileCreation when the profile is created.
content::RunMessageLoop();
- ASSERT_EQ(cache.GetNumberOfProfiles(), 2U);
+ ASSERT_EQ(storage.GetNumberOfProfiles(), 2U);
- scoped_ptr<AvatarMenu> menu = CreateAvatarMenu(&cache);
+ scoped_ptr<AvatarMenu> menu = CreateAvatarMenu(&storage);
menu->RebuildMenu();
BrowserList* browser_list =
BrowserList::GetInstance(chrome::GetActiveDesktop());
@@ -128,18 +132,18 @@ IN_PROC_BROWSER_TEST_F(ProfileListDesktopBrowserTest, MAYBE_SwitchToProfile) {
EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath());
// Open a browser window for the first profile.
- menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1),
+ menu->SwitchToProfile(menu->GetIndexOfItemWithProfilePath(path_profile1),
false, ProfileMetrics::SWITCH_PROFILE_ICON);
EXPECT_EQ(1U, browser_list->size());
EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath());
// Open a browser window for the second profile.
- menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile2),
+ menu->SwitchToProfile(menu->GetIndexOfItemWithProfilePath(path_profile2),
false, ProfileMetrics::SWITCH_PROFILE_ICON);
EXPECT_EQ(2U, browser_list->size());
// Switch to the first profile without opening a new window.
- menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1),
+ menu->SwitchToProfile(menu->GetIndexOfItemWithProfilePath(path_profile1),
false, ProfileMetrics::SWITCH_PROFILE_ICON);
EXPECT_EQ(2U, browser_list->size());
EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath());

Powered by Google App Engine
This is Rietveld 408576698