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

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

Issue 290483003: Tame the proliferation of UserContext constructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 (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 "chrome/browser/chromeos/login/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 DeviceSettingsService::Get()->SetSessionManager( 390 DeviceSettingsService::Get()->SetSessionManager(
391 &device_settings_test_helper, new MockOwnerKeyUtil()); 391 &device_settings_test_helper, new MockOwnerKeyUtil());
392 392
393 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _)) 393 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _))
394 .WillRepeatedly(Return()); 394 .WillRepeatedly(Return());
395 EXPECT_CALL(*mock_async_method_caller_, AsyncGetSanitizedUsername(_, _)) 395 EXPECT_CALL(*mock_async_method_caller_, AsyncGetSanitizedUsername(_, _))
396 .WillRepeatedly(Return()); 396 .WillRepeatedly(Return());
397 397
398 scoped_refptr<Authenticator> authenticator = 398 scoped_refptr<Authenticator> authenticator =
399 LoginUtils::Get()->CreateAuthenticator(this); 399 LoginUtils::Get()->CreateAuthenticator(this);
400 UserContext user_context(username);
401 user_context.SetPassword("password");
402 user_context.SetUserIDHash(username);
400 authenticator->CompleteLogin(ProfileHelper::GetSigninProfile(), 403 authenticator->CompleteLogin(ProfileHelper::GetSigninProfile(),
401 UserContext(username, 404 user_context);
402 "password",
403 std::string(),
404 username)); // username_hash
405 405
406 const bool kUsingOAuth = true;
407 // Setting |kHasCookies| to false prevents ProfileAuthData::Transfer from 406 // Setting |kHasCookies| to false prevents ProfileAuthData::Transfer from
408 // waiting for an IO task before proceeding. 407 // waiting for an IO task before proceeding.
409 const bool kHasCookies = false; 408 const bool kHasCookies = false;
410 const bool kHasActiveSession = false; 409 const bool kHasActiveSession = false;
411 LoginUtils::Get()->PrepareProfile( 410 user_context.SetAuthFlow(UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML);
412 UserContext(username, 411 LoginUtils::Get()->PrepareProfile(user_context,
413 "password", 412 std::string(),
414 std::string(), 413 kHasCookies,
415 username, 414 kHasActiveSession,
416 kUsingOAuth, 415 this);
417 UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML),
418 std::string(), kHasCookies, kHasActiveSession, this);
419 device_settings_test_helper.Flush(); 416 device_settings_test_helper.Flush();
420 RunUntilIdle(); 417 RunUntilIdle();
421 418
422 DeviceSettingsService::Get()->UnsetSessionManager(); 419 DeviceSettingsService::Get()->UnsetSessionManager();
423 } 420 }
424 421
425 net::TestURLFetcher* PrepareOAuthFetcher(const GURL& expected_url) { 422 net::TestURLFetcher* PrepareOAuthFetcher(const GURL& expected_url) {
426 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0); 423 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0);
427 EXPECT_TRUE(fetcher); 424 EXPECT_TRUE(fetcher);
428 if (!fetcher) 425 if (!fetcher)
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 710 }
714 711
715 INSTANTIATE_TEST_CASE_P( 712 INSTANTIATE_TEST_CASE_P(
716 LoginUtilsBlockingLoginTestInstance, 713 LoginUtilsBlockingLoginTestInstance,
717 LoginUtilsBlockingLoginTest, 714 LoginUtilsBlockingLoginTest,
718 testing::Values(0, 1, 2, 3, 4, 5)); 715 testing::Values(0, 1, 2, 3, 4, 5));
719 716
720 } // namespace 717 } // namespace
721 718
722 } // namespace chromeos 719 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698