Index: chrome/test/base/testing_profile_manager.cc |
diff --git a/chrome/test/base/testing_profile_manager.cc b/chrome/test/base/testing_profile_manager.cc |
index cd3eb5d31884c28c154035e616a4dd4ace359bde..3c9be5d78005dab00198c7d1ef26b46058ba8572 100644 |
--- a/chrome/test/base/testing_profile_manager.cc |
+++ b/chrome/test/base/testing_profile_manager.cc |
@@ -14,6 +14,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
const std::string kGuestProfileName = "Guest"; |
+const std::string kUserManagerProfileName = "UserManager"; |
namespace testing { |
@@ -125,27 +126,42 @@ TestingProfile* TestingProfileManager::CreateGuestProfile() { |
return profile; |
} |
+TestingProfile* TestingProfileManager::CreateUserManagerProfile() { |
+ DCHECK(called_set_up_); |
+ |
+ // Create the profile and register it. |
+ TestingProfile::Builder builder; |
+ builder.SetGuestSession(); |
+ builder.SetPath(ProfileManager::GetUserManagerProfilePath()); |
+ |
+ // Add the profile to the profile manager, but not to the info cache. |
+ TestingProfile* profile = builder.Build().release(); |
+ profile->set_profile_name(kUserManagerProfileName); |
+ profile_manager_->AddProfile(profile); // Takes ownership. |
+ testing_profiles_.insert(std::make_pair(kUserManagerProfileName, profile)); |
+ |
+ return profile; |
+} |
+ |
void TestingProfileManager::DeleteTestingProfile(const std::string& name) { |
DCHECK(called_set_up_); |
TestingProfilesMap::iterator it = testing_profiles_.find(name); |
DCHECK(it != testing_profiles_.end()); |
- |
TestingProfile* profile = it->second; |
- ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
- cache.DeleteProfileFromCache(profile->GetPath()); |
- |
- profile_manager_->profiles_info_.erase(profile->GetPath()); |
+ DeleteProfileWithPath(profile->GetPath()); |
} |
-void TestingProfileManager::DeleteGuestProfile() { |
+void TestingProfileManager::DeleteProfileWithPath(const base::FilePath& path) { |
DCHECK(called_set_up_); |
- TestingProfilesMap::iterator it = testing_profiles_.find(kGuestProfileName); |
- DCHECK(it != testing_profiles_.end()); |
+ ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
+ if (cache.GetIndexOfProfileWithPath(path) != std::string::npos) { |
+ cache.DeleteProfileFromCache(path); |
+ } |
- profile_manager_->profiles_info_.erase(ProfileManager::GetGuestProfilePath()); |
+ profile_manager_->profiles_info_.erase(path); |
} |
void TestingProfileManager::DeleteProfileInfoCache() { |