| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 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.Pass()); |
| 170 TestingProfile* login_profile = builder.BuildIncognito( | 170 TestingProfile* login_profile = builder.BuildIncognito( |
| 171 profile_manager_.CreateTestingProfile(chrome::kInitialProfile)); | 171 profile_manager_.CreateTestingProfile(chrome::kInitialProfile)); |
| 172 | 172 |
| 173 // Inform power_prefs_ that the login screen is being shown. | 173 // Inform power_prefs_ that the login screen is being shown. |
| 174 power_prefs_->Observe(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 174 power_prefs_->Observe(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| 175 content::Source<PowerPrefsTest>(this), | 175 content::Source<PowerPrefsTest>(this), |
| 176 content::NotificationService::NoDetails()); | 176 content::NotificationService::NoDetails()); |
| 177 | 177 |
| 178 EXPECT_EQ(login_profile, GetProfile()); | 178 EXPECT_EQ(login_profile, GetProfile()); |
| 179 EXPECT_EQ(GetExpectedPowerPolicyForProfile(login_profile), | 179 EXPECT_EQ(GetExpectedPowerPolicyForProfile(login_profile), |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 content::Source<Profile>(user_profile), | 267 content::Source<Profile>(user_profile), |
| 268 content::NotificationService::NoDetails()); | 268 content::NotificationService::NoDetails()); |
| 269 | 269 |
| 270 // The user profile's prefs should still be used. | 270 // The user profile's prefs should still be used. |
| 271 EXPECT_FALSE(GetProfile()); | 271 EXPECT_FALSE(GetProfile()); |
| 272 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile), | 272 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile), |
| 273 GetCurrentPowerPolicy()); | 273 GetCurrentPowerPolicy()); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace chromeos | 276 } // namespace chromeos |
| OLD | NEW |