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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service_browsertest.cc

Issue 924033002: Supervised Users: Replace kForceSafeSearch pref with kForceGoogleSearch and kForceYouTubeSafetyMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fix Created 5 years, 10 months 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 unified diff | Download patch
OLDNEW
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
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_TRUE(prefs->IsUserModifiablePreference(prefs::kForceGoogleSafeSearch));
Marc Treib 2015/02/23 09:08:39 And if you feel like it, here (and below) also.
86 } 86 }
87 87
88 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTest, ProfileName) { 88 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTest, ProfileName) {
89 Profile* profile = browser()->profile(); 89 Profile* profile = browser()->profile();
90 PrefService* prefs = profile->GetPrefs(); 90 PrefService* prefs = profile->GetPrefs();
91 EXPECT_TRUE(prefs->IsUserModifiablePreference(prefs::kProfileName)); 91 EXPECT_TRUE(prefs->IsUserModifiablePreference(prefs::kProfileName));
92 92
93 std::string original_name = prefs->GetString(prefs::kProfileName); 93 std::string original_name = prefs->GetString(prefs::kProfileName);
94 ProfileManager* profile_manager = g_browser_process->profile_manager(); 94 ProfileManager* profile_manager = g_browser_process->profile_manager();
95 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 95 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
96 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 96 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
97 EXPECT_EQ(original_name, 97 EXPECT_EQ(original_name,
98 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); 98 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index)));
99 } 99 }
100 100
101 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, LocalPolicies) { 101 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, LocalPolicies) {
102 Profile* profile = browser()->profile(); 102 Profile* profile = browser()->profile();
103 PrefService* prefs = profile->GetPrefs(); 103 PrefService* prefs = profile->GetPrefs();
104 EXPECT_TRUE(prefs->GetBoolean(prefs::kForceSafeSearch)); 104 EXPECT_TRUE(prefs->GetBoolean(prefs::kForceGoogleSafeSearch));
105 EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kForceSafeSearch)); 105 EXPECT_FALSE(
106 prefs->IsUserModifiablePreference(prefs::kForceGoogleSafeSearch));
106 } 107 }
107 108
108 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, ProfileName) { 109 IN_PROC_BROWSER_TEST_F(SupervisedUserServiceTestSupervised, ProfileName) {
109 Profile* profile = browser()->profile(); 110 Profile* profile = browser()->profile();
110 PrefService* prefs = profile->GetPrefs(); 111 PrefService* prefs = profile->GetPrefs();
111 std::string original_name = prefs->GetString(prefs::kProfileName); 112 std::string original_name = prefs->GetString(prefs::kProfileName);
112 ProfileManager* profile_manager = g_browser_process->profile_manager(); 113 ProfileManager* profile_manager = g_browser_process->profile_manager();
113 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 114 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
114 115
115 SupervisedUserSettingsService* settings = 116 SupervisedUserSettingsService* settings =
(...skipping 20 matching lines...) Expand all
136 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); 137 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index)));
137 138
138 // Remove the setting. 139 // Remove the setting.
139 settings->SetLocalSetting(supervised_users::kUserName, 140 settings->SetLocalSetting(supervised_users::kUserName,
140 scoped_ptr<base::Value>()); 141 scoped_ptr<base::Value>());
141 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName)); 142 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName));
142 profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 143 profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
143 EXPECT_EQ(original_name, 144 EXPECT_EQ(original_name,
144 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index))); 145 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_index)));
145 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698