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

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

Issue 763673002: Replace direct access to kGoogleServicesUsername with calls to SigninManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nullptr Created 6 years 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 269
270 TestingProfile::Builder builder; 270 TestingProfile::Builder builder;
271 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 271 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
272 FakeSigninManagerBase::Build); 272 FakeSigninManagerBase::Build);
273 profile_ = builder.Build(); 273 profile_ = builder.Build();
274 274
275 // Sign in the user. 275 // Sign in the user.
276 mock_signin_ = static_cast<SigninManagerBase*>( 276 mock_signin_ = static_cast<SigninManagerBase*>(
277 SigninManagerFactory::GetForProfile(profile_.get())); 277 SigninManagerFactory::GetForProfile(profile_.get()));
278 std::string username = GetTestUser(); 278 std::string username = GetTestUser();
279 if (!username.empty()) { 279 if (!username.empty())
280 mock_signin_->SetAuthenticatedUsername(username); 280 mock_signin_->SetAuthenticatedUsername(username);
281 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
282 username);
283 }
284 281
285 mock_pss_ = static_cast<ProfileSyncServiceMock*>( 282 mock_pss_ = static_cast<ProfileSyncServiceMock*>(
286 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 283 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
287 profile_.get(), 284 profile_.get(),
288 ProfileSyncServiceMock::BuildMockProfileSyncService)); 285 ProfileSyncServiceMock::BuildMockProfileSyncService));
289 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); 286 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_));
290 ON_CALL(*mock_pss_, GetPassphraseType()).WillByDefault( 287 ON_CALL(*mock_pss_, GetPassphraseType()).WillByDefault(
291 Return(syncer::IMPLICIT_PASSPHRASE)); 288 Return(syncer::IMPLICIT_PASSPHRASE));
292 ON_CALL(*mock_pss_, GetPassphraseTime()).WillByDefault( 289 ON_CALL(*mock_pss_, GetPassphraseTime()).WillByDefault(
293 Return(base::Time())); 290 Return(base::Time()));
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 WillRepeatedly(Return(false)); 1088 WillRepeatedly(Return(false));
1092 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); 1089 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0);
1093 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); 1090 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _));
1094 handler_->HandleConfigure(&list_args); 1091 handler_->HandleConfigure(&list_args);
1095 1092
1096 // Ensure that we navigated to the "done" state since we don't need a 1093 // Ensure that we navigated to the "done" state since we don't need a
1097 // passphrase. 1094 // passphrase.
1098 ExpectDone(); 1095 ExpectDone();
1099 } 1096 }
1100 1097
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698