| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 14 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 17 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 17 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 18 #include "chrome/browser/prefs/browser_prefs.h" | 18 #include "chrome/browser/prefs/browser_prefs.h" |
| 19 #include "chrome/browser/prefs/pref_service_syncable.h" | 19 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/test/base/testing_browser_process.h" | 24 #include "chrome/test/base/testing_browser_process.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 content::Source<Profile>(login_profile), | 227 content::Source<Profile>(login_profile), |
| 228 content::NotificationService::NoDetails()); | 228 content::NotificationService::NoDetails()); |
| 229 | 229 |
| 230 // The login profile's prefs should still be used. | 230 // The login profile's prefs should still be used. |
| 231 EXPECT_FALSE(GetProfile()); | 231 EXPECT_FALSE(GetProfile()); |
| 232 EXPECT_EQ(GetExpectedPowerPolicyForProfile(login_profile, UNLOCKED), | 232 EXPECT_EQ(GetExpectedPowerPolicyForProfile(login_profile, UNLOCKED), |
| 233 GetCurrentPowerPolicy()); | 233 GetCurrentPowerPolicy()); |
| 234 } | 234 } |
| 235 | 235 |
| 236 TEST_F(PowerPrefsTest, UserSession) { | 236 TEST_F(PowerPrefsTest, UserSession) { |
| 237 FakeUserManager* user_manager = new FakeUserManager(); | 237 FakeChromeUserManager* user_manager = new FakeChromeUserManager(); |
| 238 ScopedUserManagerEnabler user_manager_enabler(user_manager); | 238 ScopedUserManagerEnabler user_manager_enabler(user_manager); |
| 239 | 239 |
| 240 // Set up user profile. | 240 // Set up user profile. |
| 241 const char test_user1[] = "test-user1@example.com"; | 241 const char test_user1[] = "test-user1@example.com"; |
| 242 user_manager->AddUser(test_user1); | 242 user_manager->AddUser(test_user1); |
| 243 user_manager->LoginUser(test_user1); | 243 user_manager->LoginUser(test_user1); |
| 244 TestingProfile* user_profile = | 244 TestingProfile* user_profile = |
| 245 profile_manager_.CreateTestingProfile(test_user1); | 245 profile_manager_.CreateTestingProfile(test_user1); |
| 246 | 246 |
| 247 profile_manager_.SetLoggedIn(true); | 247 profile_manager_.SetLoggedIn(true); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 content::Source<Profile>(user_profile), | 293 content::Source<Profile>(user_profile), |
| 294 content::NotificationService::NoDetails()); | 294 content::NotificationService::NoDetails()); |
| 295 | 295 |
| 296 // The user profile's prefs should still be used. | 296 // The user profile's prefs should still be used. |
| 297 EXPECT_FALSE(GetProfile()); | 297 EXPECT_FALSE(GetProfile()); |
| 298 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile, UNLOCKED), | 298 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile, UNLOCKED), |
| 299 GetCurrentPowerPolicy()); | 299 GetCurrentPowerPolicy()); |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace chromeos | 302 } // namespace chromeos |
| OLD | NEW |