Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller_auto_login_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 17 matching lines...) Expand all
28 // delay the test. 28 // delay the test.
29 const int kAutoLoginNoDelay = 0; 29 const int kAutoLoginNoDelay = 0;
30 const int kAutoLoginDelay1 = 60000; 30 const int kAutoLoginDelay1 = 60000;
31 const int kAutoLoginDelay2 = 180000; 31 const int kAutoLoginDelay2 = 180000;
32 32
33 } // namespace 33 } // namespace
34 34
35 class ExistingUserControllerAutoLoginTest : public ::testing::Test { 35 class ExistingUserControllerAutoLoginTest : public ::testing::Test {
36 protected: 36 protected:
37 ExistingUserControllerAutoLoginTest() 37 ExistingUserControllerAutoLoginTest()
38 : message_loop_(MessageLoop::TYPE_UI), 38 : message_loop_(base::MessageLoop::TYPE_UI),
39 ui_thread_(content::BrowserThread::UI, &message_loop_), 39 ui_thread_(content::BrowserThread::UI, &message_loop_),
40 local_state_(TestingBrowserProcess::GetGlobal()) { 40 local_state_(TestingBrowserProcess::GetGlobal()) {}
41 }
42 41
43 virtual void SetUp() { 42 virtual void SetUp() {
44 mock_login_display_host_.reset(new MockLoginDisplayHost); 43 mock_login_display_host_.reset(new MockLoginDisplayHost);
45 mock_login_display_ = new MockLoginDisplay(); 44 mock_login_display_ = new MockLoginDisplay();
46 mock_login_utils_ = new MockLoginUtils(); 45 mock_login_utils_ = new MockLoginUtils();
47 LoginUtils::Set(mock_login_utils_); 46 LoginUtils::Set(mock_login_utils_);
48 47
49 EXPECT_CALL(*mock_login_display_host_.get(), CreateLoginDisplay(_)) 48 EXPECT_CALL(*mock_login_display_host_.get(), CreateLoginDisplay(_))
50 .Times(1) 49 .Times(1)
51 .WillOnce(Return(mock_login_display_)); 50 .WillOnce(Return(mock_login_display_));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 110
112 private: 111 private:
113 // Owned by LoginUtilsWrapper. 112 // Owned by LoginUtilsWrapper.
114 MockLoginUtils* mock_login_utils_; 113 MockLoginUtils* mock_login_utils_;
115 114
116 // |mock_login_display_| is owned by the ExistingUserController, which calls 115 // |mock_login_display_| is owned by the ExistingUserController, which calls
117 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. 116 // CreateLoginDisplay() on the |mock_login_display_host_| to get it.
118 MockLoginDisplay* mock_login_display_; 117 MockLoginDisplay* mock_login_display_;
119 118
120 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; 119 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_;
121 MessageLoop message_loop_; 120 base::MessageLoop message_loop_;
122 content::TestBrowserThread ui_thread_; 121 content::TestBrowserThread ui_thread_;
123 ScopedTestingLocalState local_state_; 122 ScopedTestingLocalState local_state_;
124 123
125 // Required by ExistingUserController: 124 // Required by ExistingUserController:
126 ScopedDeviceSettingsTestHelper device_settings_test_helper_; 125 ScopedDeviceSettingsTestHelper device_settings_test_helper_;
127 ScopedTestCrosSettings test_cros_settings_; 126 ScopedTestCrosSettings test_cros_settings_;
128 127
129 // |existing_user_controller_| must be destroyed before 128 // |existing_user_controller_| must be destroyed before
130 // |device_settings_test_helper_|. 129 // |device_settings_test_helper_|.
131 scoped_ptr<ExistingUserController> existing_user_controller_; 130 scoped_ptr<ExistingUserController> existing_user_controller_;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 ConfigureAutoLogin(); 242 ConfigureAutoLogin();
244 ASSERT_TRUE(auto_login_timer()); 243 ASSERT_TRUE(auto_login_timer());
245 EXPECT_FALSE(auto_login_timer()->IsRunning()); 244 EXPECT_FALSE(auto_login_timer()->IsRunning());
246 EXPECT_EQ(auto_login_timer()->GetCurrentDelay().InMilliseconds(), 245 EXPECT_EQ(auto_login_timer()->GetCurrentDelay().InMilliseconds(),
247 kAutoLoginDelay2); 246 kAutoLoginDelay2);
248 EXPECT_EQ(auto_login_username(), ""); 247 EXPECT_EQ(auto_login_username(), "");
249 EXPECT_EQ(auto_login_delay(), kAutoLoginDelay2); 248 EXPECT_EQ(auto_login_delay(), kAutoLoginDelay2);
250 } 249 }
251 250
252 } // namespace chromeos 251 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698