OLD | NEW |
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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/browser_shutdown.h" | 8 #include "chrome/browser/browser_shutdown.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/cros/network_library.h" | 10 #include "chrome/browser/chromeos/cros/network_library.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 kPassword); | 292 kPassword); |
293 EnterpriseEnrollmentScreen* screen = | 293 EnterpriseEnrollmentScreen* screen = |
294 WizardController::default_controller()->GetEnterpriseEnrollmentScreen(); | 294 WizardController::default_controller()->GetEnterpriseEnrollmentScreen(); |
295 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); | 295 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); |
296 // This is the main expectation: after auto-enrollment, login is resumed. | 296 // This is the main expectation: after auto-enrollment, login is resumed. |
297 EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _, _)).Times(1); | 297 EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _, _)).Times(1); |
298 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); | 298 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); |
299 // Prevent browser launch when the profile is prepared: | 299 // Prevent browser launch when the profile is prepared: |
300 browser_shutdown::SetTryingToQuit(true); | 300 browser_shutdown::SetTryingToQuit(true); |
301 // Run the tasks posted to complete the login: | 301 // Run the tasks posted to complete the login: |
302 MessageLoop::current()->RunAllPending(); | 302 MessageLoop::current()->RunUntilIdle(); |
303 } | 303 } |
304 | 304 |
305 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowResetScreen) { | 305 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowResetScreen) { |
306 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(), | 306 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(), |
307 WizardController::default_controller()->current_screen()); | 307 WizardController::default_controller()->current_screen()); |
308 | 308 |
309 BaseLoginDisplayHost::default_host()->StartSignInScreen(); | 309 BaseLoginDisplayHost::default_host()->StartSignInScreen(); |
310 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); | 310 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
311 ExistingUserController::current_controller()->OnStartDeviceReset(); | 311 ExistingUserController::current_controller()->OnStartDeviceReset(); |
312 | 312 |
313 ResetScreen* screen = | 313 ResetScreen* screen = |
314 WizardController::default_controller()->GetResetScreen(); | 314 WizardController::default_controller()->GetResetScreen(); |
315 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); | 315 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); |
316 | 316 |
317 // After reset screen is canceled, it returns to sign-in screen. | 317 // After reset screen is canceled, it returns to sign-in screen. |
318 // And this destroys WizardController. | 318 // And this destroys WizardController. |
319 OnExit(ScreenObserver::RESET_CANCELED); | 319 OnExit(ScreenObserver::RESET_CANCELED); |
320 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); | 320 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
321 } | 321 } |
322 | 322 |
323 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 | 323 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 |
324 | 324 |
325 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 14, | 325 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 14, |
326 add_tests_for_new_control_flow_you_just_introduced); | 326 add_tests_for_new_control_flow_you_just_introduced); |
327 | 327 |
328 } // namespace chromeos | 328 } // namespace chromeos |
OLD | NEW |