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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "content/public/test/mock_notification_observer.h" | 59 #include "content/public/test/mock_notification_observer.h" |
60 #include "crypto/rsa_private_key.h" | 60 #include "crypto/rsa_private_key.h" |
61 #include "google_apis/gaia/mock_url_fetcher_factory.h" | 61 #include "google_apis/gaia/mock_url_fetcher_factory.h" |
62 #include "grit/generated_resources.h" | 62 #include "grit/generated_resources.h" |
63 #include "testing/gmock/include/gmock/gmock.h" | 63 #include "testing/gmock/include/gmock/gmock.h" |
64 #include "testing/gtest/include/gtest/gtest.h" | 64 #include "testing/gtest/include/gtest/gtest.h" |
65 #include "ui/base/l10n/l10n_util.h" | 65 #include "ui/base/l10n/l10n_util.h" |
66 | 66 |
67 using ::testing::_; | 67 using ::testing::_; |
68 using ::testing::AnyNumber; | 68 using ::testing::AnyNumber; |
69 using ::testing::AnyOf; | |
70 using ::testing::Invoke; | 69 using ::testing::Invoke; |
71 using ::testing::InvokeWithoutArgs; | 70 using ::testing::InvokeWithoutArgs; |
72 using ::testing::Return; | 71 using ::testing::Return; |
73 using ::testing::ReturnNull; | 72 using ::testing::ReturnNull; |
74 using ::testing::Sequence; | 73 using ::testing::Sequence; |
75 using ::testing::WithArg; | 74 using ::testing::WithArg; |
76 | 75 |
77 namespace em = enterprise_management; | 76 namespace em = enterprise_management; |
78 | 77 |
79 namespace chromeos { | 78 namespace chromeos { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 existing_user_controller()->CompleteLogin( | 390 existing_user_controller()->CompleteLogin( |
392 UserContext(kUsername, kPassword, "")); | 391 UserContext(kUsername, kPassword, "")); |
393 content::RunAllPendingInMessageLoop(); | 392 content::RunAllPendingInMessageLoop(); |
394 } | 393 } |
395 | 394 |
396 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, | 395 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, |
397 NewUserDontAutoEnrollAfterSignIn) { | 396 NewUserDontAutoEnrollAfterSignIn) { |
398 EXPECT_CALL(*mock_login_display_host_, | 397 EXPECT_CALL(*mock_login_display_host_, |
399 StartWizard(WizardController::kEnterpriseEnrollmentScreenName, _)) | 398 StartWizard(WizardController::kEnterpriseEnrollmentScreenName, _)) |
400 .Times(0); | 399 .Times(0); |
401 // This will be the first sign-in of a new user, which may cause the (legacy) | |
402 // registration to be activated. A real WizardController instance immediately | |
403 // advances to the Terms of Service or user image screen but this test uses | |
404 // MockLoginDisplayHost Instead. | |
405 EXPECT_CALL(*mock_login_display_host_, | 400 EXPECT_CALL(*mock_login_display_host_, |
406 StartWizard(AnyOf(WizardController::kRegistrationScreenName, | 401 StartWizard(WizardController::kTermsOfServiceScreenName, NULL)) |
407 WizardController::kTermsOfServiceScreenName), | |
408 NULL)) | |
409 .Times(1); | 402 .Times(1); |
410 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) | 403 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) |
411 .Times(1) | 404 .Times(1) |
412 .WillOnce(WithArg<0>(Invoke(CreateAuthenticatorNewUser))); | 405 .WillOnce(WithArg<0>(Invoke(CreateAuthenticatorNewUser))); |
413 EXPECT_CALL(*mock_login_utils_, | 406 EXPECT_CALL(*mock_login_utils_, |
414 PrepareProfile(UserContext(kNewUsername, | 407 PrepareProfile(UserContext(kNewUsername, |
415 kPassword, | 408 kPassword, |
416 std::string(), | 409 std::string(), |
417 kNewUsername), | 410 kNewUsername), |
418 _, _, _, _)) | 411 _, _, _, _)) |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 802 |
810 // Wait for login tasks to complete. | 803 // Wait for login tasks to complete. |
811 content::RunAllPendingInMessageLoop(); | 804 content::RunAllPendingInMessageLoop(); |
812 | 805 |
813 // Timer should still be stopped after login completes. | 806 // Timer should still be stopped after login completes. |
814 ASSERT_TRUE(auto_login_timer()); | 807 ASSERT_TRUE(auto_login_timer()); |
815 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 808 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
816 } | 809 } |
817 | 810 |
818 } // namespace chromeos | 811 } // namespace chromeos |
OLD | NEW |