OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME); | 1035 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME); |
1036 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0); | 1036 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0); |
1037 Profile* profile1 = AddProfileToCache(profile_manager, | 1037 Profile* profile1 = AddProfileToCache(profile_manager, |
1038 "path_1", profile_name1); | 1038 "path_1", profile_name1); |
1039 EXPECT_EQ(default_profile_name, | 1039 EXPECT_EQ(default_profile_name, |
1040 profiles::GetAvatarNameForProfile(profile1->GetPath())); | 1040 profiles::GetAvatarNameForProfile(profile1->GetPath())); |
1041 | 1041 |
1042 // We should display custom names for local profiles. | 1042 // We should display custom names for local profiles. |
1043 const base::string16 custom_profile_name = ASCIIToUTF16("Batman"); | 1043 const base::string16 custom_profile_name = ASCIIToUTF16("Batman"); |
1044 cache.SetNameOfProfileAtIndex(0, custom_profile_name); | 1044 cache.SetNameOfProfileAtIndex(0, custom_profile_name); |
| 1045 cache.SetProfileIsUsingDefaultNameAtIndex(0, false); |
1045 EXPECT_EQ(custom_profile_name, cache.GetNameOfProfileAtIndex(0)); | 1046 EXPECT_EQ(custom_profile_name, cache.GetNameOfProfileAtIndex(0)); |
1046 EXPECT_EQ(custom_profile_name, | 1047 EXPECT_EQ(custom_profile_name, |
1047 profiles::GetAvatarNameForProfile(profile1->GetPath())); | 1048 profiles::GetAvatarNameForProfile(profile1->GetPath())); |
1048 | 1049 |
1049 // Multiple profiles means displaying the actual profile names. | 1050 // Multiple profiles means displaying the actual profile names. |
1050 const base::string16 profile_name2 = cache.ChooseNameForNewProfile(1); | 1051 const base::string16 profile_name2 = cache.ChooseNameForNewProfile(1); |
1051 Profile* profile2 = AddProfileToCache(profile_manager, | 1052 Profile* profile2 = AddProfileToCache(profile_manager, |
1052 "path_2", profile_name2); | 1053 "path_2", profile_name2); |
1053 EXPECT_EQ(custom_profile_name, | 1054 EXPECT_EQ(custom_profile_name, |
1054 profiles::GetAvatarNameForProfile(profile1->GetPath())); | 1055 profiles::GetAvatarNameForProfile(profile1->GetPath())); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 dest_path2.BaseName().MaybeAsASCII()); | 1209 dest_path2.BaseName().MaybeAsASCII()); |
1209 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1210 profile_manager->ScheduleProfileForDeletion(dest_path2, |
1210 ProfileManager::CreateCallback()); | 1211 ProfileManager::CreateCallback()); |
1211 // Spin the message loop so that all the callbacks can finish running. | 1212 // Spin the message loop so that all the callbacks can finish running. |
1212 base::RunLoop().RunUntilIdle(); | 1213 base::RunLoop().RunUntilIdle(); |
1213 | 1214 |
1214 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1215 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
1215 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1216 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
1216 } | 1217 } |
1217 #endif // !defined(OS_MACOSX) | 1218 #endif // !defined(OS_MACOSX) |
OLD | NEW |