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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (ElementExistsInSigninFrame(browser, "next")) | 199 if (ElementExistsInSigninFrame(browser, "next")) |
200 SigninInNewGaiaFlow(browser, email, password); | 200 SigninInNewGaiaFlow(browser, email, password); |
201 else | 201 else |
202 SigninInOldGaiaFlow(browser, email, password); | 202 SigninInOldGaiaFlow(browser, email, password); |
203 } | 203 } |
204 | 204 |
205 bool SignInWithUI(Browser* browser, | 205 bool SignInWithUI(Browser* browser, |
206 const std::string& username, | 206 const std::string& username, |
207 const std::string& password, | 207 const std::string& password, |
208 bool wait_for_account_cookies, | 208 bool wait_for_account_cookies, |
209 signin_metrics::Source signin_source) { | 209 signin_metrics::AccessPoint access_point) { |
210 SignInObserver signin_observer(wait_for_account_cookies); | 210 SignInObserver signin_observer(wait_for_account_cookies); |
211 scoped_ptr<SigninTracker> tracker = | 211 scoped_ptr<SigninTracker> tracker = |
212 SigninTrackerFactory::CreateForProfile(browser->profile(), | 212 SigninTrackerFactory::CreateForProfile(browser->profile(), |
213 &signin_observer); | 213 &signin_observer); |
214 | 214 |
215 GURL signin_url = signin::GetPromoURL(signin_source, false); | 215 GURL signin_url = signin::GetPromoURL( |
| 216 access_point, signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, |
| 217 false); |
216 DVLOG(1) << "Navigating to " << signin_url; | 218 DVLOG(1) << "Navigating to " << signin_url; |
217 // For some tests, the window is not shown yet and this might be the first tab | 219 // For some tests, the window is not shown yet and this might be the first tab |
218 // navigation, so GetActiveWebContents() for CURRENT_TAB is NULL. That's why | 220 // navigation, so GetActiveWebContents() for CURRENT_TAB is NULL. That's why |
219 // we use NEW_FOREGROUND_TAB rather than the CURRENT_TAB used by default in | 221 // we use NEW_FOREGROUND_TAB rather than the CURRENT_TAB used by default in |
220 // ui_test_utils::NavigateToURL(). | 222 // ui_test_utils::NavigateToURL(). |
221 ui_test_utils::NavigateToURLWithDisposition( | 223 ui_test_utils::NavigateToURLWithDisposition( |
222 browser, | 224 browser, |
223 signin_url, | 225 signin_url, |
224 NEW_FOREGROUND_TAB, | 226 NEW_FOREGROUND_TAB, |
225 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 227 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
226 | 228 |
227 DVLOG(1) << "Wait for login UI to be ready."; | 229 DVLOG(1) << "Wait for login UI to be ready."; |
228 WaitUntilUIReady(browser); | 230 WaitUntilUIReady(browser); |
229 DVLOG(1) << "Sign in user: " << username; | 231 DVLOG(1) << "Sign in user: " << username; |
230 ExecuteJsToSigninInSigninFrame(browser, username, password); | 232 ExecuteJsToSigninInSigninFrame(browser, username, password); |
231 signin_observer.Wait(); | 233 signin_observer.Wait(); |
232 return signin_observer.DidSignIn(); | 234 return signin_observer.DidSignIn(); |
233 } | 235 } |
234 | 236 |
235 bool SignInWithUI(Browser* browser, | 237 bool SignInWithUI(Browser* browser, |
236 const std::string& username, | 238 const std::string& username, |
237 const std::string& password) { | 239 const std::string& password) { |
238 return SignInWithUI(browser, username, password, | 240 return SignInWithUI(browser, username, password, |
239 false /* wait_for_account_cookies */, | 241 false /* wait_for_account_cookies */, |
240 signin_metrics::SOURCE_START_PAGE); | 242 signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE); |
241 } | 243 } |
242 | 244 |
243 } // namespace login_ui_test_utils | 245 } // namespace login_ui_test_utils |
OLD | NEW |