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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/login/user.h" | 10 #include "chrome/browser/chromeos/login/user.h" |
11 #include "chrome/browser/chromeos/login/user_flow.h" | 11 #include "chrome/browser/chromeos/login/user_flow.h" |
12 #include "chrome/browser/chromeos/login/user_image.h" | 12 #include "chrome/browser/chromeos/login/user_image.h" |
13 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 // Fake user manager with a barebones implementation. Users can be added | 17 // Fake user manager with a barebones implementation. Users can be added |
18 // and set as logged in, and those users can be returned. | 18 // and set as logged in, and those users can be returned. |
19 class FakeUserManager : public UserManager { | 19 class FakeUserManager : public UserManager { |
20 public: | 20 public: |
21 FakeUserManager(); | 21 FakeUserManager(); |
22 virtual ~FakeUserManager(); | 22 virtual ~FakeUserManager(); |
23 | 23 |
24 // Create and add a new user. | 24 // Create and add a new user. |
25 void AddUser(const std::string& email); | 25 void AddUser(const std::string& email); |
26 | 26 |
27 // Create and add a kiosk app user. | |
28 void AddKioskAppUser(const std::string& kiosk_app_username); | |
29 | |
30 // Helper helper function to UserLoggedIn override. | |
31 void UserLoggedIn(const std::string& email); | |
xiyuan
2013/09/24 20:20:40
I have added a LoginUser method that does exactly
Tim Song
2013/09/24 21:07:26
Done.
| |
32 | |
27 // UserManager overrides. | 33 // UserManager overrides. |
28 virtual const UserList& GetUsers() const OVERRIDE; | 34 virtual const UserList& GetUsers() const OVERRIDE; |
29 virtual UserList GetUsersAdmittedForMultiProfile() const OVERRIDE; | 35 virtual UserList GetUsersAdmittedForMultiProfile() const OVERRIDE; |
30 virtual const UserList& GetLoggedInUsers() const OVERRIDE; | 36 virtual const UserList& GetLoggedInUsers() const OVERRIDE; |
31 | 37 |
32 // Set the user as logged in. | 38 // Set the user as logged in. |
33 virtual void UserLoggedIn(const std::string& email, | 39 virtual void UserLoggedIn(const std::string& email, |
34 const std::string& username_hash, | 40 const std::string& username_hash, |
35 bool browser_restart) OVERRIDE; | 41 bool browser_restart) OVERRIDE; |
36 | 42 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 virtual void AddSessionStateObserver( | 124 virtual void AddSessionStateObserver( |
119 UserSessionStateObserver* obs) OVERRIDE {} | 125 UserSessionStateObserver* obs) OVERRIDE {} |
120 virtual void RemoveSessionStateObserver( | 126 virtual void RemoveSessionStateObserver( |
121 UserSessionStateObserver* obs) OVERRIDE {} | 127 UserSessionStateObserver* obs) OVERRIDE {} |
122 virtual void NotifyLocalStateChanged() OVERRIDE {} | 128 virtual void NotifyLocalStateChanged() OVERRIDE {} |
123 virtual bool AreLocallyManagedUsersAllowed() const OVERRIDE; | 129 virtual bool AreLocallyManagedUsersAllowed() const OVERRIDE; |
124 virtual base::FilePath GetUserProfileDir(const std::string& email) const | 130 virtual base::FilePath GetUserProfileDir(const std::string& email) const |
125 OVERRIDE; | 131 OVERRIDE; |
126 | 132 |
127 private: | 133 private: |
134 // We use this internal function for const-correctness. | |
135 User* GetActiveUserInternal() const; | |
136 | |
128 UserList user_list_; | 137 UserList user_list_; |
129 UserList logged_in_users_; | 138 UserList logged_in_users_; |
130 std::string owner_email_; | 139 std::string owner_email_; |
131 | 140 |
132 DISALLOW_COPY_AND_ASSIGN(FakeUserManager); | 141 DISALLOW_COPY_AND_ASSIGN(FakeUserManager); |
133 }; | 142 }; |
134 | 143 |
135 } // namespace chromeos | 144 } // namespace chromeos |
136 | 145 |
137 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ | 146 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_USER_MANAGER_H_ |
OLD | NEW |