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

Side by Side Diff: chrome/browser/profiles/profile_manager_unittest.cc

Issue 323133005: Enable consistent identity on android platform by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 EXPECT_EQ(dest_path2, profile_manager->GetLastUsedProfile()->GetPath()); 881 EXPECT_EQ(dest_path2, profile_manager->GetLastUsedProfile()->GetPath());
882 EXPECT_EQ(profile_name2, local_state->GetString(prefs::kProfileLastUsed)); 882 EXPECT_EQ(profile_name2, local_state->GetString(prefs::kProfileLastUsed));
883 } 883 }
884 884
885 TEST_F(ProfileManagerTest, ProfileDisplayNameResetsDefaultName) { 885 TEST_F(ProfileManagerTest, ProfileDisplayNameResetsDefaultName) {
886 if (!profiles::IsMultipleProfilesEnabled()) 886 if (!profiles::IsMultipleProfilesEnabled())
887 return; 887 return;
888 888
889 // The command line is reset at the end of every test by the test suite. 889 // The command line is reset at the end of every test by the test suite.
890 CommandLine::ForCurrentProcess()->AppendSwitch( 890 CommandLine::ForCurrentProcess()->AppendSwitch(
891 switches::kNewProfileManagement); 891 switches::kEnableNewProfileManagement);
892 892
893 ProfileManager* profile_manager = g_browser_process->profile_manager(); 893 ProfileManager* profile_manager = g_browser_process->profile_manager();
894 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 894 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
895 EXPECT_EQ(0u, cache.GetNumberOfProfiles()); 895 EXPECT_EQ(0u, cache.GetNumberOfProfiles());
896 896
897 // Only one local profile means we display IDS_SINGLE_PROFILE_DISPLAY_NAME. 897 // Only one local profile means we display IDS_SINGLE_PROFILE_DISPLAY_NAME.
898 const base::string16 default_profile_name = 898 const base::string16 default_profile_name =
899 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME); 899 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME);
900 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0); 900 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0);
901 Profile* profile1 = AddProfileToCache(profile_manager, 901 Profile* profile1 = AddProfileToCache(profile_manager,
(...skipping 14 matching lines...) Expand all
916 base::RunLoop().RunUntilIdle(); 916 base::RunLoop().RunUntilIdle();
917 EXPECT_EQ(default_profile_name, profiles::GetAvatarNameForProfile(profile1)); 917 EXPECT_EQ(default_profile_name, profiles::GetAvatarNameForProfile(profile1));
918 } 918 }
919 919
920 TEST_F(ProfileManagerTest, ProfileDisplayNamePreservesCustomName) { 920 TEST_F(ProfileManagerTest, ProfileDisplayNamePreservesCustomName) {
921 if (!profiles::IsMultipleProfilesEnabled()) 921 if (!profiles::IsMultipleProfilesEnabled())
922 return; 922 return;
923 923
924 // The command line is reset at the end of every test by the test suite. 924 // The command line is reset at the end of every test by the test suite.
925 CommandLine::ForCurrentProcess()->AppendSwitch( 925 CommandLine::ForCurrentProcess()->AppendSwitch(
926 switches::kNewProfileManagement); 926 switches::kEnableNewProfileManagement);
927 927
928 ProfileManager* profile_manager = g_browser_process->profile_manager(); 928 ProfileManager* profile_manager = g_browser_process->profile_manager();
929 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 929 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
930 EXPECT_EQ(0u, cache.GetNumberOfProfiles()); 930 EXPECT_EQ(0u, cache.GetNumberOfProfiles());
931 931
932 // Only one local profile means we display IDS_SINGLE_PROFILE_DISPLAY_NAME. 932 // Only one local profile means we display IDS_SINGLE_PROFILE_DISPLAY_NAME.
933 const base::string16 default_profile_name = 933 const base::string16 default_profile_name =
934 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME); 934 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME);
935 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0); 935 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0);
936 Profile* profile1 = AddProfileToCache(profile_manager, 936 Profile* profile1 = AddProfileToCache(profile_manager,
(...skipping 18 matching lines...) Expand all
955 ProfileManager::CreateCallback()); 955 ProfileManager::CreateCallback());
956 // Spin the message loop so that all the callbacks can finish running. 956 // Spin the message loop so that all the callbacks can finish running.
957 base::RunLoop().RunUntilIdle(); 957 base::RunLoop().RunUntilIdle();
958 EXPECT_EQ(custom_profile_name, profiles::GetAvatarNameForProfile(profile1)); 958 EXPECT_EQ(custom_profile_name, profiles::GetAvatarNameForProfile(profile1));
959 } 959 }
960 960
961 TEST_F(ProfileManagerTest, ProfileDisplayNamePreservesSignedInName) { 961 TEST_F(ProfileManagerTest, ProfileDisplayNamePreservesSignedInName) {
962 if (!profiles::IsMultipleProfilesEnabled()) 962 if (!profiles::IsMultipleProfilesEnabled())
963 return; 963 return;
964 964
965 // The command line is reset at the end of every test by the test suite. 965 // The command line is reset at the end of every test by the test suite.
966 CommandLine::ForCurrentProcess()->AppendSwitch( 966 CommandLine::ForCurrentProcess()->AppendSwitch(
967 switches::kNewProfileManagement); 967 switches::kEnableNewProfileManagement);
968 968
969 ProfileManager* profile_manager = g_browser_process->profile_manager(); 969 ProfileManager* profile_manager = g_browser_process->profile_manager();
970 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 970 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
971 EXPECT_EQ(0u, cache.GetNumberOfProfiles()); 971 EXPECT_EQ(0u, cache.GetNumberOfProfiles());
972 972
973 // Only one local profile means we display IDS_SINGLE_PROFILE_DISPLAY_NAME. 973 // Only one local profile means we display IDS_SINGLE_PROFILE_DISPLAY_NAME.
974 const base::string16 default_profile_name = 974 const base::string16 default_profile_name =
975 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME); 975 l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME);
976 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0); 976 const base::string16 profile_name1 = cache.ChooseNameForNewProfile(0);
977 Profile* profile1 = AddProfileToCache(profile_manager, 977 Profile* profile1 = AddProfileToCache(profile_manager,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 dest_path2.BaseName().MaybeAsASCII()); 1098 dest_path2.BaseName().MaybeAsASCII());
1099 profile_manager->ScheduleProfileForDeletion(dest_path2, 1099 profile_manager->ScheduleProfileForDeletion(dest_path2,
1100 ProfileManager::CreateCallback()); 1100 ProfileManager::CreateCallback());
1101 // Spin the message loop so that all the callbacks can finish running. 1101 // Spin the message loop so that all the callbacks can finish running.
1102 base::RunLoop().RunUntilIdle(); 1102 base::RunLoop().RunUntilIdle();
1103 1103
1104 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); 1104 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath());
1105 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); 1105 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed));
1106 } 1106 }
1107 #endif // !defined(OS_MACOSX) 1107 #endif // !defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698