| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 power_manager::PowerManagementPolicy()), | 207 power_manager::PowerManagementPolicy()), |
| 208 GetCurrentPowerPolicy()); | 208 GetCurrentPowerPolicy()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 TEST_F(PowerPrefsTest, UserSession) { | 211 TEST_F(PowerPrefsTest, UserSession) { |
| 212 // Set up user profile. | 212 // Set up user profile. |
| 213 TestingProfile* user_profile = profile_manager_.CreateTestingProfile("user"); | 213 TestingProfile* user_profile = profile_manager_.CreateTestingProfile("user"); |
| 214 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kLoginProfile, | 214 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kLoginProfile, |
| 215 "user"); | 215 "user"); |
| 216 profile_manager_.SetLoggedIn(true); | 216 profile_manager_.SetLoggedIn(true); |
| 217 ProfileManager::AllowGetDefaultProfile(); | |
| 218 | 217 |
| 219 // Inform power_prefs_ that a session has started. | 218 // Inform power_prefs_ that a session has started. |
| 220 power_prefs_->Observe(chrome::NOTIFICATION_SESSION_STARTED, | 219 power_prefs_->Observe(chrome::NOTIFICATION_SESSION_STARTED, |
| 221 content::Source<PowerPrefsTest>(this), | 220 content::Source<PowerPrefsTest>(this), |
| 222 content::NotificationService::NoDetails()); | 221 content::NotificationService::NoDetails()); |
| 223 | 222 |
| 224 EXPECT_EQ(user_profile, GetProfile()); | 223 EXPECT_EQ(user_profile, GetProfile()); |
| 225 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile), | 224 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile), |
| 226 GetCurrentPowerPolicy()); | 225 GetCurrentPowerPolicy()); |
| 227 EXPECT_EQ(GetExpectedAllowScreenWakeLocksForProfile(user_profile), | 226 EXPECT_EQ(GetExpectedAllowScreenWakeLocksForProfile(user_profile), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 content::Source<Profile>(user_profile), | 259 content::Source<Profile>(user_profile), |
| 261 content::NotificationService::NoDetails()); | 260 content::NotificationService::NoDetails()); |
| 262 | 261 |
| 263 EXPECT_FALSE(GetProfile()); | 262 EXPECT_FALSE(GetProfile()); |
| 264 EXPECT_EQ(PowerPolicyController::GetPolicyDebugString( | 263 EXPECT_EQ(PowerPolicyController::GetPolicyDebugString( |
| 265 power_manager::PowerManagementPolicy()), | 264 power_manager::PowerManagementPolicy()), |
| 266 GetCurrentPowerPolicy()); | 265 GetCurrentPowerPolicy()); |
| 267 } | 266 } |
| 268 | 267 |
| 269 } // namespace chromeos | 268 } // namespace chromeos |
| OLD | NEW |