| 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" |
| 11 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 11 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
| 12 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen.
h" | 12 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen.
h" |
| 13 #include "chrome/browser/chromeos/login/enrollment/mock_enterprise_enrollment_sc
reen.h" | 13 #include "chrome/browser/chromeos/login/enrollment/mock_enterprise_enrollment_sc
reen.h" |
| 14 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 14 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 15 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 15 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 16 #include "chrome/browser/chromeos/login/mock_authenticator.h" | 16 #include "chrome/browser/chromeos/login/mock_authenticator.h" |
| 17 #include "chrome/browser/chromeos/login/mock_eula_screen.h" | 17 #include "chrome/browser/chromeos/login/mock_eula_screen.h" |
| 18 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" | 18 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" |
| 19 #include "chrome/browser/chromeos/login/mock_network_screen.h" | 19 #include "chrome/browser/chromeos/login/mock_network_screen.h" |
| 20 #include "chrome/browser/chromeos/login/mock_update_screen.h" | 20 #include "chrome/browser/chromeos/login/mock_update_screen.h" |
| 21 #include "chrome/browser/chromeos/login/network_screen.h" | 21 #include "chrome/browser/chromeos/login/network_screen.h" |
| 22 #include "chrome/browser/chromeos/login/reset_screen.h" |
| 22 #include "chrome/browser/chromeos/login/user_image_screen.h" | 23 #include "chrome/browser/chromeos/login/user_image_screen.h" |
| 23 #include "chrome/browser/chromeos/login/view_screen.h" | 24 #include "chrome/browser/chromeos/login/view_screen.h" |
| 24 #include "chrome/browser/chromeos/login/wizard_controller.h" | 25 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 25 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" | 26 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" |
| 26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/test/base/ui_test_utils.h" | 28 #include "chrome/test/base/ui_test_utils.h" |
| 28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| 29 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 31 #include "ui/base/accelerators/accelerator.h" | 32 #include "ui/base/accelerators/accelerator.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 EXPECT_TRUE(screen->IsAutoEnrollment(&user)); | 299 EXPECT_TRUE(screen->IsAutoEnrollment(&user)); |
| 299 // This is the main expectation: after auto-enrollment, login is resumed. | 300 // This is the main expectation: after auto-enrollment, login is resumed. |
| 300 EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _, _)).Times(1); | 301 EXPECT_CALL(mock_consumer, OnLoginSuccess(_, _, _, _)).Times(1); |
| 301 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); | 302 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); |
| 302 // Prevent browser launch when the profile is prepared: | 303 // Prevent browser launch when the profile is prepared: |
| 303 browser_shutdown::SetTryingToQuit(true); | 304 browser_shutdown::SetTryingToQuit(true); |
| 304 // Run the tasks posted to complete the login: | 305 // Run the tasks posted to complete the login: |
| 305 MessageLoop::current()->RunAllPending(); | 306 MessageLoop::current()->RunAllPending(); |
| 306 } | 307 } |
| 307 | 308 |
| 309 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowResetScreen) { |
| 310 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(), |
| 311 WizardController::default_controller()->current_screen()); |
| 312 |
| 313 BaseLoginDisplayHost::default_host()->StartSignInScreen(); |
| 314 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
| 315 ExistingUserController::current_controller()->OnStartDeviceReset(); |
| 316 |
| 317 ResetScreen* screen = |
| 318 WizardController::default_controller()->GetResetScreen(); |
| 319 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); |
| 320 |
| 321 // After reset screen is canceled, it returns to sign-in screen. |
| 322 // And this destroys WizardController. |
| 323 OnExit(ScreenObserver::RESET_CANCELED); |
| 324 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
| 325 } |
| 326 |
| 308 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 | 327 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 |
| 309 | 328 |
| 310 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 13, | 329 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 14, |
| 311 add_tests_for_new_control_flow_you_just_introduced); | 330 add_tests_for_new_control_flow_you_just_introduced); |
| 312 | 331 |
| 313 } // namespace chromeos | 332 } // namespace chromeos |
| OLD | NEW |