| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ | |
| 7 | |
| 8 #include "chrome/browser/chromeos/login/login_utils.h" | |
| 9 #include "chromeos/login/auth/user_context.h" | |
| 10 | |
| 11 namespace chromeos { | |
| 12 | |
| 13 // This class emulates behavior of LoginUtils for browser tests. | |
| 14 // It provides: | |
| 15 // * Fake authentication. You can configure expected usernames and password for | |
| 16 // next auth attempt. | |
| 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 { | |
| 21 public: | |
| 22 FakeLoginUtils(); | |
| 23 ~FakeLoginUtils() override; | |
| 24 void DoBrowserLaunch(Profile* profile, LoginDisplayHost* login_host) override; | |
| 25 void PrepareProfile(const UserContext& user_context, | |
| 26 bool has_cookies, | |
| 27 bool has_active_session, | |
| 28 LoginUtils::Delegate* delegate) override; | |
| 29 void DelegateDeleted(LoginUtils::Delegate* delegate) override; | |
| 30 scoped_refptr<Authenticator> CreateAuthenticator( | |
| 31 AuthStatusConsumer* consumer) override; | |
| 32 | |
| 33 void SetExpectedCredentials(const UserContext& user_context); | |
| 34 void set_should_launch_browser(bool should_launch_browser) { | |
| 35 should_launch_browser_ = should_launch_browser; | |
| 36 } | |
| 37 | |
| 38 private: | |
| 39 scoped_refptr<Authenticator> authenticator_; | |
| 40 UserContext expected_user_context_; | |
| 41 bool should_launch_browser_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(FakeLoginUtils); | |
| 44 }; | |
| 45 | |
| 46 } // namespace chromeos | |
| 47 | |
| 48 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_FAKE_LOGIN_UTILS_H_ | |
| OLD | NEW |