OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_LOGIN_MANAGER_TEST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/login/mixin_based_browser_test.h" | 10 #include "chrome/browser/chromeos/login/mixin_based_browser_test.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE notification. | 26 // NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE notification. |
27 class LoginManagerTest : public MixinBasedBrowserTest { | 27 class LoginManagerTest : public MixinBasedBrowserTest { |
28 public: | 28 public: |
29 explicit LoginManagerTest(bool should_launch_browser); | 29 explicit LoginManagerTest(bool should_launch_browser); |
30 | 30 |
31 // Overridden from InProcessBrowserTest. | 31 // Overridden from InProcessBrowserTest. |
32 void TearDownOnMainThread() override; | 32 void TearDownOnMainThread() override; |
33 void SetUpCommandLine(base::CommandLine* command_line) override; | 33 void SetUpCommandLine(base::CommandLine* command_line) override; |
34 void SetUpInProcessBrowserTestFixture() override; | 34 void SetUpInProcessBrowserTestFixture() override; |
35 void SetUpOnMainThread() override; | 35 void SetUpOnMainThread() override; |
36 bool SetUpUserDataDirectory() override; | |
37 | 36 |
38 // Registers the user with the given |user_id| on the device. | 37 // Registers the user with the given |user_id| on the device. |
39 // This method should be called in PRE_* test. | 38 // This method should be called in PRE_* test. |
40 // TODO(dzhioev): Add the ability to register users without a PRE_* test. | 39 // TODO(dzhioev): Add the ability to register users without a PRE_* test. |
41 void RegisterUser(const std::string& user_id); | 40 void RegisterUser(const std::string& user_id); |
42 | 41 |
43 // Set expected credentials for next login attempt. | 42 // Set expected credentials for next login attempt. |
44 void SetExpectedCredentials(const UserContext& user_context); | 43 void SetExpectedCredentials(const UserContext& user_context); |
45 | 44 |
46 // Tries to login with the credentials in |user_context|. The return value | 45 // Tries to login with the credentials in |user_context|. The return value |
(...skipping 13 matching lines...) Expand all Loading... |
60 void AddUser(const std::string& user_id); | 59 void AddUser(const std::string& user_id); |
61 | 60 |
62 // Executes given JS |expression| in |web_contents_| and checks | 61 // Executes given JS |expression| in |web_contents_| and checks |
63 // that it is true. | 62 // that it is true. |
64 void JSExpect(const std::string& expression); | 63 void JSExpect(const std::string& expression); |
65 | 64 |
66 content::WebContents* web_contents() { return web_contents_; } | 65 content::WebContents* web_contents() { return web_contents_; } |
67 | 66 |
68 test::JSChecker& js_checker() { return js_checker_; } | 67 test::JSChecker& js_checker() { return js_checker_; } |
69 | 68 |
70 protected: | |
71 bool use_webview() { return use_webview_; } | |
72 void set_use_webview(bool use_webview) { use_webview_ = use_webview; } | |
73 | |
74 bool use_webview_; | |
75 | |
76 private: | 69 private: |
77 void InitializeWebContents(); | 70 void InitializeWebContents(); |
78 | 71 |
79 void set_web_contents(content::WebContents* web_contents) { | 72 void set_web_contents(content::WebContents* web_contents) { |
80 web_contents_ = web_contents; | 73 web_contents_ = web_contents; |
81 } | 74 } |
82 | 75 |
83 bool should_launch_browser_; | 76 bool should_launch_browser_; |
84 content::WebContents* web_contents_; | 77 content::WebContents* web_contents_; |
85 test::JSChecker js_checker_; | 78 test::JSChecker js_checker_; |
86 | 79 |
87 DISALLOW_COPY_AND_ASSIGN(LoginManagerTest); | 80 DISALLOW_COPY_AND_ASSIGN(LoginManagerTest); |
88 }; | 81 }; |
89 | 82 |
90 } // namespace chromeos | 83 } // namespace chromeos |
91 | 84 |
92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ |
OLD | NEW |