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

Side by Side Diff: chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 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
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/ui/webui/options/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 TestingProfile::Builder builder; 269 TestingProfile::Builder builder;
270 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 270 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
271 FakeSigninManagerBase::Build); 271 FakeSigninManagerBase::Build);
272 profile_ = builder.Build(); 272 profile_ = builder.Build();
273 273
274 // Sign in the user. 274 // Sign in the user.
275 mock_signin_ = static_cast<SigninManagerBase*>( 275 mock_signin_ = static_cast<SigninManagerBase*>(
276 SigninManagerFactory::GetForProfile(profile_.get())); 276 SigninManagerFactory::GetForProfile(profile_.get()));
277 std::string username = GetTestUser(); 277 std::string username = GetTestUser();
278 if (!username.empty()) 278 if (!username.empty())
279 mock_signin_->SetAuthenticatedUsername(username); 279 mock_signin_->SetAuthenticatedAccountInfo(username, username);
280 280
281 mock_pss_ = static_cast<ProfileSyncServiceMock*>( 281 mock_pss_ = static_cast<ProfileSyncServiceMock*>(
282 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 282 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
283 profile_.get(), 283 profile_.get(),
284 ProfileSyncServiceMock::BuildMockProfileSyncService)); 284 ProfileSyncServiceMock::BuildMockProfileSyncService));
285 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); 285 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_));
286 ON_CALL(*mock_pss_, GetPassphraseType()).WillByDefault( 286 ON_CALL(*mock_pss_, GetPassphraseType()).WillByDefault(
287 Return(syncer::IMPLICIT_PASSPHRASE)); 287 Return(syncer::IMPLICIT_PASSPHRASE));
288 ON_CALL(*mock_pss_, GetPassphraseTime()).WillByDefault( 288 ON_CALL(*mock_pss_, GetPassphraseTime()).WillByDefault(
289 Return(base::Time())); 289 Return(base::Time()));
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 ExpectConfig(); 858 ExpectConfig();
859 } 859 }
860 860
861 // We do not display signin on chromeos in the case of auth error. 861 // We do not display signin on chromeos in the case of auth error.
862 TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { 862 TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) {
863 // Initialize the system to a signed in state, but with an auth error. 863 // Initialize the system to a signed in state, but with an auth error.
864 error_ = GoogleServiceAuthError( 864 error_ = GoogleServiceAuthError(
865 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 865 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
866 866
867 SetupInitializedProfileSyncService(); 867 SetupInitializedProfileSyncService();
868 mock_signin_->SetAuthenticatedUsername(kTestUser); 868 mock_signin_->SetAuthenticatedAccountInfo(kTestUser, kTestUser);
869 FakeAuthStatusProvider provider( 869 FakeAuthStatusProvider provider(
870 SigninErrorControllerFactory::GetForProfile(profile_.get())); 870 SigninErrorControllerFactory::GetForProfile(profile_.get()));
871 provider.SetAuthError(kTestUser, kTestUser, error_); 871 provider.SetAuthError(kTestUser, kTestUser, error_);
872 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) 872 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
873 .WillRepeatedly(Return(true)); 873 .WillRepeatedly(Return(true));
874 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) 874 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
875 .WillRepeatedly(Return(true)); 875 .WillRepeatedly(Return(true));
876 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) 876 EXPECT_CALL(*mock_pss_, IsPassphraseRequired())
877 .WillRepeatedly(Return(false)); 877 .WillRepeatedly(Return(false));
878 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) 878 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase())
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 WillRepeatedly(Return(false)); 1084 WillRepeatedly(Return(false));
1085 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); 1085 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0);
1086 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); 1086 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _));
1087 handler_->HandleConfigure(&list_args); 1087 handler_->HandleConfigure(&list_args);
1088 1088
1089 // Ensure that we navigated to the "done" state since we don't need a 1089 // Ensure that we navigated to the "done" state since we don't need a
1090 // passphrase. 1090 // passphrase.
1091 ExpectDone(); 1091 ExpectDone();
1092 } 1092 }
1093 1093
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698