| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ash/common/test/test_session_controller_client.h" | 5 #include "ash/common/test/test_session_controller_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/common/login_status.h" | 10 #include "ash/common/login_status.h" |
| 11 #include "ash/common/session/session_controller.h" | 11 #include "ash/common/session/session_controller.h" |
| 12 #include "ash/common/wm_shell.h" | 12 #include "ash/shell.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "components/session_manager/session_manager_types.h" | 15 #include "components/session_manager/session_manager_types.h" |
| 16 #include "components/signin/core/account_id/account_id.h" | 16 #include "components/signin/core/account_id/account_id.h" |
| 17 #include "components/user_manager/user_type.h" | 17 #include "components/user_manager/user_type.h" |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 namespace test { | 20 namespace test { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 session_info_->should_lock_screen_automatically = should_lock; | 72 session_info_->should_lock_screen_automatically = should_lock; |
| 73 controller_->SetSessionInfo(session_info_->Clone()); | 73 controller_->SetSessionInfo(session_info_->Clone()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void TestSessionControllerClient::SetSessionState( | 76 void TestSessionControllerClient::SetSessionState( |
| 77 session_manager::SessionState state) { | 77 session_manager::SessionState state) { |
| 78 session_info_->state = state; | 78 session_info_->state = state; |
| 79 controller_->SetSessionInfo(session_info_->Clone()); | 79 controller_->SetSessionInfo(session_info_->Clone()); |
| 80 | 80 |
| 81 // TODO(xiyuan): Remove after LoginStatus becomes part of SessionController. | 81 // TODO(xiyuan): Remove after LoginStatus becomes part of SessionController. |
| 82 WmShell::Get()->UpdateAfterLoginStatusChange( | 82 Shell::Get()->UpdateAfterLoginStatusChange( |
| 83 state == session_manager::SessionState::ACTIVE | 83 state == session_manager::SessionState::ACTIVE |
| 84 ? LoginStatus::USER | 84 ? LoginStatus::USER |
| 85 : LoginStatus::NOT_LOGGED_IN); | 85 : LoginStatus::NOT_LOGGED_IN); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void TestSessionControllerClient::CreatePredefinedUserSessions(int count) { | 88 void TestSessionControllerClient::CreatePredefinedUserSessions(int count) { |
| 89 DCHECK_GT(count, 0); | 89 DCHECK_GT(count, 0); |
| 90 | 90 |
| 91 // Resets the controller's state. | 91 // Resets the controller's state. |
| 92 Reset(); | 92 Reset(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (it == sessions.end()) { | 173 if (it == sessions.end()) { |
| 174 NOTREACHED(); | 174 NOTREACHED(); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 | 177 |
| 178 SwitchActiveUser((*it)->account_id); | 178 SwitchActiveUser((*it)->account_id); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace test | 181 } // namespace test |
| 182 } // namespace ash | 182 } // namespace ash |
| OLD | NEW |