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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/prefs/pref_service_factory.h" | 11 #include "base/prefs/pref_service_factory.h" |
12 #include "base/prefs/testing_pref_store.h" | 12 #include "base/prefs/testing_pref_store.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/browser_shutdown.h" | 17 #include "chrome/browser/browser_shutdown.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
20 #include "chrome/browser/chromeos/base/locale_util.h" | 20 #include "chrome/browser/chromeos/base/locale_util.h" |
21 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" | 21 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" |
| 22 #include "chrome/browser/chromeos/login/auth/key.h" |
22 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" | 23 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" |
23 #include "chrome/browser/chromeos/login/auth/mock_login_status_consumer.h" | 24 #include "chrome/browser/chromeos/login/auth/mock_login_status_consumer.h" |
24 #include "chrome/browser/chromeos/login/auth/user_context.h" | 25 #include "chrome/browser/chromeos/login/auth/user_context.h" |
25 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 26 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
26 #include "chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h" | 27 #include "chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h" |
27 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 28 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
28 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 29 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
29 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" | 30 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" |
30 #include "chrome/browser/chromeos/login/screens/mock_eula_screen.h" | 31 #include "chrome/browser/chromeos/login/screens/mock_eula_screen.h" |
31 #include "chrome/browser/chromeos/login/screens/mock_network_screen.h" | 32 #include "chrome/browser/chromeos/login/screens/mock_network_screen.h" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); | 625 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
625 } | 626 } |
626 | 627 |
627 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, | 628 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, |
628 ControlFlowAutoEnrollmentCompleted) { | 629 ControlFlowAutoEnrollmentCompleted) { |
629 WizardController::default_controller()->SkipPostLoginScreensForTesting(); | 630 WizardController::default_controller()->SkipPostLoginScreensForTesting(); |
630 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(), | 631 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(), |
631 WizardController::default_controller()->current_screen()); | 632 WizardController::default_controller()->current_screen()); |
632 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0); | 633 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0); |
633 | 634 |
634 LoginUtils::Set(new TestLoginUtils(kUsername, kPassword)); | 635 UserContext user_context(kUsername); |
| 636 user_context.SetKey(Key(kPassword)); |
| 637 LoginUtils::Set(new TestLoginUtils(user_context)); |
635 MockConsumer mock_consumer; | 638 MockConsumer mock_consumer; |
636 | 639 |
637 // Must have a pending signin to resume after auto-enrollment: | 640 // Must have a pending signin to resume after auto-enrollment: |
638 LoginDisplayHostImpl::default_host()->StartSignInScreen(LoginScreenContext()); | 641 LoginDisplayHostImpl::default_host()->StartSignInScreen(LoginScreenContext()); |
639 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); | 642 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
640 ExistingUserController::current_controller()->DoAutoEnrollment(); | 643 ExistingUserController::current_controller()->DoAutoEnrollment(); |
641 ExistingUserController::current_controller()->set_login_status_consumer( | 644 ExistingUserController::current_controller()->set_login_status_consumer( |
642 &mock_consumer); | 645 &mock_consumer); |
643 // This calls StartWizard, destroying the current controller() and its mocks; | 646 // This calls StartWizard, destroying the current controller() and its mocks; |
644 // don't set expectations on those objects. | 647 // don't set expectations on those objects. |
645 UserContext user_context(kUsername); | |
646 user_context.SetPassword(kPassword); | |
647 ExistingUserController::current_controller()->CompleteLogin(user_context); | 648 ExistingUserController::current_controller()->CompleteLogin(user_context); |
648 // Run the tasks posted to complete the login: | 649 // Run the tasks posted to complete the login: |
649 base::MessageLoop::current()->RunUntilIdle(); | 650 base::MessageLoop::current()->RunUntilIdle(); |
650 | 651 |
651 EnrollmentScreen* screen = | 652 EnrollmentScreen* screen = |
652 WizardController::default_controller()->GetEnrollmentScreen(); | 653 WizardController::default_controller()->GetEnrollmentScreen(); |
653 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); | 654 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); |
654 // This is the main expectation: after auto-enrollment, login is resumed. | 655 // This is the main expectation: after auto-enrollment, login is resumed. |
655 EXPECT_CALL(mock_consumer, OnLoginSuccess(_)).Times(1); | 656 EXPECT_CALL(mock_consumer, OnLoginSuccess(_)).Times(1); |
656 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); | 657 OnExit(ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 | 1044 |
1044 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 | 1045 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 |
1045 | 1046 |
1046 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when | 1047 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when |
1047 // UI and logic is ready. http://crbug.com/127016 | 1048 // UI and logic is ready. http://crbug.com/127016 |
1048 | 1049 |
1049 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 21, | 1050 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 21, |
1050 add_tests_for_new_control_flow_you_just_introduced); | 1051 add_tests_for_new_control_flow_you_just_introduced); |
1051 | 1052 |
1052 } // namespace chromeos | 1053 } // namespace chromeos |
OLD | NEW |