OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/power/power_prefs.h" | 5 #include "chrome/browser/chromeos/power/power_prefs.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 TEST_F(PowerPrefsTest, LoginScreen) { | 161 TEST_F(PowerPrefsTest, LoginScreen) { |
162 // Set up login profile. | 162 // Set up login profile. |
163 scoped_ptr<TestingPrefServiceSyncable> login_profile_prefs( | 163 scoped_ptr<TestingPrefServiceSyncable> login_profile_prefs( |
164 new TestingPrefServiceSyncable); | 164 new TestingPrefServiceSyncable); |
165 chrome::RegisterLoginProfilePrefs(login_profile_prefs->registry()); | 165 chrome::RegisterLoginProfilePrefs(login_profile_prefs->registry()); |
166 TestingProfile::Builder builder; | 166 TestingProfile::Builder builder; |
167 builder.SetPath( | 167 builder.SetPath( |
168 profile_manager_.profiles_dir().AppendASCII(chrome::kInitialProfile)); | 168 profile_manager_.profiles_dir().AppendASCII(chrome::kInitialProfile)); |
169 builder.SetPrefService(login_profile_prefs.PassAs<PrefServiceSyncable>()); | 169 builder.SetPrefService(login_profile_prefs.PassAs<PrefServiceSyncable>()); |
170 builder.SetIncognito(); | 170 TestingProfile* login_profile = builder.BuildIncognito( |
171 scoped_ptr<TestingProfile> login_profile_owner(builder.Build()); | 171 profile_manager_.CreateTestingProfile(chrome::kInitialProfile)); |
172 | |
173 TestingProfile* login_profile = login_profile_owner.get(); | |
174 TestingProfile* login_profile_parent = profile_manager_.CreateTestingProfile( | |
175 chrome::kInitialProfile); | |
176 login_profile_parent->SetOffTheRecordProfile( | |
177 login_profile_owner.PassAs<Profile>()); | |
178 login_profile->SetOriginalProfile(login_profile_parent); | |
179 | 172 |
180 // Inform power_prefs_ that the login screen is being shown. | 173 // Inform power_prefs_ that the login screen is being shown. |
181 power_prefs_->Observe(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 174 power_prefs_->Observe(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
182 content::Source<PowerPrefsTest>(this), | 175 content::Source<PowerPrefsTest>(this), |
183 content::NotificationService::NoDetails()); | 176 content::NotificationService::NoDetails()); |
184 | 177 |
185 EXPECT_EQ(login_profile, GetProfile()); | 178 EXPECT_EQ(login_profile, GetProfile()); |
186 EXPECT_EQ(GetExpectedPowerPolicyForProfile(login_profile), | 179 EXPECT_EQ(GetExpectedPowerPolicyForProfile(login_profile), |
187 GetCurrentPowerPolicy()); | 180 GetCurrentPowerPolicy()); |
188 EXPECT_EQ(GetExpectedAllowScreenWakeLocksForProfile(login_profile), | 181 EXPECT_EQ(GetExpectedAllowScreenWakeLocksForProfile(login_profile), |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 content::Source<Profile>(user_profile), | 267 content::Source<Profile>(user_profile), |
275 content::NotificationService::NoDetails()); | 268 content::NotificationService::NoDetails()); |
276 | 269 |
277 // The user profile's prefs should still be used. | 270 // The user profile's prefs should still be used. |
278 EXPECT_FALSE(GetProfile()); | 271 EXPECT_FALSE(GetProfile()); |
279 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile), | 272 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile), |
280 GetCurrentPowerPolicy()); | 273 GetCurrentPowerPolicy()); |
281 } | 274 } |
282 | 275 |
283 } // namespace chromeos | 276 } // namespace chromeos |
OLD | NEW |