Index: chrome/browser/managed_mode/managed_user_service_browsertest.cc |
diff --git a/chrome/browser/managed_mode/managed_user_service_browsertest.cc b/chrome/browser/managed_mode/managed_user_service_browsertest.cc |
index 9af82f642f45274331405230836c81b1b00e751f..571f413a213bd201bd3f16d4a9bf7810ed52d118 100644 |
--- a/chrome/browser/managed_mode/managed_user_service_browsertest.cc |
+++ b/chrome/browser/managed_mode/managed_user_service_browsertest.cc |
@@ -2,6 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/command_line.h" |
#include "base/prefs/pref_service.h" |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/browser_process.h" |
@@ -14,24 +15,26 @@ |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "content/public/test/test_utils.h" |
typedef InProcessBrowserTest ManagedUserServiceTest; |
+class ManagedUserServiceTestManaged : public InProcessBrowserTest { |
+ public: |
+ // content::BrowserTestBase: |
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
+ command_line->AppendSwitch(switches::kNewProfileIsSupervised); |
+ } |
+}; |
+ |
IN_PROC_BROWSER_TEST_F(ManagedUserServiceTest, LocalPolicies) { |
Profile* profile = browser()->profile(); |
PrefService* prefs = profile->GetPrefs(); |
EXPECT_FALSE(prefs->GetBoolean(prefs::kForceSafeSearch)); |
EXPECT_TRUE(prefs->IsUserModifiablePreference(prefs::kForceSafeSearch)); |
- |
- ManagedUserService* managed_user_service = |
- ManagedUserServiceFactory::GetForProfile(profile); |
- managed_user_service->InitForTesting(); |
- |
- EXPECT_TRUE(prefs->GetBoolean(prefs::kForceSafeSearch)); |
- EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kForceSafeSearch)); |
} |
IN_PROC_BROWSER_TEST_F(ManagedUserServiceTest, ProfileName) { |
@@ -45,11 +48,22 @@ IN_PROC_BROWSER_TEST_F(ManagedUserServiceTest, ProfileName) { |
size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
EXPECT_EQ(original_name, |
UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(ManagedUserServiceTestManaged, LocalPolicies) { |
+ Profile* profile = browser()->profile(); |
+ PrefService* prefs = profile->GetPrefs(); |
+ EXPECT_TRUE(prefs->GetBoolean(prefs::kForceSafeSearch)); |
+ EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kForceSafeSearch)); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(ManagedUserServiceTestManaged, ProfileName) { |
+ Profile* profile = browser()->profile(); |
+ PrefService* prefs = profile->GetPrefs(); |
+ std::string original_name = prefs->GetString(prefs::kProfileName); |
+ ProfileManager* profile_manager = g_browser_process->profile_manager(); |
+ const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
- // Change the profile to a managed user. |
- ManagedUserService* managed_user_service = |
- ManagedUserServiceFactory::GetForProfile(profile); |
- managed_user_service->InitForTesting(); |
ManagedUserSettingsService* settings = |
ManagedUserSettingsServiceFactory::GetForProfile(profile); |
@@ -59,7 +73,7 @@ IN_PROC_BROWSER_TEST_F(ManagedUserServiceTest, ProfileName) { |
scoped_ptr<base::Value>(new base::StringValue(name))); |
EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kProfileName)); |
EXPECT_EQ(name, prefs->GetString(prefs::kProfileName)); |
- profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
+ size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
EXPECT_EQ(name, UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); |
// Change the name once more. |