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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // ExistingUserController private member accessors. | 205 // ExistingUserController private member accessors. |
206 base::OneShotTimer* auto_login_timer() { | 206 base::OneShotTimer* auto_login_timer() { |
207 return existing_user_controller()->auto_login_timer_.get(); | 207 return existing_user_controller()->auto_login_timer_.get(); |
208 } | 208 } |
209 | 209 |
210 AccountId auto_login_account_id() const { | 210 AccountId auto_login_account_id() const { |
211 return existing_user_controller()->public_session_auto_login_account_id_; | 211 return existing_user_controller()->public_session_auto_login_account_id_; |
212 } | 212 } |
213 | 213 |
214 int auto_login_delay() const { | 214 int auto_login_delay() const { |
215 return existing_user_controller()->public_session_auto_login_delay_; | 215 return existing_user_controller()->auto_login_delay_; |
216 } | 216 } |
217 | 217 |
218 bool is_login_in_progress() const { | 218 bool is_login_in_progress() const { |
219 return existing_user_controller()->is_login_in_progress_; | 219 return existing_user_controller()->is_login_in_progress_; |
220 } | 220 } |
221 | 221 |
222 std::unique_ptr<ExistingUserController> existing_user_controller_; | 222 std::unique_ptr<ExistingUserController> existing_user_controller_; |
223 | 223 |
224 // |mock_login_display_| is owned by the ExistingUserController, which calls | 224 // |mock_login_display_| is owned by the ExistingUserController, which calls |
225 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. | 225 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 EXPECT_CALL(*mock_login_display_host_, | 447 EXPECT_CALL(*mock_login_display_host_, |
448 StartWizard(WizardController::kTermsOfServiceScreenName)) | 448 StartWizard(WizardController::kTermsOfServiceScreenName)) |
449 .Times(0); | 449 .Times(0); |
450 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(AnyNumber()); | 450 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(AnyNumber()); |
451 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(AnyNumber()); | 451 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(AnyNumber()); |
452 } | 452 } |
453 | 453 |
454 void SetAutoLoginPolicy(const std::string& user_email, int delay) { | 454 void SetAutoLoginPolicy(const std::string& user_email, int delay) { |
455 // Wait until ExistingUserController has finished auto-login | 455 // Wait until ExistingUserController has finished auto-login |
456 // configuration by observing the same settings that trigger | 456 // configuration by observing the same settings that trigger |
457 // ConfigurePublicSessionAutoLogin. | 457 // ConfigureAutoLogin. |
458 | 458 |
459 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); | 459 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); |
460 | 460 |
461 // If both settings have changed we need to wait for both to | 461 // If both settings have changed we need to wait for both to |
462 // propagate, so check the new values against the old ones. | 462 // propagate, so check the new values against the old ones. |
463 scoped_refptr<content::MessageLoopRunner> runner1; | 463 scoped_refptr<content::MessageLoopRunner> runner1; |
464 std::unique_ptr<CrosSettings::ObserverSubscription> subscription1; | 464 std::unique_ptr<CrosSettings::ObserverSubscription> subscription1; |
465 if (!proto.has_device_local_accounts() || | 465 if (!proto.has_device_local_accounts() || |
466 !proto.device_local_accounts().has_auto_login_id() || | 466 !proto.device_local_accounts().has_auto_login_id() || |
467 proto.device_local_accounts().auto_login_id() != user_email) { | 467 proto.device_local_accounts().auto_login_id() != user_email) { |
(...skipping 19 matching lines...) Expand all Loading... |
487 RefreshDevicePolicy(); | 487 RefreshDevicePolicy(); |
488 | 488 |
489 // Wait for ExistingUserController to read the updated settings. | 489 // Wait for ExistingUserController to read the updated settings. |
490 if (runner1.get()) | 490 if (runner1.get()) |
491 runner1->Run(); | 491 runner1->Run(); |
492 if (runner2.get()) | 492 if (runner2.get()) |
493 runner2->Run(); | 493 runner2->Run(); |
494 } | 494 } |
495 | 495 |
496 void ConfigureAutoLogin() { | 496 void ConfigureAutoLogin() { |
497 existing_user_controller()->ConfigurePublicSessionAutoLogin(); | 497 existing_user_controller()->ConfigureAutoLogin(); |
498 } | 498 } |
499 | 499 |
500 void FireAutoLogin() { | 500 void FireAutoLogin() { |
501 existing_user_controller()->OnPublicSessionAutoLoginTimerFire(); | 501 existing_user_controller()->OnPublicSessionAutoLoginTimerFire(); |
502 } | 502 } |
503 | 503 |
504 void MakeCrosSettingsPermanentlyUntrusted() { | 504 void MakeCrosSettingsPermanentlyUntrusted() { |
505 device_policy()->policy().set_policy_data_signature("bad signature"); | 505 device_policy()->policy().set_policy_data_signature("bad signature"); |
506 session_manager_client()->set_device_policy(device_policy()->GetBlob()); | 506 session_manager_client()->set_device_policy(device_policy()->GetBlob()); |
507 session_manager_client()->OnPropertyChangeComplete(true); | 507 session_manager_client()->OnPropertyChangeComplete(true); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 PRE_TestLoadingPublicUsersFromLocalState) { | 757 PRE_TestLoadingPublicUsersFromLocalState) { |
758 // First run propagates public accounts and stores them in Local State. | 758 // First run propagates public accounts and stores them in Local State. |
759 } | 759 } |
760 | 760 |
761 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 761 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
762 TestLoadingPublicUsersFromLocalState) { | 762 TestLoadingPublicUsersFromLocalState) { |
763 // Second run loads list of public accounts from Local State. | 763 // Second run loads list of public accounts from Local State. |
764 } | 764 } |
765 | 765 |
766 } // namespace chromeos | 766 } // namespace chromeos |
OLD | NEW |