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

Unified Diff: chrome/test/base/testing_profile_manager.cc

Issue 239543012: The User Manager should be backed by a special profile, not the guest one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nico's comment + fix tests Created 6 years, 8 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 | « chrome/test/base/testing_profile_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « chrome/test/base/testing_profile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698