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_LOGIN_MANAGER_TEST_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ 7 8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 9 #include "chrome/browser/chromeos/login/mock_login_utils.h" 10 11 namespace chromeos { 12 13 class LoginManagerTest : public CrosInProcessBrowserTest { 14 public: 15 explicit LoginManagerTest(bool should_launch_browser); 16 17 // Overriden from CrosInProcessBrowserTest. 18 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; 19 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 20 21 // Registers user with given |username| on device. 22 // Should be called in PRE_* test. 23 // TODO(dzhioev): add ability to register users without PRE_* test. 24 void RegisterUser(const std::string& username); 25 26 // Set expected credentials for next login attempt. 27 void SetExpectedCredentials(const std::string& username, 28 const std::string& password); 29 30 // Tries to login with |username| and |password|. Returns false if attempt 31 // has failed. 32 bool TryToLogin(const std::string& username, const std::string& password); 33 34 // Login user with |username|. User should be registered using RegisterUser(). 35 void LoginUser(const std::string& username); 36 37 MockLoginUtils& login_utils() { return *mock_login_utils_; } 38 39 private: 40 MockLoginUtils* mock_login_utils_; 41 bool should_launch_browser_; 42 43 DISALLOW_COPY_AND_ASSIGN(LoginManagerTest); 44 }; 45 46 } // namespace chromeos 47 48 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ 49