Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/ui/webui/signin/login_ui_test_utils.cc

Issue 1473543002: Implement newly designed sign-in related histograms for desktop platorms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_SIGNIN_PRIMARY_ACCOUNT, false);
216 DVLOG(1) << "Navigating to " << signin_url; 217 DVLOG(1) << "Navigating to " << signin_url;
217 // For some tests, the window is not shown yet and this might be the first tab 218 // 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 219 // 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 220 // we use NEW_FOREGROUND_TAB rather than the CURRENT_TAB used by default in
220 // ui_test_utils::NavigateToURL(). 221 // ui_test_utils::NavigateToURL().
221 ui_test_utils::NavigateToURLWithDisposition( 222 ui_test_utils::NavigateToURLWithDisposition(
222 browser, 223 browser,
223 signin_url, 224 signin_url,
224 NEW_FOREGROUND_TAB, 225 NEW_FOREGROUND_TAB,
225 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 226 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
226 227
227 DVLOG(1) << "Wait for login UI to be ready."; 228 DVLOG(1) << "Wait for login UI to be ready.";
228 WaitUntilUIReady(browser); 229 WaitUntilUIReady(browser);
229 DVLOG(1) << "Sign in user: " << username; 230 DVLOG(1) << "Sign in user: " << username;
230 ExecuteJsToSigninInSigninFrame(browser, username, password); 231 ExecuteJsToSigninInSigninFrame(browser, username, password);
231 signin_observer.Wait(); 232 signin_observer.Wait();
232 return signin_observer.DidSignIn(); 233 return signin_observer.DidSignIn();
233 } 234 }
234 235
235 bool SignInWithUI(Browser* browser, 236 bool SignInWithUI(Browser* browser,
236 const std::string& username, 237 const std::string& username,
237 const std::string& password) { 238 const std::string& password) {
238 return SignInWithUI(browser, username, password, 239 return SignInWithUI(browser, username, password,
239 false /* wait_for_account_cookies */, 240 false /* wait_for_account_cookies */,
240 signin_metrics::SOURCE_START_PAGE); 241 signin_metrics::ACCESS_POINT_START_PAGE);
241 } 242 }
242 243
243 } // namespace login_ui_test_utils 244 } // namespace login_ui_test_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698