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

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

Issue 656283002: [session_manager] Move user session initialization code out of ExistingUserController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add PerformPreLoginActions, PerformLoginFinishedActions methods Created 6 years, 2 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
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 virtual void SetUpOnMainThread() override { 168 virtual void SetUpOnMainThread() override {
169 testing_profile_.reset(new TestingProfile()); 169 testing_profile_.reset(new TestingProfile());
170 SetUpUserManager(); 170 SetUpUserManager();
171 existing_user_controller_.reset( 171 existing_user_controller_.reset(
172 new ExistingUserController(mock_login_display_host_.get())); 172 new ExistingUserController(mock_login_display_host_.get()));
173 ASSERT_EQ(existing_user_controller(), existing_user_controller_.get()); 173 ASSERT_EQ(existing_user_controller(), existing_user_controller_.get());
174 existing_user_controller_->Init(user_manager::UserList()); 174 existing_user_controller_->Init(user_manager::UserList());
175 profile_prepared_cb_ = 175 profile_prepared_cb_ =
176 base::Bind(&ExistingUserController::OnProfilePrepared, 176 base::Bind(&ExistingUserController::OnProfilePrepared,
177 base::Unretained(existing_user_controller()), 177 base::Unretained(existing_user_controller()),
178 testing_profile_.get()); 178 testing_profile_.get(),
179 false);
179 } 180 }
180 181
181 virtual void TearDownOnMainThread() override { 182 virtual void TearDownOnMainThread() override {
182 // ExistingUserController must be deleted before the thread is cleaned up: 183 // ExistingUserController must be deleted before the thread is cleaned up:
183 // If there is an outstanding login attempt when ExistingUserController is 184 // If there is an outstanding login attempt when ExistingUserController is
184 // deleted, its LoginPerformer instance will be deleted, which in turn 185 // deleted, its LoginPerformer instance will be deleted, which in turn
185 // deletes its OnlineAttemptHost instance. However, OnlineAttemptHost must 186 // deletes its OnlineAttemptHost instance. However, OnlineAttemptHost must
186 // be deleted on the UI thread. 187 // be deleted on the UI thread.
187 existing_user_controller_.reset(); 188 existing_user_controller_.reset();
188 DevicePolicyCrosBrowserTest::InProcessBrowserTest::TearDownOnMainThread(); 189 DevicePolicyCrosBrowserTest::InProcessBrowserTest::TearDownOnMainThread();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 existing_user_controller()->CompleteLogin(user_context); 288 existing_user_controller()->CompleteLogin(user_context);
288 content::RunAllPendingInMessageLoop(); 289 content::RunAllPendingInMessageLoop();
289 } 290 }
290 291
291 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, 292 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest,
292 NewUserDontAutoEnrollAfterSignIn) { 293 NewUserDontAutoEnrollAfterSignIn) {
293 EXPECT_CALL(*mock_login_display_host_, 294 EXPECT_CALL(*mock_login_display_host_,
294 StartWizardPtr(WizardController::kEnrollmentScreenName, 295 StartWizardPtr(WizardController::kEnrollmentScreenName,
295 _)) 296 _))
296 .Times(0); 297 .Times(0);
297 EXPECT_CALL(*mock_login_display_host_,
298 StartWizardPtr(WizardController::kTermsOfServiceScreenName,
299 NULL))
300 .Times(1);
301 UserContext user_context(kNewUsername); 298 UserContext user_context(kNewUsername);
302 user_context.SetKey(Key(kPassword)); 299 user_context.SetKey(Key(kPassword));
303 user_context.SetUserIDHash(kNewUsername); 300 user_context.SetUserIDHash(kNewUsername);
304 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) 301 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_))
305 .Times(1) 302 .Times(1)
306 .WillOnce(WithArg<0>(CreateAuthenticator(user_context))); 303 .WillOnce(WithArg<0>(CreateAuthenticator(user_context)));
307 base::Callback<void(void)> add_user_cb = 304 base::Callback<void(void)> add_user_cb =
308 base::Bind(&MockUserManager::AddUser, 305 base::Bind(&MockUserManager::AddUser,
309 base::Unretained(mock_user_manager_), 306 base::Unretained(mock_user_manager_),
310 kNewUsername); 307 kNewUsername);
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 // First run propagates public accounts and stores them in Local State. 678 // First run propagates public accounts and stores them in Local State.
682 } 679 }
683 680
684 // See http://crbug.com/393704; flaky. 681 // See http://crbug.com/393704; flaky.
685 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, 682 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest,
686 DISABLED_TestLoadingPublicUsersFromLocalState) { 683 DISABLED_TestLoadingPublicUsersFromLocalState) {
687 // Second run loads list of public accounts from Local State. 684 // Second run loads list of public accounts from Local State.
688 } 685 }
689 686
690 } // namespace chromeos 687 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698