| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" | 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { | 89 TEST_F(SigninPrepareUserListTest, AlwaysKeepOwnerInList) { |
| 90 EXPECT_LT(kMaxUsers, fake_user_manager_->GetUsers().size()); | 90 EXPECT_LT(kMaxUsers, fake_user_manager_->GetUsers().size()); |
| 91 user_manager::UserList users_to_send = | 91 user_manager::UserList users_to_send = |
| 92 UserSelectionScreen::PrepareUserListForSending( | 92 UserSelectionScreen::PrepareUserListForSending( |
| 93 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), | 93 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), |
| 94 true /* is signin to add */); | 94 true /* is signin to add */); |
| 95 | 95 |
| 96 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 96 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
| 97 EXPECT_EQ(kOwner, users_to_send.back()->email()); | 97 EXPECT_EQ(kOwner, users_to_send.back()->GetAccountId().GetUserEmail()); |
| 98 | 98 |
| 99 fake_user_manager_->RemoveUserFromList( | 99 fake_user_manager_->RemoveUserFromList( |
| 100 AccountId::FromUserEmail("a16@gmail.com")); | 100 AccountId::FromUserEmail("a16@gmail.com")); |
| 101 fake_user_manager_->RemoveUserFromList( | 101 fake_user_manager_->RemoveUserFromList( |
| 102 AccountId::FromUserEmail("a17@gmail.com")); | 102 AccountId::FromUserEmail("a17@gmail.com")); |
| 103 users_to_send = UserSelectionScreen::PrepareUserListForSending( | 103 users_to_send = UserSelectionScreen::PrepareUserListForSending( |
| 104 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), | 104 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), |
| 105 true /* is signin to add */); | 105 true /* is signin to add */); |
| 106 | 106 |
| 107 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 107 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
| 108 EXPECT_EQ("a18@gmail.com", users_to_send.back()->email()); | 108 EXPECT_EQ("a18@gmail.com", |
| 109 EXPECT_EQ(kOwner, users_to_send[kMaxUsers-2]->email()); | 109 users_to_send.back()->GetAccountId().GetUserEmail()); |
| 110 EXPECT_EQ(kOwner, |
| 111 users_to_send[kMaxUsers - 2]->GetAccountId().GetUserEmail()); |
| 110 } | 112 } |
| 111 | 113 |
| 112 TEST_F(SigninPrepareUserListTest, PublicAccounts) { | 114 TEST_F(SigninPrepareUserListTest, PublicAccounts) { |
| 113 user_manager::UserList users_to_send = | 115 user_manager::UserList users_to_send = |
| 114 UserSelectionScreen::PrepareUserListForSending( | 116 UserSelectionScreen::PrepareUserListForSending( |
| 115 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), | 117 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), |
| 116 true /* is signin to add */); | 118 true /* is signin to add */); |
| 117 | 119 |
| 118 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 120 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
| 119 EXPECT_EQ("a0@gmail.com", users_to_send.front()->email()); | 121 EXPECT_EQ("a0@gmail.com", |
| 122 users_to_send.front()->GetAccountId().GetUserEmail()); |
| 120 | 123 |
| 121 users_to_send = UserSelectionScreen::PrepareUserListForSending( | 124 users_to_send = UserSelectionScreen::PrepareUserListForSending( |
| 122 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), | 125 fake_user_manager_->GetUsers(), AccountId::FromUserEmail(kOwner), |
| 123 false /* is signin to add */); | 126 false /* is signin to add */); |
| 124 | 127 |
| 125 EXPECT_EQ(kMaxUsers, users_to_send.size()); | 128 EXPECT_EQ(kMaxUsers, users_to_send.size()); |
| 126 EXPECT_EQ("public0@gmail.com", users_to_send.front()->email()); | 129 EXPECT_EQ("public0@gmail.com", |
| 130 users_to_send.front()->GetAccountId().GetUserEmail()); |
| 127 } | 131 } |
| 128 | 132 |
| 129 } // namespace chromeos | 133 } // namespace chromeos |
| OLD | NEW |