Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / webui / signin / login_ui_test_utils.h
blobbf9a11051041af161ad1597ee3b8be20de348c58
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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_TEST_UTILS_H_
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_TEST_UTILS_H_
8 #include <string>
10 class Browser;
12 namespace login_ui_test_utils {
14 // Blocks until the login UI is available and ready for authorization.
15 void WaitUntilUIReady(Browser* browser);
17 // Blocks until an element with id |element_id| exists in the signin page.
18 void WaitUntilElementExistsInSigninFrame(Browser* browser,
19 const std::string& element_id);
21 // Returns whether an element with id |element_id| exists in the signin page.
22 bool ElementExistsInSigninFrame(Browser* browser,
23 const std::string& element_id);
25 // Executes JavaScript code to sign in a user with email and password to the
26 // auth iframe hosted by gaia_auth extension. This function automatically
27 // detects the version of GAIA sign in page to use.
28 void ExecuteJsToSigninInSigninFrame(Browser* browser,
29 const std::string& email,
30 const std::string& password);
32 // Executes JS to sign in the user in the new GAIA sign in flow.
33 void SigninInNewGaiaFlow(Browser* browser,
34 const std::string& email,
35 const std::string& password);
37 // Executes JS to sign in the user in the old GAIA sign in flow.
38 void SigninInOldGaiaFlow(Browser* browser,
39 const std::string& email,
40 const std::string& password);
42 // A function to sign in a user using Chrome sign-in UI interface.
43 // This will block until a signin succeeded or failed notification is observed.
44 bool SignInWithUI(Browser* browser,
45 const std::string& email,
46 const std::string& password);
48 } // namespace login_ui_test_utils
50 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_TEST_UTILS_H_