OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 6 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
7 #include "chrome/browser/chromeos/login/mock_login_display.h" | 7 #include "chrome/browser/chromeos/login/mock_login_display.h" |
8 #include "chrome/browser/chromeos/login/mock_login_display_host.h" | 8 #include "chrome/browser/chromeos/login/mock_login_display_host.h" |
9 #include "chrome/browser/chromeos/login/mock_login_utils.h" | 9 #include "chrome/browser/chromeos/login/mock_login_utils.h" |
10 #include "chrome/browser/chromeos/settings/cros_settings.h" | 10 #include "chrome/browser/chromeos/settings/cros_settings.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 private: | 112 private: |
113 // Owned by LoginUtilsWrapper. | 113 // Owned by LoginUtilsWrapper. |
114 MockLoginUtils* mock_login_utils_; | 114 MockLoginUtils* mock_login_utils_; |
115 | 115 |
116 // |mock_login_display_| is owned by the ExistingUserController, which calls | 116 // |mock_login_display_| is owned by the ExistingUserController, which calls |
117 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. | 117 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. |
118 MockLoginDisplay* mock_login_display_; | 118 MockLoginDisplay* mock_login_display_; |
119 | 119 |
120 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; | 120 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; |
121 scoped_ptr<ExistingUserController> existing_user_controller_; | |
122 MessageLoop message_loop_; | 121 MessageLoop message_loop_; |
123 content::TestBrowserThread ui_thread_; | 122 content::TestBrowserThread ui_thread_; |
124 ScopedTestingLocalState local_state_; | 123 ScopedTestingLocalState local_state_; |
| 124 |
| 125 // Required by ExistingUserController: |
125 ScopedDeviceSettingsTestHelper device_settings_test_helper_; | 126 ScopedDeviceSettingsTestHelper device_settings_test_helper_; |
| 127 ScopedTestCrosSettings test_cros_settings_; |
| 128 |
| 129 // |existing_user_controller_| must be destroyed before |
| 130 // |device_settings_test_helper_|. |
| 131 scoped_ptr<ExistingUserController> existing_user_controller_; |
126 }; | 132 }; |
127 | 133 |
128 TEST_F(ExistingUserControllerAutoLoginTest, StartAutoLoginTimer) { | 134 TEST_F(ExistingUserControllerAutoLoginTest, StartAutoLoginTimer) { |
129 // Timer shouldn't start until signin screen is ready. | 135 // Timer shouldn't start until signin screen is ready. |
130 set_auto_login_username(kAutoLoginUsername); | 136 set_auto_login_username(kAutoLoginUsername); |
131 set_auto_login_delay(kAutoLoginDelay2); | 137 set_auto_login_delay(kAutoLoginDelay2); |
132 existing_user_controller()->StartPublicSessionAutoLoginTimer(); | 138 existing_user_controller()->StartPublicSessionAutoLoginTimer(); |
133 EXPECT_FALSE(auto_login_timer()); | 139 EXPECT_FALSE(auto_login_timer()); |
134 | 140 |
135 // Timer shouldn't start if the policy isn't set. | 141 // Timer shouldn't start if the policy isn't set. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 ConfigureAutoLogin(); | 243 ConfigureAutoLogin(); |
238 ASSERT_TRUE(auto_login_timer()); | 244 ASSERT_TRUE(auto_login_timer()); |
239 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 245 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
240 EXPECT_EQ(auto_login_timer()->GetCurrentDelay().InMilliseconds(), | 246 EXPECT_EQ(auto_login_timer()->GetCurrentDelay().InMilliseconds(), |
241 kAutoLoginDelay2); | 247 kAutoLoginDelay2); |
242 EXPECT_EQ(auto_login_username(), ""); | 248 EXPECT_EQ(auto_login_username(), ""); |
243 EXPECT_EQ(auto_login_delay(), kAutoLoginDelay2); | 249 EXPECT_EQ(auto_login_delay(), kAutoLoginDelay2); |
244 } | 250 } |
245 | 251 |
246 } // namespace chromeos | 252 } // namespace chromeos |
OLD | NEW |