| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 } | 202 } |
| 203 | 203 |
| 204 int auto_login_delay() const { | 204 int auto_login_delay() const { |
| 205 return existing_user_controller()->public_session_auto_login_delay_; | 205 return existing_user_controller()->public_session_auto_login_delay_; |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool is_login_in_progress() const { | 208 bool is_login_in_progress() const { |
| 209 return existing_user_controller()->is_login_in_progress_; | 209 return existing_user_controller()->is_login_in_progress_; |
| 210 } | 210 } |
| 211 | 211 |
| 212 scoped_ptr<ExistingUserController> existing_user_controller_; | 212 std::unique_ptr<ExistingUserController> existing_user_controller_; |
| 213 | 213 |
| 214 // |mock_login_display_| is owned by the ExistingUserController, which calls | 214 // |mock_login_display_| is owned by the ExistingUserController, which calls |
| 215 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. | 215 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. |
| 216 MockLoginDisplay* mock_login_display_ = nullptr; | 216 MockLoginDisplay* mock_login_display_ = nullptr; |
| 217 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; | 217 std::unique_ptr<MockLoginDisplayHost> mock_login_display_host_; |
| 218 | 218 |
| 219 // Mock URLFetcher. | 219 // Mock URLFetcher. |
| 220 MockURLFetcherFactory<SuccessFetcher> factory_; | 220 MockURLFetcherFactory<SuccessFetcher> factory_; |
| 221 | 221 |
| 222 const AccountId account_id_ = | 222 const AccountId account_id_ = |
| 223 AccountId::FromUserEmailGaiaId(kUsername, kGaiaID); | 223 AccountId::FromUserEmailGaiaId(kUsername, kGaiaID); |
| 224 | 224 |
| 225 private: | 225 private: |
| 226 DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerTest); | 226 DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerTest); |
| 227 }; | 227 }; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 void SetAutoLoginPolicy(const std::string& user_email, int delay) { | 435 void SetAutoLoginPolicy(const std::string& user_email, int delay) { |
| 436 // Wait until ExistingUserController has finished auto-login | 436 // Wait until ExistingUserController has finished auto-login |
| 437 // configuration by observing the same settings that trigger | 437 // configuration by observing the same settings that trigger |
| 438 // ConfigurePublicSessionAutoLogin. | 438 // ConfigurePublicSessionAutoLogin. |
| 439 | 439 |
| 440 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); | 440 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); |
| 441 | 441 |
| 442 // If both settings have changed we need to wait for both to | 442 // If both settings have changed we need to wait for both to |
| 443 // propagate, so check the new values against the old ones. | 443 // propagate, so check the new values against the old ones. |
| 444 scoped_refptr<content::MessageLoopRunner> runner1; | 444 scoped_refptr<content::MessageLoopRunner> runner1; |
| 445 scoped_ptr<CrosSettings::ObserverSubscription> subscription1; | 445 std::unique_ptr<CrosSettings::ObserverSubscription> subscription1; |
| 446 if (!proto.has_device_local_accounts() || | 446 if (!proto.has_device_local_accounts() || |
| 447 !proto.device_local_accounts().has_auto_login_id() || | 447 !proto.device_local_accounts().has_auto_login_id() || |
| 448 proto.device_local_accounts().auto_login_id() != user_email) { | 448 proto.device_local_accounts().auto_login_id() != user_email) { |
| 449 runner1 = new content::MessageLoopRunner; | 449 runner1 = new content::MessageLoopRunner; |
| 450 subscription1 = chromeos::CrosSettings::Get()->AddSettingsObserver( | 450 subscription1 = chromeos::CrosSettings::Get()->AddSettingsObserver( |
| 451 chromeos::kAccountsPrefDeviceLocalAccountAutoLoginId, | 451 chromeos::kAccountsPrefDeviceLocalAccountAutoLoginId, |
| 452 runner1->QuitClosure()); | 452 runner1->QuitClosure()); |
| 453 } | 453 } |
| 454 scoped_refptr<content::MessageLoopRunner> runner2; | 454 scoped_refptr<content::MessageLoopRunner> runner2; |
| 455 scoped_ptr<CrosSettings::ObserverSubscription> subscription2; | 455 std::unique_ptr<CrosSettings::ObserverSubscription> subscription2; |
| 456 if (!proto.has_device_local_accounts() || | 456 if (!proto.has_device_local_accounts() || |
| 457 !proto.device_local_accounts().has_auto_login_delay() || | 457 !proto.device_local_accounts().has_auto_login_delay() || |
| 458 proto.device_local_accounts().auto_login_delay() != delay) { | 458 proto.device_local_accounts().auto_login_delay() != delay) { |
| 459 runner2 = new content::MessageLoopRunner; | 459 runner2 = new content::MessageLoopRunner; |
| 460 subscription2 = chromeos::CrosSettings::Get()->AddSettingsObserver( | 460 subscription2 = chromeos::CrosSettings::Get()->AddSettingsObserver( |
| 461 chromeos::kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 461 chromeos::kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
| 462 runner2->QuitClosure()); | 462 runner2->QuitClosure()); |
| 463 } | 463 } |
| 464 | 464 |
| 465 // Update the policy. | 465 // Update the policy. |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 PRE_TestLoadingPublicUsersFromLocalState) { | 732 PRE_TestLoadingPublicUsersFromLocalState) { |
| 733 // First run propagates public accounts and stores them in Local State. | 733 // First run propagates public accounts and stores them in Local State. |
| 734 } | 734 } |
| 735 | 735 |
| 736 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 736 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 737 TestLoadingPublicUsersFromLocalState) { | 737 TestLoadingPublicUsersFromLocalState) { |
| 738 // Second run loads list of public accounts from Local State. | 738 // Second run loads list of public accounts from Local State. |
| 739 } | 739 } |
| 740 | 740 |
| 741 } // namespace chromeos | 741 } // namespace chromeos |
| OLD | NEW |