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 "chrome/browser/ui/ash/session_state_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // We must ensure that the PolicyCertVerifier outlives the | 74 // We must ensure that the PolicyCertVerifier outlives the |
75 // PolicyCertService so shutdown the profile here. Additionally, we need | 75 // PolicyCertService so shutdown the profile here. Additionally, we need |
76 // to run the message loop between freeing the PolicyCertService and | 76 // to run the message loop between freeing the PolicyCertService and |
77 // freeing the PolicyCertVerifier (see | 77 // freeing the PolicyCertVerifier (see |
78 // PolicyCertService::OnTrustAnchorsChanged() which is called from | 78 // PolicyCertService::OnTrustAnchorsChanged() which is called from |
79 // PolicyCertService::Shutdown()). | 79 // PolicyCertService::Shutdown()). |
80 base::RunLoop().RunUntilIdle(); | 80 base::RunLoop().RunUntilIdle(); |
81 } | 81 } |
82 | 82 |
83 // Add and log in a user to the session. | 83 // Add and log in a user to the session. |
84 void UserAddedToSession(std::string user) { | 84 void UserAddedToSession(const std::string& user) { |
85 user_manager()->AddUser(user); | 85 user_manager()->AddUser(user); |
86 user_manager()->LoginUser(user); | 86 user_manager()->LoginUser(user); |
87 } | 87 } |
88 | 88 |
89 // Get the active user. | 89 // Get the active user. |
90 const std::string& GetActiveUser() { | 90 const std::string& GetActiveUser() { |
91 return user_manager::UserManager::Get()->GetActiveUser()->email(); | 91 return user_manager::UserManager::Get()->GetActiveUser()->email(); |
92 } | 92 } |
93 | 93 |
94 FakeChromeUserManager* user_manager() { return user_manager_; } | 94 FakeChromeUserManager* user_manager() { return user_manager_; } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 prefs::kMultiProfileUserBehavior, | 283 prefs::kMultiProfileUserBehavior, |
284 chromeos::MultiProfileUserController::kBehaviorNotAllowed); | 284 chromeos::MultiProfileUserController::kBehaviorNotAllowed); |
285 user_manager()->AddUser("bb@b.b"); | 285 user_manager()->AddUser("bb@b.b"); |
286 EXPECT_FALSE( | 286 EXPECT_FALSE( |
287 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error)); | 287 session_state_delegate()->CanAddUserToMultiProfile(&add_user_error)); |
288 EXPECT_EQ(ash::SessionStateDelegate::ADD_USER_ERROR_NOT_ALLOWED_PRIMARY_USER, | 288 EXPECT_EQ(ash::SessionStateDelegate::ADD_USER_ERROR_NOT_ALLOWED_PRIMARY_USER, |
289 add_user_error); | 289 add_user_error); |
290 } | 290 } |
291 | 291 |
292 } // namespace chromeos | 292 } // namespace chromeos |
OLD | NEW |