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

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller_browsertest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/browser_shutdown.h" 7 #include "chrome/browser/browser_shutdown.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chrome/browser/chromeos/cros/network_library.h" 9 #include "chrome/browser/chromeos/cros/network_library.h"
10 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" 10 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 LoginDisplayHostImpl::default_host()->StartSignInScreen(); 288 LoginDisplayHostImpl::default_host()->StartSignInScreen();
289 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); 289 EXPECT_FALSE(ExistingUserController::current_controller() == NULL);
290 ExistingUserController::current_controller()->DoAutoEnrollment(); 290 ExistingUserController::current_controller()->DoAutoEnrollment();
291 ExistingUserController::current_controller()->set_login_status_consumer( 291 ExistingUserController::current_controller()->set_login_status_consumer(
292 &mock_consumer); 292 &mock_consumer);
293 // This calls StartWizard, destroying the current controller() and its mocks; 293 // This calls StartWizard, destroying the current controller() and its mocks;
294 // don't set expectations on those objects. 294 // don't set expectations on those objects.
295 ExistingUserController::current_controller()->CompleteLogin( 295 ExistingUserController::current_controller()->CompleteLogin(
296 UserContext(kUsername, kPassword, "")); 296 UserContext(kUsername, kPassword, ""));
297 // Run the tasks posted to complete the login: 297 // Run the tasks posted to complete the login:
298 MessageLoop::current()->RunUntilIdle(); 298 base::MessageLoop::current()->RunUntilIdle();
299 299
300 EnrollmentScreen* screen = 300 EnrollmentScreen* screen =
301 WizardController::default_controller()->GetEnrollmentScreen(); 301 WizardController::default_controller()->GetEnrollmentScreen();
302 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); 302 EXPECT_EQ(screen, WizardController::default_controller()->current_screen());
303 // This is the main expectation: after auto-enrollment, login is resumed. 303 // This is the main expectation: after auto-enrollment, login is resumed.
304 EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _)).Times(1); 304 EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _)).Times(1);
305 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); 305 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED);
306 // Prevent browser launch when the profile is prepared: 306 // Prevent browser launch when the profile is prepared:
307 browser_shutdown::SetTryingToQuit(true); 307 browser_shutdown::SetTryingToQuit(true);
308 // Run the tasks posted to complete the login: 308 // Run the tasks posted to complete the login:
309 MessageLoop::current()->RunUntilIdle(); 309 base::MessageLoop::current()->RunUntilIdle();
310 } 310 }
311 311
312 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowResetScreen) { 312 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowResetScreen) {
313 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(), 313 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(),
314 WizardController::default_controller()->current_screen()); 314 WizardController::default_controller()->current_screen());
315 315
316 LoginDisplayHostImpl::default_host()->StartSignInScreen(); 316 LoginDisplayHostImpl::default_host()->StartSignInScreen();
317 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); 317 EXPECT_FALSE(ExistingUserController::current_controller() == NULL);
318 ExistingUserController::current_controller()->OnStartDeviceReset(); 318 ExistingUserController::current_controller()->OnStartDeviceReset();
319 319
(...skipping 27 matching lines...) Expand all
347 } 347 }
348 348
349 // TODO(dzhioev): Add test emaulating device with wrong HWID. 349 // TODO(dzhioev): Add test emaulating device with wrong HWID.
350 350
351 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 351 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571
352 352
353 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 15, 353 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 15,
354 add_tests_for_new_control_flow_you_just_introduced); 354 add_tests_for_new_control_flow_you_just_introduced);
355 355
356 } // namespace chromeos 356 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698