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/ui/webui/signin/login_ui_test_utils.h" | 5 #include "chrome/browser/ui/webui/signin/login_ui_test_utils.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "chrome/browser/signin/signin_promo.h" | 9 #include "chrome/browser/signin/signin_promo.h" |
10 #include "chrome/browser/signin/signin_tracker_factory.h" | 10 #include "chrome/browser/signin/signin_tracker_factory.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 SigninTrackerFactory::CreateForProfile(browser->profile(), | 225 SigninTrackerFactory::CreateForProfile(browser->profile(), |
226 &signin_observer); | 226 &signin_observer); |
227 | 227 |
228 GURL signin_url = signin::GetPromoURL(access_point, signin_reason, false); | 228 GURL signin_url = signin::GetPromoURL(access_point, signin_reason, false); |
229 DVLOG(1) << "Navigating to " << signin_url; | 229 DVLOG(1) << "Navigating to " << signin_url; |
230 // For some tests, the window is not shown yet and this might be the first tab | 230 // For some tests, the window is not shown yet and this might be the first tab |
231 // navigation, so GetActiveWebContents() for CURRENT_TAB is NULL. That's why | 231 // navigation, so GetActiveWebContents() for CURRENT_TAB is NULL. That's why |
232 // we use NEW_FOREGROUND_TAB rather than the CURRENT_TAB used by default in | 232 // we use NEW_FOREGROUND_TAB rather than the CURRENT_TAB used by default in |
233 // ui_test_utils::NavigateToURL(). | 233 // ui_test_utils::NavigateToURL(). |
234 ui_test_utils::NavigateToURLWithDisposition( | 234 ui_test_utils::NavigateToURLWithDisposition( |
235 browser, | 235 browser, signin_url, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
236 signin_url, | 236 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
237 NEW_FOREGROUND_TAB, | |
238 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
239 | 237 |
240 DVLOG(1) << "Wait for login UI to be ready."; | 238 DVLOG(1) << "Wait for login UI to be ready."; |
241 WaitUntilUIReady(browser); | 239 WaitUntilUIReady(browser); |
242 DVLOG(1) << "Sign in user: " << username; | 240 DVLOG(1) << "Sign in user: " << username; |
243 ExecuteJsToSigninInSigninFrame(browser, username, password); | 241 ExecuteJsToSigninInSigninFrame(browser, username, password); |
244 signin_observer.Wait(); | 242 signin_observer.Wait(); |
245 return signin_observer.DidSignIn(); | 243 return signin_observer.DidSignIn(); |
246 } | 244 } |
247 | 245 |
248 bool SignInWithUI(Browser* browser, | 246 bool SignInWithUI(Browser* browser, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 const base::Time expire_time = base::Time::Now() + timeout; | 279 const base::Time expire_time = base::Time::Now() + timeout; |
282 while (base::Time::Now() <= expire_time) { | 280 while (base::Time::Now() <= expire_time) { |
283 if (TryDismissSyncConfirmationDialog(browser)) | 281 if (TryDismissSyncConfirmationDialog(browser)) |
284 return true; | 282 return true; |
285 RunLoopFor(base::TimeDelta::FromMilliseconds(1000)); | 283 RunLoopFor(base::TimeDelta::FromMilliseconds(1000)); |
286 } | 284 } |
287 return false; | 285 return false; |
288 } | 286 } |
289 | 287 |
290 } // namespace login_ui_test_utils | 288 } // namespace login_ui_test_utils |
OLD | NEW |