| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MOCK_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 // You can't mock this function easily because nobody can create User objects | 74 // You can't mock this function easily because nobody can create User objects |
| 75 // but the UserManagerImpl and us. | 75 // but the UserManagerImpl and us. |
| 76 virtual const User& GetLoggedInUser() const OVERRIDE; | 76 virtual const User& GetLoggedInUser() const OVERRIDE; |
| 77 | 77 |
| 78 // You can't mock this function easily because nobody can create User objects | 78 // You can't mock this function easily because nobody can create User objects |
| 79 // but the UserManagerImpl and us. | 79 // but the UserManagerImpl and us. |
| 80 virtual User& GetLoggedInUser() OVERRIDE; | 80 virtual User& GetLoggedInUser() OVERRIDE; |
| 81 | 81 |
| 82 // Sets a new User instance. | 82 // Sets a new User instance. |
| 83 void SetLoggedInUser(const std::string& email, bool guest); | 83 void SetLoggedInUser(const std::string& email); |
| 84 | 84 |
| 85 User* user_; | 85 User* user_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 // Class that provides easy life-cycle management for mocking the UserManager | 88 // Class that provides easy life-cycle management for mocking the UserManager |
| 89 // for tests. | 89 // for tests. |
| 90 class ScopedMockUserManagerEnabler { | 90 class ScopedMockUserManagerEnabler { |
| 91 public: | 91 public: |
| 92 ScopedMockUserManagerEnabler(); | 92 ScopedMockUserManagerEnabler(); |
| 93 ~ScopedMockUserManagerEnabler(); | 93 ~ScopedMockUserManagerEnabler(); |
| 94 | 94 |
| 95 MockUserManager* user_manager(); | 95 MockUserManager* user_manager(); |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 UserManager* old_user_manager_; | 98 UserManager* old_user_manager_; |
| 99 scoped_ptr<MockUserManager> user_manager_; | 99 scoped_ptr<MockUserManager> user_manager_; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 } // namespace chromeos | 102 } // namespace chromeos |
| 103 | 103 |
| 104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ | 104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ |
| OLD | NEW |