OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/signin/signin_promo.h" | 5 #include "chrome/browser/signin/signin_promo.h" |
6 #include "chrome/browser/signin/signin_tracker_factory.h" | 6 #include "chrome/browser/signin/signin_tracker_factory.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 9 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void ExecuteJsToSigninInSigninFrame(Browser* browser, | 107 void ExecuteJsToSigninInSigninFrame(Browser* browser, |
108 const std::string& email, | 108 const std::string& email, |
109 const std::string& password) { | 109 const std::string& password) { |
110 std::string js = | 110 std::string js = |
111 "document.getElementById('Email').value = '" + email + "';" | 111 "document.getElementById('Email').value = '" + email + "';" |
112 "document.getElementById('Passwd').value = '" + password + "';" | 112 "document.getElementById('Passwd').value = '" + password + "';" |
113 "document.getElementById('signIn').click();"; | 113 "document.getElementById('signIn').click();"; |
114 | 114 |
115 content::WebContents* web_contents = | 115 content::WebContents* web_contents = |
116 browser->tab_strip_model()->GetActiveWebContents(); | 116 browser->tab_strip_model()->GetActiveWebContents(); |
117 ASSERT_TRUE(content::ExecuteScript(InlineLoginUI::GetAuthIframe( | 117 ASSERT_TRUE(content::ExecuteScript(InlineLoginUI::GetAuthFrame( |
118 web_contents, GURL(), "signin-frame"), js)); | 118 web_contents, GURL(), "signin-frame"), js)); |
119 } | 119 } |
120 | 120 |
121 bool SignInWithUI(Browser* browser, | 121 bool SignInWithUI(Browser* browser, |
122 const std::string& username, | 122 const std::string& username, |
123 const std::string& password) { | 123 const std::string& password) { |
124 | 124 |
125 SignInObserver signin_observer; | 125 SignInObserver signin_observer; |
126 scoped_ptr<SigninTracker> tracker = | 126 scoped_ptr<SigninTracker> tracker = |
127 SigninTrackerFactory::CreateForProfile(browser->profile(), | 127 SigninTrackerFactory::CreateForProfile(browser->profile(), |
(...skipping 14 matching lines...) Expand all Loading... |
142 | 142 |
143 DVLOG(1) << "Wait for login UI to be ready."; | 143 DVLOG(1) << "Wait for login UI to be ready."; |
144 WaitUntilUIReady(browser); | 144 WaitUntilUIReady(browser); |
145 DVLOG(1) << "Sign in user: " << username; | 145 DVLOG(1) << "Sign in user: " << username; |
146 ExecuteJsToSigninInSigninFrame(browser, username, password); | 146 ExecuteJsToSigninInSigninFrame(browser, username, password); |
147 signin_observer.Wait(); | 147 signin_observer.Wait(); |
148 return signin_observer.DidSignIn(); | 148 return signin_observer.DidSignIn(); |
149 } | 149 } |
150 | 150 |
151 } // namespace login_ui_test_utils | 151 } // namespace login_ui_test_utils |
OLD | NEW |