| 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; |
| 36 | 37 |
| 37 // Registers the user with the given |user_id| on the device. | 38 // Registers the user with the given |user_id| on the device. |
| 38 // This method should be called in PRE_* test. | 39 // This method should be called in PRE_* test. |
| 39 // TODO(dzhioev): Add the ability to register users without a PRE_* test. | 40 // TODO(dzhioev): Add the ability to register users without a PRE_* test. |
| 40 void RegisterUser(const std::string& user_id); | 41 void RegisterUser(const std::string& user_id); |
| 41 | 42 |
| 42 // Set expected credentials for next login attempt. | 43 // Set expected credentials for next login attempt. |
| 43 void SetExpectedCredentials(const UserContext& user_context); | 44 void SetExpectedCredentials(const UserContext& user_context); |
| 44 | 45 |
| 45 // Tries to login with the credentials in |user_context|. The return value | 46 // Tries to login with the credentials in |user_context|. The return value |
| (...skipping 13 matching lines...) Expand all Loading... |
| 59 void AddUser(const std::string& user_id); | 60 void AddUser(const std::string& user_id); |
| 60 | 61 |
| 61 // Executes given JS |expression| in |web_contents_| and checks | 62 // Executes given JS |expression| in |web_contents_| and checks |
| 62 // that it is true. | 63 // that it is true. |
| 63 void JSExpect(const std::string& expression); | 64 void JSExpect(const std::string& expression); |
| 64 | 65 |
| 65 content::WebContents* web_contents() { return web_contents_; } | 66 content::WebContents* web_contents() { return web_contents_; } |
| 66 | 67 |
| 67 test::JSChecker& js_checker() { return js_checker_; } | 68 test::JSChecker& js_checker() { return js_checker_; } |
| 68 | 69 |
| 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 |
| 69 private: | 76 private: |
| 70 void InitializeWebContents(); | 77 void InitializeWebContents(); |
| 71 | 78 |
| 72 void set_web_contents(content::WebContents* web_contents) { | 79 void set_web_contents(content::WebContents* web_contents) { |
| 73 web_contents_ = web_contents; | 80 web_contents_ = web_contents; |
| 74 } | 81 } |
| 75 | 82 |
| 76 bool should_launch_browser_; | 83 bool should_launch_browser_; |
| 77 content::WebContents* web_contents_; | 84 content::WebContents* web_contents_; |
| 78 test::JSChecker js_checker_; | 85 test::JSChecker js_checker_; |
| 79 | 86 |
| 80 DISALLOW_COPY_AND_ASSIGN(LoginManagerTest); | 87 DISALLOW_COPY_AND_ASSIGN(LoginManagerTest); |
| 81 }; | 88 }; |
| 82 | 89 |
| 83 } // namespace chromeos | 90 } // namespace chromeos |
| 84 | 91 |
| 85 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ |
| OLD | NEW |