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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 DCHECK(UserSessionManager::GetInstance()->UserSessionsRestored()); | 150 DCHECK(UserSessionManager::GetInstance()->UserSessionsRestored()); |
151 | 151 |
152 // User that is last in the user sessions map becomes active. This behavior | 152 // User that is last in the user sessions map becomes active. This behavior |
153 // will become better defined once each user gets a separate user desktop. | 153 // will become better defined once each user gets a separate user desktop. |
154 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 154 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
155 user_manager::User* user = user_manager->GetActiveUser(); | 155 user_manager::User* user = user_manager->GetActiveUser(); |
156 ASSERT_TRUE(user); | 156 ASSERT_TRUE(user); |
157 EXPECT_EQ(account_id3_, user->GetAccountId()); | 157 EXPECT_EQ(account_id3_, user->GetAccountId()); |
158 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id3_), | 158 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id3_), |
159 user->username_hash()); | 159 user->username_hash()); |
160 const user_manager::UserList& users = user_manager->GetLoggedInUsers(); | 160 const user_manager::UserList& users = user_manager->GetLRULoggedInUsers(); |
161 ASSERT_EQ(3UL, users.size()); | 161 ASSERT_EQ(3UL, users.size()); |
162 | 162 |
163 // User that becomes active moves to the beginning of the list. | 163 // User that becomes active moves to the beginning of the list. |
164 EXPECT_EQ(account_id3_, users[0]->GetAccountId()); | 164 EXPECT_EQ(account_id3_, users[0]->GetAccountId()); |
165 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id3_), | 165 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id3_), |
166 users[0]->username_hash()); | 166 users[0]->username_hash()); |
167 EXPECT_EQ(account_id2_, users[1]->GetAccountId()); | 167 EXPECT_EQ(account_id2_, users[1]->GetAccountId()); |
168 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id2_), | 168 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id2_), |
169 users[1]->username_hash()); | 169 users[1]->username_hash()); |
170 EXPECT_EQ(account_id1_, users[2]->GetAccountId()); | 170 EXPECT_EQ(account_id1_, users[2]->GetAccountId()); |
171 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id1_), | 171 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(cryptohome_id1_), |
172 users[2]->username_hash()); | 172 users[2]->username_hash()); |
173 | 173 |
174 auto* session_manager = session_manager::SessionManager::Get(); | 174 auto* session_manager = session_manager::SessionManager::Get(); |
175 EXPECT_EQ(session_manager::SessionState::ACTIVE, | 175 EXPECT_EQ(session_manager::SessionState::ACTIVE, |
176 session_manager->session_state()); | 176 session_manager->session_state()); |
177 EXPECT_EQ(3u, session_manager->sessions().size()); | 177 EXPECT_EQ(3u, session_manager->sessions().size()); |
178 EXPECT_EQ(session_manager->sessions()[0].user_account_id, account_id1_); | 178 EXPECT_EQ(session_manager->sessions()[0].user_account_id, account_id1_); |
179 EXPECT_EQ(session_manager->sessions()[1].user_account_id, account_id2_); | 179 EXPECT_EQ(session_manager->sessions()[1].user_account_id, account_id2_); |
180 EXPECT_EQ(session_manager->sessions()[2].user_account_id, account_id3_); | 180 EXPECT_EQ(session_manager->sessions()[2].user_account_id, account_id3_); |
181 } | 181 } |
182 | 182 |
183 } // namespace chromeos | 183 } // namespace chromeos |
OLD | NEW |