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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 9 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
10 #include "chrome/browser/chromeos/login/mock_login_display.h" | 10 #include "chrome/browser/chromeos/login/mock_login_display.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 const int kAutoLoginDelay2 = 180000; | 39 const int kAutoLoginDelay2 = 180000; |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 class ExistingUserControllerAutoLoginTest : public ::testing::Test { | 43 class ExistingUserControllerAutoLoginTest : public ::testing::Test { |
44 protected: | 44 protected: |
45 ExistingUserControllerAutoLoginTest() | 45 ExistingUserControllerAutoLoginTest() |
46 : auto_login_user_id_(policy::GenerateDeviceLocalAccountUserId( | 46 : auto_login_user_id_(policy::GenerateDeviceLocalAccountUserId( |
47 kAutoLoginAccountId, | 47 kAutoLoginAccountId, |
48 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION)), | 48 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION)), |
49 message_loop_(MessageLoop::TYPE_UI), | 49 message_loop_(base::MessageLoop::TYPE_UI), |
50 ui_thread_(content::BrowserThread::UI, &message_loop_), | 50 ui_thread_(content::BrowserThread::UI, &message_loop_), |
51 local_state_(TestingBrowserProcess::GetGlobal()), | 51 local_state_(TestingBrowserProcess::GetGlobal()), |
52 mock_user_manager_(new MockUserManager()), | 52 mock_user_manager_(new MockUserManager()), |
53 scoped_user_manager_(mock_user_manager_) { | 53 scoped_user_manager_(mock_user_manager_) { |
54 } | 54 } |
55 | 55 |
56 virtual void SetUp() { | 56 virtual void SetUp() { |
57 mock_login_display_host_.reset(new MockLoginDisplayHost); | 57 mock_login_display_host_.reset(new MockLoginDisplayHost); |
58 mock_login_display_ = new MockLoginDisplay(); | 58 mock_login_display_ = new MockLoginDisplay(); |
59 mock_login_utils_ = new MockLoginUtils(); | 59 mock_login_utils_ = new MockLoginUtils(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 private: | 147 private: |
148 // Owned by LoginUtilsWrapper. | 148 // Owned by LoginUtilsWrapper. |
149 MockLoginUtils* mock_login_utils_; | 149 MockLoginUtils* mock_login_utils_; |
150 | 150 |
151 // |mock_login_display_| is owned by the ExistingUserController, which calls | 151 // |mock_login_display_| is owned by the ExistingUserController, which calls |
152 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. | 152 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. |
153 MockLoginDisplay* mock_login_display_; | 153 MockLoginDisplay* mock_login_display_; |
154 | 154 |
155 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; | 155 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; |
156 MessageLoop message_loop_; | 156 base::MessageLoop message_loop_; |
157 content::TestBrowserThread ui_thread_; | 157 content::TestBrowserThread ui_thread_; |
158 ScopedTestingLocalState local_state_; | 158 ScopedTestingLocalState local_state_; |
159 | 159 |
160 // Required by ExistingUserController: | 160 // Required by ExistingUserController: |
161 ScopedDeviceSettingsTestHelper device_settings_test_helper_; | 161 ScopedDeviceSettingsTestHelper device_settings_test_helper_; |
162 ScopedTestCrosSettings test_cros_settings_; | 162 ScopedTestCrosSettings test_cros_settings_; |
163 MockUserManager* mock_user_manager_; | 163 MockUserManager* mock_user_manager_; |
164 ScopedUserManagerEnabler scoped_user_manager_; | 164 ScopedUserManagerEnabler scoped_user_manager_; |
165 | 165 |
166 // |existing_user_controller_| must be destroyed before | 166 // |existing_user_controller_| must be destroyed before |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 ConfigureAutoLogin(); | 280 ConfigureAutoLogin(); |
281 ASSERT_TRUE(auto_login_timer()); | 281 ASSERT_TRUE(auto_login_timer()); |
282 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 282 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
283 EXPECT_EQ(auto_login_timer()->GetCurrentDelay().InMilliseconds(), | 283 EXPECT_EQ(auto_login_timer()->GetCurrentDelay().InMilliseconds(), |
284 kAutoLoginDelay2); | 284 kAutoLoginDelay2); |
285 EXPECT_EQ(auto_login_username(), ""); | 285 EXPECT_EQ(auto_login_username(), ""); |
286 EXPECT_EQ(auto_login_delay(), kAutoLoginDelay2); | 286 EXPECT_EQ(auto_login_delay(), kAutoLoginDelay2); |
287 } | 287 } |
288 | 288 |
289 } // namespace chromeos | 289 } // namespace chromeos |
OLD | NEW |