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

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

Issue 102913002: [Mac] User manager should show up as a standalone window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 7 years 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 048fbff3b1aa0660246f9d5c381bfa27b38d4cf2..01ffd6b7242e54b062ac7fb013b224d4d1583f13 100644
--- a/chrome/test/base/testing_profile_manager.cc
+++ b/chrome/test/base/testing_profile_manager.cc
@@ -13,6 +13,8 @@
#include "chrome/test/base/testing_browser_process.h"
#include "testing/gtest/include/gtest/gtest.h"
+const std::string kGuestProfileName = "Guest";
+
namespace testing {
class ProfileManager : public ::ProfileManagerWithoutInit {
@@ -93,6 +95,25 @@ TestingProfile* TestingProfileManager::CreateTestingProfile(
TestingProfile::TestingFactories());
}
+TestingProfile* TestingProfileManager::CreateGuestProfile() {
+ DCHECK(called_set_up_);
+
+ // Create the profile and register it.
+ TestingProfile::Builder builder;
+ builder.SetGuestSession();
+ builder.SetPath(ProfileManager::GetGuestProfilePath());
+
+ // Add the guest profile to the profile manager, but not to the info cache.
+ TestingProfile* profile = builder.Build().release();
+ profile->set_profile_name(kGuestProfileName);
+ profile_manager_->AddProfile(profile); // Takes ownership.
+ profile_manager_->SetGuestProfilePrefs(profile);
+
+ testing_profiles_.insert(std::make_pair(kGuestProfileName, profile));
+
+ return profile;
+}
+
void TestingProfileManager::DeleteTestingProfile(const std::string& name) {
DCHECK(called_set_up_);
@@ -107,6 +128,15 @@ void TestingProfileManager::DeleteTestingProfile(const std::string& name) {
profile_manager_->profiles_info_.erase(profile->GetPath());
}
+void TestingProfileManager::DeleteGuestProfile() {
+ DCHECK(called_set_up_);
+
+ TestingProfilesMap::iterator it = testing_profiles_.find(kGuestProfileName);
+ DCHECK(it != testing_profiles_.end());
+
+ profile_manager_->profiles_info_.erase(ProfileManager::GetGuestProfilePath());
+}
+
void TestingProfileManager::DeleteProfileInfoCache() {
profile_manager_->profile_info_cache_.reset(NULL);
}
« 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