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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_
8 #include "chrome/browser/chromeos/login/login_utils.h"
9 #include "chromeos/login/auth/user_context.h"
13 // This class emulates behavior of LoginUtils for browser tests.
15 // * Fake authentication. You can configure expected usernames and password for
17 // * Preparing of profiles for authenticated users.
18 // * Launching browser for user, if |should_launch_browser_| set.
19 // * Correct communication with LoginDisplayHost and UserManager.
20 class FakeLoginUtils : public LoginUtils {
23 virtual ~FakeLoginUtils();
24 virtual void RespectLocalePreference(Profile*,
25 const base::Closure& callback) OVERRIDE;
26 virtual void DoBrowserLaunch(Profile* profile,
27 LoginDisplayHost* login_host) OVERRIDE;
28 virtual void PrepareProfile(const UserContext& user_context,
30 bool has_active_session,
31 LoginUtils::Delegate* delegate) OVERRIDE;
32 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE;
33 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE;
34 virtual scoped_refptr<Authenticator> CreateAuthenticator(
35 AuthStatusConsumer* consumer) OVERRIDE;
36 virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
37 bool early_restart) OVERRIDE;
39 void SetExpectedCredentials(const UserContext& user_context);
40 void set_should_launch_browser(bool should_launch_browser) {
41 should_launch_browser_ = should_launch_browser;
45 scoped_refptr<Authenticator> authenticator_;
46 UserContext expected_user_context_;
47 bool should_launch_browser_;
49 DISALLOW_COPY_AND_ASSIGN(FakeLoginUtils);
52 } // namespace chromeos
54 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_