OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 base::Bind(&TestAuthErrorCallback), | 74 base::Bind(&TestAuthErrorCallback), |
75 profile, | 75 profile, |
76 GoogleServiceAuthError(GoogleServiceAuthError::NONE), | 76 GoogleServiceAuthError(GoogleServiceAuthError::NONE), |
77 std::string("abcdef")); | 77 std::string("abcdef")); |
78 EXPECT_FALSE(cache.IsOmittedProfileAtIndex(index)); | 78 EXPECT_FALSE(cache.IsOmittedProfileAtIndex(index)); |
79 } | 79 } |
80 | 80 |
81 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTest, LocalPolicies) { | 81 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTest, LocalPolicies) { |
82 Profile* profile = browser()->profile(); | 82 Profile* profile = browser()->profile(); |
83 PrefService* prefs = profile->GetPrefs(); | 83 PrefService* prefs = profile->GetPrefs(); |
84 EXPECT_FALSE(prefs->GetBoolean(prefs::kForceSafeSearch)); | 84 EXPECT_FALSE(prefs->GetBoolean(prefs::kForceGoogleSafeSearch)); |
85 EXPECT_TRUE(prefs->IsUserModifiablePreference(prefs::kForceSafeSearch)); | 85 EXPECT_FALSE(prefs->GetBoolean(prefs::kForceYouTubeSafetyMode)); |
| 86 EXPECT_TRUE(prefs->IsUserModifiablePreference(prefs::kForceGoogleSafeSearch)); |
| 87 EXPECT_TRUE( |
| 88 prefs->IsUserModifiablePreference(prefs::kForceYouTubeSafetyMode)); |
86 } | 89 } |
87 | 90 |
88 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTest, ProfileName) { | 91 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTest, ProfileName) { |
89 Profile* profile = browser()->profile(); | 92 Profile* profile = browser()->profile(); |
90 PrefService* prefs = profile->GetPrefs(); | 93 PrefService* prefs = profile->GetPrefs(); |
91 EXPECT_TRUE(prefs->IsUserModifiablePreference(prefs::kProfileName)); | 94 EXPECT_TRUE(prefs->IsUserModifiablePreference(prefs::kProfileName)); |
92 | 95 |
93 std::string original_name = prefs->GetString(prefs::kProfileName); | 96 std::string original_name = prefs->GetString(prefs::kProfileName); |
94 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 97 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
95 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 98 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
96 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 99 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
97 EXPECT_EQ(original_name, | 100 EXPECT_EQ(original_name, |
98 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); | 101 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); |
99 } | 102 } |
100 | 103 |
101 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, LocalPolicies) { | 104 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, LocalPolicies) { |
102 Profile* profile = browser()->profile(); | 105 Profile* profile = browser()->profile(); |
103 PrefService* prefs = profile->GetPrefs(); | 106 PrefService* prefs = profile->GetPrefs(); |
104 EXPECT_TRUE(prefs->GetBoolean(prefs::kForceSafeSearch)); | 107 EXPECT_TRUE(prefs->GetBoolean(prefs::kForceGoogleSafeSearch)); |
105 EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kForceSafeSearch)); | 108 EXPECT_TRUE(prefs->GetBoolean(prefs::kForceYouTubeSafetyMode)); |
| 109 EXPECT_FALSE( |
| 110 prefs->IsUserModifiablePreference(prefs::kForceGoogleSafeSearch)); |
| 111 EXPECT_FALSE( |
| 112 prefs->IsUserModifiablePreference(prefs::kForceYouTubeSafetyMode)); |
106 } | 113 } |
107 | 114 |
108 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, ProfileName) { | 115 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, ProfileName) { |
109 Profile* profile = browser()->profile(); | 116 Profile* profile = browser()->profile(); |
110 PrefService* prefs = profile->GetPrefs(); | 117 PrefService* prefs = profile->GetPrefs(); |
111 std::string original_name = prefs->GetString(prefs::kProfileName); | 118 std::string original_name = prefs->GetString(prefs::kProfileName); |
112 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 119 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
113 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 120 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
114 | 121 |
115 SupervisedUserSettingsService* settings = | 122 SupervisedUserSettingsService* settings = |
(...skipping 20 matching lines...) Expand all Loading... |
136 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); | 143 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); |
137 | 144 |
138 // Remove the setting. | 145 // Remove the setting. |
139 settings->SetLocalSetting(supervised_users::kUserName, | 146 settings->SetLocalSetting(supervised_users::kUserName, |
140 scoped_ptr<base::Value>()); | 147 scoped_ptr<base::Value>()); |
141 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName)); | 148 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName)); |
142 profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 149 profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
143 EXPECT_EQ(original_name, | 150 EXPECT_EQ(original_name, |
144 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); | 151 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); |
145 } | 152 } |
OLD | NEW |