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

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

Issue 270563002: Componentize LoginManagerTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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
(Empty)
1 // Copyright 2014 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_LOGIN_MANAGER_TEST_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_HELPER_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "chrome/browser/chromeos/login/mock_login_utils.h"
13
14 namespace chromeos {
15
16 // Helper class for Chrome OS multi-user browser tests. Provides mock login
17 // utils. Tests may subclass LoginManagerTest or use this helper directly.
18 // If no special configuration is done launches out-of-box WebUI.
19 // To launch login UI use a PRE_* test that will register user(s) and mark
20 // out-of-box as completed.
21 // Guarantees that WebUI has been initialized by waiting for
22 // NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE notification.
23 class LoginManagerTestHelper {
24 public:
25 LoginManagerTestHelper();
26 ~LoginManagerTestHelper();
27
28 // Adds flags for LoginManager and multi-profiles.
29 void SetUpCommandLine(base::CommandLine* command_line);
30
31 // Creates the mock login utils.
32 void SetUpLoginUtils(bool should_launch_browser);
33
34 // Waits for NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE.
35 void WaitForLoginWebUI();
36
37 void CloseLoginWebUI();
38
39 // Registers user with given |username| on device.
40 // Should be called in PRE_* test.
41 // TODO(dzhioev): add ability to register users without PRE_* test.
42 void RegisterUser(const std::string& username);
43
44 // Sets expected credentials for next login attempt.
45 void SetExpectedCredentials(const std::string& username,
46 const std::string& password);
47
48 // Tries to log in with |username| and |password|. Returns false if attempt
49 // has failed.
50 bool TryToLogIn(const std::string& username, const std::string& password);
51
52 // Tries to add user to session with |username| and |password|. Returns false
53 // if attempt has failed. This function does the same as TryToLogIn but
54 // doesn't check that the new user became the active user.
55 bool AddUserToSession(const std::string& username,
56 const std::string& password);
57
58 // Logs in user with |username|. User should be registered with
59 // RegisterUser().
60 void LogInUser(const std::string& username);
61
62 // Adds user with |username| to session.
63 void AddUser(const std::string& username);
64
65 MockLoginUtils& mock_login_utils() { return *mock_login_utils_; }
66
67 private:
68 MockLoginUtils* mock_login_utils_;
69 bool web_ui_visible_;
70
71 DISALLOW_COPY_AND_ASSIGN(LoginManagerTestHelper);
72 };
73
74 } // namespace chromeos
75
76 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_manager_test.cc ('k') | chrome/browser/chromeos/login/login_manager_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698