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

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

Issue 504453002: Use 'You' as profile name for a single signed profile whose gaia name is not available yet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix broken tests Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/profiles/profiles_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager_unittest.cc
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index d5a000181ee1c6ca72fef7a9b1ae4e9d200a9bce..fe80ce21fbd7e58fdfe68bda8d43a6269107c2e2 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -1085,17 +1085,27 @@ TEST_F(ProfileManagerTest, ProfileDisplayNamePreservesSignedInName) {
EXPECT_EQ(default_profile_name,
profiles::GetAvatarNameForProfile(profile1->GetPath()));
- // We should display the actual profile name for signed in profiles.
+ // For a signed in profile with a default name we still display
+ // IDS_SINGLE_PROFILE_DISPLAY_NAME.
cache.SetUserNameOfProfileAtIndex(0, ASCIIToUTF16("user@gmail.com"));
EXPECT_EQ(profile_name1, cache.GetNameOfProfileAtIndex(0));
- EXPECT_EQ(profile_name1,
+ EXPECT_EQ(default_profile_name,
profiles::GetAvatarNameForProfile(profile1->GetPath()));
+ // For a signed in profile with a non-default Gaia given name we display the
+ // Gaia given name.
+ cache.SetUserNameOfProfileAtIndex(0, ASCIIToUTF16("user@gmail.com"));
+ const base::string16 gaia_given_name(ASCIIToUTF16("given name"));
+ cache.SetGAIAGivenNameOfProfileAtIndex(0, gaia_given_name);
+ EXPECT_EQ(gaia_given_name, cache.GetNameOfProfileAtIndex(0));
+ EXPECT_EQ(gaia_given_name,
+ profiles::GetAvatarNameForProfile(profile1->GetPath()));
+
// Multiple profiles means displaying the actual profile names.
const base::string16 profile_name2 = cache.ChooseNameForNewProfile(1);
Profile* profile2 = AddProfileToCache(profile_manager,
"path_2", profile_name2);
- EXPECT_EQ(profile_name1,
+ EXPECT_EQ(gaia_given_name,
profiles::GetAvatarNameForProfile(profile1->GetPath()));
EXPECT_EQ(profile_name2,
profiles::GetAvatarNameForProfile(profile2->GetPath()));
@@ -1105,7 +1115,7 @@ TEST_F(ProfileManagerTest, ProfileDisplayNamePreservesSignedInName) {
ProfileManager::CreateCallback());
// Spin the message loop so that all the callbacks can finish running.
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(profile_name1,
+ EXPECT_EQ(gaia_given_name,
profiles::GetAvatarNameForProfile(profile1->GetPath()));
}
#endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
« no previous file with comments | « no previous file | chrome/browser/profiles/profiles_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698