| 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/test/test_session_controller_client.h" | 5 #include "ash/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/login_status.h" | 10 #include "ash/login_status.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 for (int numbered_user_index = 0; numbered_user_index < count; | 89 for (int numbered_user_index = 0; numbered_user_index < count; |
| 90 ++numbered_user_index) { | 90 ++numbered_user_index) { |
| 91 AddUserSession(base::StringPrintf("user%d@tray", numbered_user_index)); | 91 AddUserSession(base::StringPrintf("user%d@tray", numbered_user_index)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Updates session state after adding user sessions. | 94 // Updates session state after adding user sessions. |
| 95 SetSessionState(session_manager::SessionState::ACTIVE); | 95 SetSessionState(session_manager::SessionState::ACTIVE); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void TestSessionControllerClient::AddUserSession( | 98 void TestSessionControllerClient::AddUserSession( |
| 99 const std::string& display_email) { | 99 const std::string& display_email, |
| 100 bool enable_settings) { |
| 100 mojom::UserSessionPtr session = mojom::UserSession::New(); | 101 mojom::UserSessionPtr session = mojom::UserSession::New(); |
| 101 session->session_id = ++fake_session_id_; | 102 session->session_id = ++fake_session_id_; |
| 102 session->type = user_manager::USER_TYPE_REGULAR; | 103 session->type = user_manager::USER_TYPE_REGULAR; |
| 103 session->account_id = | 104 session->account_id = |
| 104 AccountId::FromUserEmail(GetUserIdFromEmail(display_email)); | 105 AccountId::FromUserEmail(GetUserIdFromEmail(display_email)); |
| 105 session->display_name = "Über tray Über tray Über tray Über tray"; | 106 session->display_name = "Über tray Über tray Über tray Über tray"; |
| 106 session->display_email = display_email; | 107 session->display_email = display_email; |
| 107 session->should_enable_settings = true; | 108 session->should_enable_settings = enable_settings; |
| 108 session->should_show_notification_tray = true; | 109 session->should_show_notification_tray = true; |
| 109 controller_->UpdateUserSession(std::move(session)); | 110 controller_->UpdateUserSession(std::move(session)); |
| 110 } | 111 } |
| 111 | 112 |
| 112 void TestSessionControllerClient::UnlockScreen() { | 113 void TestSessionControllerClient::UnlockScreen() { |
| 113 SetSessionState(session_manager::SessionState::ACTIVE); | 114 SetSessionState(session_manager::SessionState::ACTIVE); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void TestSessionControllerClient::RequestLockScreen() { | 117 void TestSessionControllerClient::RequestLockScreen() { |
| 117 SetSessionState(session_manager::SessionState::LOCKED); | 118 SetSessionState(session_manager::SessionState::LOCKED); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (it == sessions.end()) { | 170 if (it == sessions.end()) { |
| 170 NOTREACHED(); | 171 NOTREACHED(); |
| 171 return; | 172 return; |
| 172 } | 173 } |
| 173 | 174 |
| 174 SwitchActiveUser((*it)->account_id); | 175 SwitchActiveUser((*it)->account_id); |
| 175 } | 176 } |
| 176 | 177 |
| 177 } // namespace test | 178 } // namespace test |
| 178 } // namespace ash | 179 } // namespace ash |
| OLD | NEW |