Index: chrome/browser/profiles/profile_list_desktop_unittest.cc |
diff --git a/chrome/browser/profiles/profile_list_desktop_unittest.cc b/chrome/browser/profiles/profile_list_desktop_unittest.cc |
index 4f86a9f29cd71cc1c34fc2c2730f4eed9ea62fbd..a90d10ace9eb8d36723ffe8351563784f199bbf4 100644 |
--- a/chrome/browser/profiles/profile_list_desktop_unittest.cc |
+++ b/chrome/browser/profiles/profile_list_desktop_unittest.cc |
@@ -13,7 +13,8 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/prefs/pref_service_syncable.h" |
#include "chrome/browser/profiles/avatar_menu_observer.h" |
-#include "chrome/browser/profiles/profile_info_cache.h" |
+#include "chrome/browser/profiles/profile_attributes_entry.h" |
+#include "chrome/browser/profiles/profile_attributes_storage.h" |
#include "chrome/browser/profiles/profiles_state.h" |
#include "chrome/grit/generated_resources.h" |
#include "chrome/test/base/testing_browser_process.h" |
@@ -63,7 +64,7 @@ class ProfileListDesktopTest : public testing::Test { |
// Reset the model. |
avatar_menu_.reset(new AvatarMenu( |
- manager()->profile_info_cache(), |
+ manager()->profile_attributes_storage(), |
mock_observer_.get(), |
NULL)); |
avatar_menu_->RebuildMenu(); |
@@ -74,9 +75,9 @@ class ProfileListDesktopTest : public testing::Test { |
TestingProfileManager* manager() { return &manager_; } |
void AddOmittedProfile(std::string name) { |
- ProfileInfoCache* cache = manager()->profile_info_cache(); |
- cache->AddProfileToCache( |
- cache->GetUserDataDir().AppendASCII(name), ASCIIToUTF16(name), |
+ ProfileAttributesStorage* storage = manager()->profile_attributes_storage(); |
+ storage->AddProfile( |
+ storage->GetUserDataDir().AppendASCII(name), ASCIIToUTF16(name), |
std::string(), base::string16(), 0, "TEST_ID"); |
} |
@@ -110,7 +111,7 @@ TEST_F(ProfileListDesktopTest, InitialCreation) { |
} |
TEST_F(ProfileListDesktopTest, NoOmittedProfiles) { |
- ProfileListDesktop profile_list(manager()->profile_info_cache()); |
+ ProfileListDesktop profile_list(manager()->profile_attributes_storage()); |
// Profiles are stored and listed alphabetically. |
manager()->CreateTestingProfile("1 included"); |
@@ -123,32 +124,28 @@ TEST_F(ProfileListDesktopTest, NoOmittedProfiles) { |
const AvatarMenu::Item& item1 = profile_list.GetItemAt(0); |
EXPECT_EQ(0u, item1.menu_index); |
- EXPECT_EQ(0u, item1.profile_index); |
EXPECT_EQ(ASCIIToUTF16("1 included"), item1.name); |
const AvatarMenu::Item& item2 = profile_list.GetItemAt(1); |
EXPECT_EQ(1u, item2.menu_index); |
- EXPECT_EQ(1u, item2.profile_index); |
EXPECT_EQ(ASCIIToUTF16("2 included"), item2.name); |
const AvatarMenu::Item& item3 = profile_list.GetItemAt(2); |
EXPECT_EQ(2u, item3.menu_index); |
- EXPECT_EQ(2u, item3.profile_index); |
EXPECT_EQ(ASCIIToUTF16("3 included"), item3.name); |
const AvatarMenu::Item& item4 = profile_list.GetItemAt(3); |
EXPECT_EQ(3u, item4.menu_index); |
- EXPECT_EQ(3u, item4.profile_index); |
EXPECT_EQ(ASCIIToUTF16("4 included"), item4.name); |
- EXPECT_EQ(0u, profile_list.MenuIndexFromProfileIndex(0)); |
- EXPECT_EQ(1u, profile_list.MenuIndexFromProfileIndex(1)); |
- EXPECT_EQ(2u, profile_list.MenuIndexFromProfileIndex(2)); |
- EXPECT_EQ(3u, profile_list.MenuIndexFromProfileIndex(3)); |
+ EXPECT_EQ(0u, profile_list.MenuIndexFromProfilePath(item1.profile_path)); |
+ EXPECT_EQ(1u, profile_list.MenuIndexFromProfilePath(item2.profile_path)); |
+ EXPECT_EQ(2u, profile_list.MenuIndexFromProfilePath(item3.profile_path)); |
+ EXPECT_EQ(3u, profile_list.MenuIndexFromProfilePath(item4.profile_path)); |
} |
TEST_F(ProfileListDesktopTest, WithOmittedProfiles) { |
- ProfileListDesktop profile_list(manager()->profile_info_cache()); |
+ ProfileListDesktop profile_list(manager()->profile_attributes_storage()); |
// Profiles are stored and listed alphabetically. |
AddOmittedProfile("0 omitted"); |
@@ -165,28 +162,24 @@ TEST_F(ProfileListDesktopTest, WithOmittedProfiles) { |
const AvatarMenu::Item& item1 = profile_list.GetItemAt(0); |
EXPECT_EQ(0u, item1.menu_index); |
- EXPECT_EQ(1u, item1.profile_index); |
EXPECT_EQ(ASCIIToUTF16("1 included"), item1.name); |
const AvatarMenu::Item& item2 = profile_list.GetItemAt(1); |
EXPECT_EQ(1u, item2.menu_index); |
- EXPECT_EQ(3u, item2.profile_index); |
EXPECT_EQ(ASCIIToUTF16("3 included"), item2.name); |
const AvatarMenu::Item& item3 = profile_list.GetItemAt(2); |
EXPECT_EQ(2u, item3.menu_index); |
- EXPECT_EQ(4u, item3.profile_index); |
EXPECT_EQ(ASCIIToUTF16("4 included"), item3.name); |
const AvatarMenu::Item& item4 = profile_list.GetItemAt(3); |
EXPECT_EQ(3u, item4.menu_index); |
- EXPECT_EQ(6u, item4.profile_index); |
EXPECT_EQ(ASCIIToUTF16("6 included"), item4.name); |
- EXPECT_EQ(0u, profile_list.MenuIndexFromProfileIndex(1)); |
- EXPECT_EQ(1u, profile_list.MenuIndexFromProfileIndex(3)); |
- EXPECT_EQ(2u, profile_list.MenuIndexFromProfileIndex(4)); |
- EXPECT_EQ(3u, profile_list.MenuIndexFromProfileIndex(6)); |
+ EXPECT_EQ(0u, profile_list.MenuIndexFromProfilePath(item1.profile_path)); |
+ EXPECT_EQ(1u, profile_list.MenuIndexFromProfilePath(item2.profile_path)); |
+ EXPECT_EQ(2u, profile_list.MenuIndexFromProfilePath(item3.profile_path)); |
+ EXPECT_EQ(3u, profile_list.MenuIndexFromProfilePath(item4.profile_path)); |
} |
TEST_F(ProfileListDesktopTest, ActiveItem) { |
@@ -223,8 +216,12 @@ TEST_F(ProfileListDesktopTest, ModifyingNameResortsCorrectly) { |
// Change name of the first profile, to trigger resorting of the profiles: |
// now the first model should be named "beta", and the second be "gamma". |
- manager()->profile_info_cache()->SetNameOfProfileAtIndex(0, |
- ASCIIToUTF16(newname1)); |
+ ProfileAttributesStorage* storage = manager()->profile_attributes_storage(); |
+ ProfileAttributesEntry* entry; |
+ ASSERT_TRUE( |
+ storage->GetProfileAttributesWithPath(item1.profile_path, &entry)); |
+ entry->SetName(ASCIIToUTF16(newname1)); |
+ |
const AvatarMenu::Item& item1next = model->GetItemAt(0); |
EXPECT_EQ(1, change_count()); |
EXPECT_EQ(0U, item1next.menu_index); |
@@ -336,12 +333,13 @@ TEST_F(ProfileListDesktopTest, SyncState) { |
manager()->CreateTestingProfile("Test 1"); |
// Add a managed user profile. |
- ProfileInfoCache* cache = manager()->profile_info_cache(); |
- base::FilePath path = cache->GetUserDataDir().AppendASCII("p2"); |
- cache->AddProfileToCache(path, ASCIIToUTF16("Test 2"), std::string(), |
+ ProfileAttributesStorage* storage = manager()->profile_attributes_storage(); |
+ base::FilePath path = storage->GetUserDataDir().AppendASCII("p2"); |
+ storage->AddProfile(path, ASCIIToUTF16("Test 2"), std::string(), |
base::string16(), 0, "TEST_ID"); |
- cache->SetIsOmittedProfileAtIndex(cache->GetIndexOfProfileWithPath(path), |
- false); |
+ ProfileAttributesEntry* entry; |
+ ASSERT_TRUE(storage->GetProfileAttributesWithPath(path, &entry)); |
+ entry->SetIsOmitted(false); |
AvatarMenu* model = GetAvatarMenu(); |
model->RebuildMenu(); |