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

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

Issue 196473015: [Profiles] Don't treat GAIA names differently than regular profile names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove useless comment Created 6 years, 9 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_info_cache_unittest.cc
diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc
index 972d8eff008c4a9d7db6bd352d6ea785a81b30f7..3f9b1e439746f34f0a641893eabe4bfaf67a63b8 100644
--- a/chrome/browser/profiles/profile_info_cache_unittest.cc
+++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -281,34 +281,6 @@ TEST_F(ProfileInfoCacheTest, BackgroundModeStatus) {
EXPECT_FALSE(GetCache()->GetBackgroundStatusOfProfileAtIndex(1));
}
-TEST_F(ProfileInfoCacheTest, HasMigrated) {
- GetCache()->AddProfileToCache(
- GetProfilePath("path_1"), ASCIIToUTF16("name_1"),
- base::string16(), 0, std::string());
- GetCache()->AddProfileToCache(
- GetProfilePath("path_2"), ASCIIToUTF16("name_2"),
- base::string16(), 0, std::string());
-
- // Sanity check.
- EXPECT_FALSE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(0));
- EXPECT_FALSE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(1));
-
- // Set migrated state for 2nd profile.
- GetCache()->SetHasMigratedToGAIAInfoOfProfileAtIndex(1, true);
- EXPECT_FALSE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(0));
- EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(1));
-
- // Set migrated state for 1st profile.
- GetCache()->SetHasMigratedToGAIAInfoOfProfileAtIndex(0, true);
- EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(0));
- EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(1));
-
- // Unset migrated state for 2nd profile.
- GetCache()->SetHasMigratedToGAIAInfoOfProfileAtIndex(1, false);
- EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(0));
- EXPECT_FALSE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(1));
-}
-
TEST_F(ProfileInfoCacheTest, ProfileActiveTime) {
GetCache()->AddProfileToCache(
GetProfilePath("path_1"), ASCIIToUTF16("name_1"),
@@ -342,31 +314,25 @@ TEST_F(ProfileInfoCacheTest, GAIAName) {
// Sanity check.
EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(index1).empty());
EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(index2).empty());
- EXPECT_FALSE(GetCache()->IsUsingGAIANameOfProfileAtIndex(index1));
- EXPECT_FALSE(GetCache()->IsUsingGAIANameOfProfileAtIndex(index2));
- // Set GAIA name.
+ // Set GAIA name. This re-sorts the cache.
base::string16 gaia_name(ASCIIToUTF16("Pat Smith"));
GetCache()->SetGAIANameOfProfileAtIndex(index2, gaia_name);
- EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(index1).empty());
- EXPECT_EQ(gaia_name, GetCache()->GetGAIANameOfProfileAtIndex(index2));
- EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(index2));
-
- // Use GAIA name as profile name. This re-sorts the cache.
- GetCache()->SetIsUsingGAIANameOfProfileAtIndex(index2, true);
index1 = GetCache()->GetIndexOfProfileWithPath(GetProfilePath("path_1"));
index2 = GetCache()->GetIndexOfProfileWithPath(GetProfilePath("path_2"));
- EXPECT_EQ(GetCache()->IsUsingGAIANameOfProfileAtIndex(index2), true);
- EXPECT_EQ(gaia_name, GetCache()->GetNameOfProfileAtIndex(index2));
+ // Since there is a GAIA name, we use that as a display name.
+ EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(index1).empty());
EXPECT_EQ(gaia_name, GetCache()->GetGAIANameOfProfileAtIndex(index2));
+ EXPECT_EQ(gaia_name, GetCache()->GetNameOfProfileAtIndex(index2));
// Don't use GAIA name as profile name. This re-sorts the cache.
- GetCache()->SetIsUsingGAIANameOfProfileAtIndex(index2, false);
+ base::string16 custom_name(ASCIIToUTF16("Custom name"));
+ GetCache()->SetNameOfProfileAtIndex(index2, custom_name);
index1 = GetCache()->GetIndexOfProfileWithPath(GetProfilePath("path_1"));
index2 = GetCache()->GetIndexOfProfileWithPath(GetProfilePath("path_2"));
- EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(index2));
+ EXPECT_EQ(custom_name, GetCache()->GetNameOfProfileAtIndex(index2));
EXPECT_EQ(gaia_name, GetCache()->GetGAIANameOfProfileAtIndex(index2));
}
@@ -474,7 +440,6 @@ TEST_F(ProfileInfoCacheTest, EmptyGAIAInfo) {
// Set empty GAIA info.
GetCache()->SetGAIANameOfProfileAtIndex(0, base::string16());
GetCache()->SetGAIAPictureOfProfileAtIndex(0, NULL);
- GetCache()->SetIsUsingGAIANameOfProfileAtIndex(0, true);
GetCache()->SetIsUsingGAIAPictureOfProfileAtIndex(0, true);
// Verify that the profile name and picture are not empty.

Powered by Google App Engine
This is Rietveld 408576698