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

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

Issue 2785753003: Exclude building signin view controller and its delegate on ChromeOS (Closed)
Patch Set: Exclude SigninViewController on ChromeOS Created 3 years, 8 months 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/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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 bool SignInWithUI(Browser* browser, 246 bool SignInWithUI(Browser* browser,
247 const std::string& username, 247 const std::string& username,
248 const std::string& password) { 248 const std::string& password) {
249 return SignInWithUI(browser, username, password, 249 return SignInWithUI(browser, username, password,
250 false /* wait_for_account_cookies */, 250 false /* wait_for_account_cookies */,
251 signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE, 251 signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE,
252 signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT); 252 signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT);
253 } 253 }
254 254
255 bool TryDismissSyncConfirmationDialog(Browser* browser) { 255 bool TryDismissSyncConfirmationDialog(Browser* browser) {
256 #if defined(OS_CHROMEOS)
257 NOTREACHED();
258 return false;
259 #else
256 SigninViewController* signin_view_controller = 260 SigninViewController* signin_view_controller =
257 browser->signin_view_controller(); 261 browser->signin_view_controller();
258 DCHECK_NE(signin_view_controller, nullptr); 262 DCHECK_NE(signin_view_controller, nullptr);
259 SigninViewControllerDelegate* delegate = signin_view_controller->delegate(); 263 SigninViewControllerDelegate* delegate = signin_view_controller->delegate();
260 if (delegate == nullptr) 264 if (delegate == nullptr)
261 return false; 265 return false;
262 content::WebContents* dialog_web_contents = 266 content::WebContents* dialog_web_contents =
263 delegate->web_contents_for_testing(); 267 delegate->web_contents_for_testing();
264 DCHECK_NE(dialog_web_contents, nullptr); 268 DCHECK_NE(dialog_web_contents, nullptr);
265 std::string message; 269 std::string message;
266 std::string js = 270 std::string js =
267 "if (document.getElementById('confirmButton') == null) {" 271 "if (document.getElementById('confirmButton') == null) {"
268 " window.domAutomationController.send('NotFound');" 272 " window.domAutomationController.send('NotFound');"
269 "} else {" 273 "} else {"
270 " document.getElementById('confirmButton').click();" 274 " document.getElementById('confirmButton').click();"
271 " window.domAutomationController.send('Ok');" 275 " window.domAutomationController.send('Ok');"
272 "}"; 276 "}";
273 EXPECT_TRUE(content::ExecuteScriptAndExtractString(dialog_web_contents, js, 277 EXPECT_TRUE(content::ExecuteScriptAndExtractString(dialog_web_contents, js,
274 &message)); 278 &message));
275 return message == "Ok"; 279 return message == "Ok";
280 #endif
276 } 281 }
277 282
278 bool DismissSyncConfirmationDialog(Browser* browser, base::TimeDelta timeout) { 283 bool DismissSyncConfirmationDialog(Browser* browser, base::TimeDelta timeout) {
279 const base::Time expire_time = base::Time::Now() + timeout; 284 const base::Time expire_time = base::Time::Now() + timeout;
280 while (base::Time::Now() <= expire_time) { 285 while (base::Time::Now() <= expire_time) {
281 if (TryDismissSyncConfirmationDialog(browser)) 286 if (TryDismissSyncConfirmationDialog(browser))
282 return true; 287 return true;
283 RunLoopFor(base::TimeDelta::FromMilliseconds(1000)); 288 RunLoopFor(base::TimeDelta::FromMilliseconds(1000));
284 } 289 }
285 return false; 290 return false;
286 } 291 }
287 292
288 } // namespace login_ui_test_utils 293 } // namespace login_ui_test_utils
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/login_ui_service.cc ('k') | chrome/browser/ui/webui/signin/signin_error_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698