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

Side by Side Diff: chrome/browser/sync/profile_sync_service_mock.cc

Issue 1422773004: [sync] Abstract most ProfileSyncService //chrome deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pss_chrome_signin_deps
Patch Set: Response to review Created 5 years, 1 month 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/sync/profile_sync_service_mock.h" 5 #include "chrome/browser/sync/profile_sync_service_mock.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/prefs/testing_pref_store.h" 8 #include "base/prefs/testing_pref_store.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/browser/sync/chrome_sync_client.h" 11 #include "chrome/browser/sync/chrome_sync_client.h"
12 #include "chrome/browser/sync/profile_sync_test_util.h" 12 #include "chrome/browser/sync/profile_sync_test_util.h"
13 #include "chrome/common/channel_info.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "components/signin/core/browser/profile_oauth2_token_service.h" 17 #include "components/signin/core/browser/profile_oauth2_token_service.h"
17 #include "components/signin/core/browser/signin_manager.h" 18 #include "components/signin/core/browser/signin_manager.h"
18 #include "components/sync_driver/signin_manager_wrapper.h" 19 #include "components/sync_driver/signin_manager_wrapper.h"
19 #include "components/sync_driver/sync_api_component_factory_mock.h" 20 #include "components/sync_driver/sync_api_component_factory_mock.h"
20 21
21 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile) 22 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile)
22 : ProfileSyncServiceMock( 23 : ProfileSyncServiceMock(
23 make_scoped_ptr( 24 make_scoped_ptr(
24 new browser_sync::ChromeSyncClient( 25 new browser_sync::ChromeSyncClient(
25 profile, 26 profile,
26 make_scoped_ptr(new SyncApiComponentFactoryMock()))) 27 make_scoped_ptr(new SyncApiComponentFactoryMock())))
27 .Pass(), 28 .Pass(),
28 profile) {} 29 profile) {}
29 30
30 ProfileSyncServiceMock::ProfileSyncServiceMock( 31 ProfileSyncServiceMock::ProfileSyncServiceMock(
31 scoped_ptr<sync_driver::SyncClient> sync_client, 32 scoped_ptr<sync_driver::SyncClient> sync_client,
32 Profile* profile) 33 Profile* profile)
33 : ProfileSyncService( 34 : ProfileSyncService(
34 sync_client.Pass(), 35 sync_client.Pass(),
35 profile, 36 profile,
36 make_scoped_ptr(new SigninManagerWrapper( 37 make_scoped_ptr(new SigninManagerWrapper(
37 SigninManagerFactory::GetForProfile(profile))), 38 SigninManagerFactory::GetForProfile(profile))),
38 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 39 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
39 browser_sync::MANUAL_START, 40 browser_sync::MANUAL_START,
40 base::Bind(&EmptyNetworkTimeUpdate)) { 41 base::Bind(&EmptyNetworkTimeUpdate),
42 profile->GetPath(),
43 profile->GetRequestContext(),
44 profile->GetDebugName(),
45 chrome::GetChannel(),
46 content::BrowserThread::GetMessageLoopProxyForThread(
47 content::BrowserThread::DB),
48 content::BrowserThread::GetMessageLoopProxyForThread(
49 content::BrowserThread::FILE),
50 content::BrowserThread::GetBlockingPool()) {
41 ON_CALL(*this, IsSyncRequested()).WillByDefault(testing::Return(true)); 51 ON_CALL(*this, IsSyncRequested()).WillByDefault(testing::Return(true));
42 } 52 }
43 53
44 ProfileSyncServiceMock::~ProfileSyncServiceMock() { 54 ProfileSyncServiceMock::~ProfileSyncServiceMock() {
45 } 55 }
46 56
47 // static 57 // static
48 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { 58 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() {
49 TestingProfile* profile = new TestingProfile(); 59 TestingProfile* profile = new TestingProfile();
50 SigninManagerFactory::GetForProfile(profile)-> 60 SigninManagerFactory::GetForProfile(profile)->
51 SetAuthenticatedAccountInfo("12345", "foo"); 61 SetAuthenticatedAccountInfo("12345", "foo");
52 return profile; 62 return profile;
53 } 63 }
54 64
55 // static 65 // static
56 scoped_ptr<KeyedService> ProfileSyncServiceMock::BuildMockProfileSyncService( 66 scoped_ptr<KeyedService> ProfileSyncServiceMock::BuildMockProfileSyncService(
57 content::BrowserContext* profile) { 67 content::BrowserContext* profile) {
58 return make_scoped_ptr( 68 return make_scoped_ptr(
59 new ProfileSyncServiceMock(static_cast<Profile*>(profile))); 69 new ProfileSyncServiceMock(static_cast<Profile*>(profile)));
60 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698