Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Side by Side Diff: chrome/browser/chromeos/login/mock_user_manager.h

Issue 10459003: Load user custom wallpaper after browser crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix aura_shell_unittests Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "chrome/browser/chromeos/login/user_manager.h" 12 #include "chrome/browser/chromeos/login/user_manager.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 class MockUserManager : public UserManager { 17 class MockUserManager : public UserManager {
18 public: 18 public:
19 MockUserManager(); 19 MockUserManager();
20 virtual ~MockUserManager(); 20 virtual ~MockUserManager();
21 21
22 MOCK_CONST_METHOD0(GetUsers, const UserList&(void)); 22 MOCK_CONST_METHOD0(GetUsers, const UserList&(void));
23 MOCK_METHOD1(UserLoggedIn, void(const std::string&)); 23 MOCK_METHOD1(UserLoggedIn, void(const std::string&));
24 MOCK_METHOD0(DemoUserLoggedIn, void(void)); 24 MOCK_METHOD0(DemoUserLoggedIn, void(void));
25 MOCK_METHOD0(GuestUserLoggedIn, void(void)); 25 MOCK_METHOD0(GuestUserLoggedIn, void(void));
26 MOCK_METHOD1(EphemeralUserLoggedIn, void(const std::string&)); 26 MOCK_METHOD1(EphemeralUserLoggedIn, void(const std::string&));
27 MOCK_METHOD0(SetLoggedInUserWallpaper, void(void));
27 MOCK_METHOD1(UserSelected, void(const std::string&)); 28 MOCK_METHOD1(UserSelected, void(const std::string&));
28 MOCK_METHOD0(SessionStarted, void(void)); 29 MOCK_METHOD0(SessionStarted, void(void));
29 MOCK_METHOD2(RemoveUser, void(const std::string&, RemoveUserDelegate*)); 30 MOCK_METHOD2(RemoveUser, void(const std::string&, RemoveUserDelegate*));
30 MOCK_METHOD1(RemoveUserFromList, void(const std::string&)); 31 MOCK_METHOD1(RemoveUserFromList, void(const std::string&));
31 MOCK_CONST_METHOD1(IsKnownUser, bool(const std::string&)); 32 MOCK_CONST_METHOD1(IsKnownUser, bool(const std::string&));
32 MOCK_CONST_METHOD1(FindUser, const User*(const std::string&)); 33 MOCK_CONST_METHOD1(FindUser, const User*(const std::string&));
33 MOCK_CONST_METHOD1(IsDisplayNameUnique, bool(const string16&)); 34 MOCK_CONST_METHOD1(IsDisplayNameUnique, bool(const string16&));
34 MOCK_METHOD2(SaveUserOAuthStatus, void(const std::string&, 35 MOCK_METHOD2(SaveUserOAuthStatus, void(const std::string&,
35 User::OAuthTokenStatus)); 36 User::OAuthTokenStatus));
36 MOCK_METHOD2(SaveUserDisplayEmail, void(const std::string&, 37 MOCK_METHOD2(SaveUserDisplayEmail, void(const std::string&,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // but the UserManagerImpl and us. 70 // but the UserManagerImpl and us.
70 virtual const User& GetLoggedInUser() const OVERRIDE; 71 virtual const User& GetLoggedInUser() const OVERRIDE;
71 72
72 // You can't mock this function easily because nobody can create User objects 73 // You can't mock this function easily because nobody can create User objects
73 // but the UserManagerImpl and us. 74 // but the UserManagerImpl and us.
74 virtual User& GetLoggedInUser() OVERRIDE; 75 virtual User& GetLoggedInUser() OVERRIDE;
75 76
76 // Sets a new User instance. 77 // Sets a new User instance.
77 void SetLoggedInUser(const std::string& email, bool guest); 78 void SetLoggedInUser(const std::string& email, bool guest);
78 79
79 // Return an invalid user wallpaper index. No need to load a real wallpaper.
80 // When loading wallpaper asynchronously, it may actually cause a crash if
81 // test finished before wallpaper loaded.
82 virtual int GetLoggedInUserWallpaperIndex() OVERRIDE;
83
84 User* user_; 80 User* user_;
85 }; 81 };
86 82
87 // Class that provides easy life-cycle management for mocking the UserManager 83 // Class that provides easy life-cycle management for mocking the UserManager
88 // for tests. 84 // for tests.
89 class ScopedMockUserManagerEnabler { 85 class ScopedMockUserManagerEnabler {
90 public: 86 public:
91 ScopedMockUserManagerEnabler(); 87 ScopedMockUserManagerEnabler();
92 ~ScopedMockUserManagerEnabler(); 88 ~ScopedMockUserManagerEnabler();
93 89
94 MockUserManager* user_manager(); 90 MockUserManager* user_manager();
95 91
96 private: 92 private:
97 UserManager* old_user_manager_; 93 UserManager* old_user_manager_;
98 scoped_ptr<MockUserManager> user_manager_; 94 scoped_ptr<MockUserManager> user_manager_;
99 }; 95 };
100 96
101 } // namespace chromeos 97 } // namespace chromeos
102 98
103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ 99 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc ('k') | chrome/browser/chromeos/login/mock_user_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698