summaryrefslogtreecommitdiffstats
path: root/chrome/test/base
diff options
context:
space:
mode:
authornoms@chromium.org <noms@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 05:55:34 +0000
committernoms@chromium.org <noms@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 05:55:34 +0000
commite9476cd6510e31d114e4de13e01bb54e317d2168 (patch)
treeea6a4234048b9c6faed04dfe8062a078066a2148 /chrome/test/base
parentff96a50e64c8ec6cdbb486ff865df625e2ffce47 (diff)
downloadchromium_src-e9476cd6510e31d114e4de13e01bb54e317d2168.zip
chromium_src-e9476cd6510e31d114e4de13e01bb54e317d2168.tar.gz
chromium_src-e9476cd6510e31d114e4de13e01bb54e317d2168.tar.bz2
[Mac] Enable guest mode for --new-profile-management.
BUG=324036 TEST=With the flag set, start Chrome and select "Browse as guest" from the avatar menu. A guest window should appear. From the guest window's avatar menu, clicking "End guest session" should close all the guest windows. Review URL: https://codereview.chromium.org/97123002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238591 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/base')
-rw-r--r--chrome/test/base/testing_profile.cc15
-rw-r--r--chrome/test/base/testing_profile.h7
2 files changed, 20 insertions, 2 deletions
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 4e21951..d37f170 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -176,6 +176,7 @@ TestingProfile::TestingProfile()
incognito_(false),
force_incognito_(false),
original_profile_(NULL),
+ guest_session_(false),
last_session_exited_cleanly_(true),
browser_context_dependency_manager_(
BrowserContextDependencyManager::GetInstance()),
@@ -194,6 +195,7 @@ TestingProfile::TestingProfile(const base::FilePath& path)
incognito_(false),
force_incognito_(false),
original_profile_(NULL),
+ guest_session_(false),
last_session_exited_cleanly_(true),
profile_path_(path),
browser_context_dependency_manager_(
@@ -211,6 +213,7 @@ TestingProfile::TestingProfile(const base::FilePath& path,
incognito_(false),
force_incognito_(false),
original_profile_(NULL),
+ guest_session_(false),
last_session_exited_cleanly_(true),
profile_path_(path),
browser_context_dependency_manager_(
@@ -233,6 +236,7 @@ TestingProfile::TestingProfile(
scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
scoped_ptr<PrefServiceSyncable> prefs,
bool incognito,
+ bool guest_session,
const std::string& managed_user_id,
scoped_ptr<policy::PolicyService> policy_service,
const TestingFactories& factories)
@@ -242,6 +246,7 @@ TestingProfile::TestingProfile(
incognito_(incognito),
force_incognito_(false),
original_profile_(NULL),
+ guest_session_(guest_session),
managed_user_id_(managed_user_id),
last_session_exited_cleanly_(true),
extension_special_storage_policy_(extension_policy),
@@ -849,7 +854,7 @@ bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
}
bool TestingProfile::IsGuestSession() const {
- return false;
+ return guest_session_;
}
Profile::ExitType TestingProfile::GetLastSessionExitType() {
@@ -859,7 +864,8 @@ Profile::ExitType TestingProfile::GetLastSessionExitType() {
TestingProfile::Builder::Builder()
: build_called_(false),
delegate_(NULL),
- incognito_(false) {
+ incognito_(false),
+ guest_session_(false) {
}
TestingProfile::Builder::~Builder() {
@@ -887,6 +893,10 @@ void TestingProfile::Builder::SetIncognito() {
incognito_ = true;
}
+void TestingProfile::Builder::SetGuestSession() {
+ guest_session_ = true;
+}
+
void TestingProfile::Builder::SetManagedUserId(
const std::string& managed_user_id) {
managed_user_id_ = managed_user_id;
@@ -913,6 +923,7 @@ scoped_ptr<TestingProfile> TestingProfile::Builder::Build() {
extension_policy_,
pref_service_.Pass(),
incognito_,
+ guest_session_,
managed_user_id_,
policy_service_.Pass(),
testing_factories_));
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index 7014623..d499286 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -102,6 +102,9 @@ class TestingProfile : public Profile {
// Makes the Profile being built an incognito profile.
void SetIncognito();
+ // Makes the Profile being built a guest profile.
+ void SetGuestSession();
+
// Sets the managed user ID (which is empty by default). If it is set to a
// non-empty string, the profile is managed.
void SetManagedUserId(const std::string& managed_user_id);
@@ -122,6 +125,7 @@ class TestingProfile : public Profile {
base::FilePath path_;
Delegate* delegate_;
bool incognito_;
+ bool guest_session_;
std::string managed_user_id_;
scoped_ptr<policy::PolicyService> policy_service_;
TestingFactories testing_factories_;
@@ -149,6 +153,7 @@ class TestingProfile : public Profile {
scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
scoped_ptr<PrefServiceSyncable> prefs,
bool incognito,
+ bool guest_session,
const std::string& managed_user_id,
scoped_ptr<policy::PolicyService> policy_service,
const TestingFactories& factories);
@@ -366,6 +371,8 @@ class TestingProfile : public Profile {
scoped_ptr<Profile> incognito_profile_;
Profile* original_profile_;
+ bool guest_session_;
+
std::string managed_user_id_;
// Did the last session exit cleanly? Default is true.