| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 bool SignInWithUI(Browser* browser, | 122 bool SignInWithUI(Browser* browser, |
| 123 const std::string& username, | 123 const std::string& username, |
| 124 const std::string& password) { | 124 const std::string& password) { |
| 125 | 125 |
| 126 SignInObserver signin_observer; | 126 SignInObserver signin_observer; |
| 127 scoped_ptr<SigninTracker> tracker = | 127 scoped_ptr<SigninTracker> tracker = |
| 128 SigninTrackerFactory::CreateForProfile(browser->profile(), | 128 SigninTrackerFactory::CreateForProfile(browser->profile(), |
| 129 &signin_observer); | 129 &signin_observer); |
| 130 | 130 |
| 131 GURL signin_url = signin::GetPromoURL(signin::SOURCE_START_PAGE, false); | 131 GURL signin_url = signin::GetPromoURL( |
| 132 signin_metrics::SOURCE_START_PAGE, false); |
| 132 DVLOG(1) << "Navigating to " << signin_url; | 133 DVLOG(1) << "Navigating to " << signin_url; |
| 133 // For some tests, the window is not shown yet and this might be the first tab | 134 // For some tests, the window is not shown yet and this might be the first tab |
| 134 // navigation, so GetActiveWebContents() for CURRENT_TAB is NULL. That's why | 135 // navigation, so GetActiveWebContents() for CURRENT_TAB is NULL. That's why |
| 135 // we use NEW_FOREGROUND_TAB rather than the CURRENT_TAB used by default in | 136 // we use NEW_FOREGROUND_TAB rather than the CURRENT_TAB used by default in |
| 136 // ui_test_utils::NavigateToURL(). | 137 // ui_test_utils::NavigateToURL(). |
| 137 ui_test_utils::NavigateToURLWithDisposition( | 138 ui_test_utils::NavigateToURLWithDisposition( |
| 138 browser, | 139 browser, |
| 139 signin_url, | 140 signin_url, |
| 140 NEW_FOREGROUND_TAB, | 141 NEW_FOREGROUND_TAB, |
| 141 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 142 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 142 | 143 |
| 143 DVLOG(1) << "Wait for login UI to be ready."; | 144 DVLOG(1) << "Wait for login UI to be ready."; |
| 144 WaitUntilUIReady(browser); | 145 WaitUntilUIReady(browser); |
| 145 DVLOG(1) << "Sign in user: " << username; | 146 DVLOG(1) << "Sign in user: " << username; |
| 146 ExecuteJsToSigninInSigninFrame(browser, username, password); | 147 ExecuteJsToSigninInSigninFrame(browser, username, password); |
| 147 signin_observer.Wait(); | 148 signin_observer.Wait(); |
| 148 return signin_observer.DidSignIn(); | 149 return signin_observer.DidSignIn(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace login_ui_test_utils | 152 } // namespace login_ui_test_utils |
| OLD | NEW |