summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-14 17:09:14 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-14 17:09:14 +0000
commitf52c94fc32b42a121aab3448d8647b99d21bcd71 (patch)
tree1984153fbd3990cc3957d80c4b437b46ada85f2b
parent767cbccaa9735a646193b50e69b686fc0139df5e (diff)
downloadchromium_src-f52c94fc32b42a121aab3448d8647b99d21bcd71.zip
chromium_src-f52c94fc32b42a121aab3448d8647b99d21bcd71.tar.gz
chromium_src-f52c94fc32b42a121aab3448d8647b99d21bcd71.tar.bz2
Revert 251352 "cros: Enable multiprofile for everyone."
> cros: Enable multiprofile for everyone. > > BUG=338941 > R=dpolukhin@chromium.org, nkostylev@chromium.org > > Review URL: https://codereview.chromium.org/146193005 TBR=xiyuan@chromium.org Review URL: https://codereview.chromium.org/167173002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251357 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/file_manager/file_manager_browsertest.cc1
-rw-r--r--chrome/browser/chromeos/login/multi_profile_user_controller.cc13
-rw-r--r--chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc5
-rw-r--r--chrome/browser/chromeos/login/screen_locker_browsertest.cc1
-rw-r--r--chrome/browser/chromeos/login/user_adding_screen_browsertest.cc1
-rw-r--r--chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc1
-rw-r--r--chromeos/chromeos_switches.cc5
-rw-r--r--chromeos/chromeos_switches.h1
8 files changed, 27 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
index 7e17544..7513d5c 100644
--- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
+++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -832,6 +832,7 @@ class MultiProfileFileManagerBrowserTest : public FileManagerBrowserTestBase {
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
FileManagerBrowserTestBase::SetUpCommandLine(command_line);
command_line->AppendSwitch(switches::kMultiProfiles);
+ command_line->AppendSwitch(chromeos::switches::kForceMultiProfileInTests);
// Logs in to a dummy profile (For making MultiProfileWindowManager happy;
// browser test creates a default window and the manager tries to assign a
// user for it, and we need a profile connected to a user.)
diff --git a/chrome/browser/chromeos/login/multi_profile_user_controller.cc b/chrome/browser/chromeos/login/multi_profile_user_controller.cc
index 847c27b..f5eb9a9 100644
--- a/chrome/browser/chromeos/login/multi_profile_user_controller.cc
+++ b/chrome/browser/chromeos/login/multi_profile_user_controller.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/login/multi_profile_user_controller.h"
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_change_registrar.h"
#include "base/prefs/pref_registry_simple.h"
@@ -18,6 +19,7 @@
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
+#include "chromeos/chromeos_switches.h"
#include "google_apis/gaia/gaia_auth_util.h"
namespace chromeos {
@@ -59,9 +61,18 @@ void MultiProfileUserController::RegisterPrefs(
// static
void MultiProfileUserController::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
+ // Use "disabled" default if there is no user manager or no logged in user.
+ // This is true for signin profile (where the value does not matter) or
+ // for the primary user's profile. This essentially disables multiprofile
+ // unless the primary user has a policy to say otherwise.
+ const bool use_disable_default =
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceMultiProfileInTests) &&
+ (!UserManager::IsInitialized() ||
+ UserManager::Get()->GetLoggedInUsers().size() == 1);
registry->RegisterStringPref(
prefs::kMultiProfileUserBehavior,
- kBehaviorUnrestricted,
+ use_disable_default ? kBehaviorNotAllowed : kBehaviorUnrestricted,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
}
diff --git a/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc b/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc
index beefccd..2747f3c 100644
--- a/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc
+++ b/chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_unittest.cc
@@ -84,7 +84,12 @@ void SAMLOfflineSigninLimiterTest::CreateLimiter() {
}
void SAMLOfflineSigninLimiterTest::SetUp() {
+ const UserList user_list;
+ EXPECT_CALL(*user_manager_, GetLoggedInUsers())
+ .Times(1)
+ .WillOnce(ReturnRef(user_list));
profile_.reset(new TestingProfile);
+ Mock::VerifyAndClearExpectations(user_manager_);
SAMLOfflineSigninLimiterFactory::SetClockForTesting(&clock_);
user_manager_->AddUser(kTestUser);
diff --git a/chrome/browser/chromeos/login/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/screen_locker_browsertest.cc
index ba6bf97..d80e326 100644
--- a/chrome/browser/chromeos/login/screen_locker_browsertest.cc
+++ b/chrome/browser/chromeos/login/screen_locker_browsertest.cc
@@ -132,6 +132,7 @@ class ScreenLockerTest : public InProcessBrowserTest {
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
+ command_line->AppendSwitch(switches::kForceMultiProfileInTests);
}
scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
diff --git a/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc b/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc
index 669eb6c..cd077a26 100644
--- a/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc
@@ -39,6 +39,7 @@ class UserAddingScreenTest : public LoginManagerTest,
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
LoginManagerTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(::switches::kMultiProfiles);
+ command_line->AppendSwitch(switches::kForceMultiProfileInTests);
}
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
diff --git a/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc b/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc
index c121930..33fbebf 100644
--- a/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc
+++ b/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc
@@ -59,6 +59,7 @@ class AccountsOptionsTest : public LoginManagerTest {
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
LoginManagerTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(::switches::kMultiProfiles);
+ command_line->AppendSwitch(switches::kForceMultiProfileInTests);
}
protected:
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc
index 619d14b..fede17d 100644
--- a/chromeos/chromeos_switches.cc
+++ b/chromeos/chromeos_switches.cc
@@ -149,6 +149,11 @@ const char kFirstExecAfterBoot[] = "first-exec-after-boot";
// tests can change how it's brought up. This flag disables that.
const char kForceLoginManagerInTests[] = "force-login-manager-in-tests";
+// Sets primary user's default multiprofile behavior to 'unrestricted' for
+// tests so that multiprofile is enabled for any user.
+// TODO(xiyuan): Remove when multiprofile is released to everyone.
+const char kForceMultiProfileInTests[] = "force-multi-profiles-in-tests";
+
// Makes GPU sandbox failures nonfatal.
const char kGpuSandboxFailuresNonfatal[] = "gpu-sandbox-failures-nonfatal";
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h
index eb23bf3..d2c5cf1 100644
--- a/chromeos/chromeos_switches.h
+++ b/chromeos/chromeos_switches.h
@@ -58,6 +58,7 @@ CHROMEOS_EXPORT extern const char kFileManagerEnableNewAudioPlayer[];
CHROMEOS_EXPORT extern const char kFileManagerEnableMultiProfile[];
CHROMEOS_EXPORT extern const char kFirstExecAfterBoot[];
CHROMEOS_EXPORT extern const char kForceLoginManagerInTests[];
+CHROMEOS_EXPORT extern const char kForceMultiProfileInTests[];
CHROMEOS_EXPORT extern const char kGpuSandboxFailuresNonfatal[];
CHROMEOS_EXPORT extern const char kGuestSession[];
CHROMEOS_EXPORT extern const char kHasChromeOSDiamondKey[];