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

Unified Diff: chrome/browser/chromeos/login/session/user_session_manager.h

Issue 745613002: [cros] Cleanup: remove LoginUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get rid of FakeChromeUserManager usage in ExistingUserController* tests Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/session/user_session_manager.h
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.h b/chrome/browser/chromeos/login/session/user_session_manager.h
index 3d47ce5374de6025137d9289efeb3b6d7509edf7..88f9118f19b0eeb301e584081ca1fbc75a2a8b77 100644
--- a/chrome/browser/chromeos/login/session/user_session_manager.h
+++ b/chrome/browser/chromeos/login/session/user_session_manager.h
@@ -29,13 +29,15 @@ class PrefService;
class Profile;
namespace user_manager {
-
class User;
-
} // namespace user_manager
namespace chromeos {
+namespace test {
+class UserSessionManagerTestApi;
+} // namespace test
+
class EasyUnlockKeyManager;
class InputEventsBlocker;
class LoginDisplayHost;
@@ -104,15 +106,24 @@ class UserSessionManager
// |start_url| is an optional URL to be opened in Guest session browser.
void CompleteGuestSessionLogin(const GURL& start_url);
- // Start user session given |user_context| and |authenticator| which holds
- // authentication context (profile).
+ // Creates and returns the authenticator to use.
+ // Single Authenticator instance is used for entire login process,
+ // even for multiple retries. Authenticator instance holds reference to
+ // login profile and is later used during fetching of OAuth tokens.
+ scoped_refptr<Authenticator> CreateAuthenticator(
+ AuthStatusConsumer* consumer);
+
+ // Start user session given |user_context|.
+ // OnProfilePrepared() will be called on |delegate| once Profile is ready.
void StartSession(const UserContext& user_context,
StartSessionType start_session_type,
- scoped_refptr<Authenticator> authenticator,
bool has_auth_cookies,
bool has_active_session,
UserSessionManagerDelegate* delegate);
+ // Invalidates |delegate|, which was passed to StartSession method call.
+ void DelegateDeleted(UserSessionManagerDelegate* delegate);
+
// Perform additional actions once system wide notification
// "UserLoggedIn" has been sent.
void PerformPostUserLoggedInActions();
@@ -213,6 +224,7 @@ class UserSessionManager
void RemoveProfileForTesting(Profile* profile);
private:
+ friend class test::UserSessionManagerTestApi;
friend struct DefaultSingletonTraits<UserSessionManager>;
typedef std::set<std::string> SigninSessionRestoreStateSet;
@@ -328,6 +340,18 @@ class UserSessionManager
InputEventsBlocker* input_events_blocker,
const locale_util::LanguageSwitchResult& result);
+ // Test API methods.
+
+ // Injects |user_context| that will be used to create StubAuthenticator
+ // instance when CreateAuthenticator() is called.
+ void InjectStubUserContext(const UserContext& user_context);
+
+ // Controls whether browser instance should be launched after sign in
+ // (used in tests).
+ void set_should_launch_browser_in_tests(bool should_launch_browser) {
+ should_launch_browser_ = should_launch_browser;
+ }
+
UserSessionManagerDelegate* delegate_;
// Authentication/user context.
@@ -335,6 +359,9 @@ class UserSessionManager
scoped_refptr<Authenticator> authenticator_;
StartSessionType start_session_type_;
+ // Injected user context for stub authenticator.
+ scoped_ptr<UserContext> injected_user_context_;
+
// True if the authentication context's cookie jar contains authentication
// cookies from the authentication extension login flow.
bool has_auth_cookies_;
@@ -383,6 +410,9 @@ class UserSessionManager
bool running_easy_unlock_key_ops_;
base::Closure easy_unlock_key_ops_finished_callback_;
+ // Whether should launch browser, tests may override this value.
+ bool should_launch_browser_;
+
DISALLOW_COPY_AND_ASSIGN(UserSessionManager);
};

Powered by Google App Engine
This is Rietveld 408576698