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

Side by Side Diff: ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.cc

Issue 2732333003: [Sync] ModelTypeStore factory shouldn't require valid PSS to function correctly (Closed)
Patch Set: Address comments Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.h" 5 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "components/browser_sync/profile_sync_service_mock.h" 11 #include "components/browser_sync/profile_sync_service_mock.h"
12 #include "components/browser_sync/profile_sync_test_util.h" 12 #include "components/browser_sync/profile_sync_test_util.h"
13 #include "components/signin/core/browser/profile_oauth2_token_service.h" 13 #include "components/signin/core/browser/profile_oauth2_token_service.h"
14 #include "components/signin/core/browser/signin_manager.h" 14 #include "components/signin/core/browser/signin_manager.h"
15 #include "components/sync/driver/signin_manager_wrapper.h" 15 #include "components/sync/driver/signin_manager_wrapper.h"
16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
17 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h" 17 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
18 #include "ios/chrome/browser/signin/signin_manager_factory.h" 18 #include "ios/chrome/browser/signin/signin_manager_factory.h"
19 #include "ios/chrome/browser/sync/ios_chrome_sync_client.h" 19 #include "ios/chrome/browser/sync/ios_chrome_sync_client.h"
20 #include "ios/chrome/common/channel_info.h" 20 #include "ios/chrome/common/channel_info.h"
21 #include "ios/web/public/web_thread.h"
22 21
23 browser_sync::ProfileSyncService::InitParams 22 browser_sync::ProfileSyncService::InitParams
24 CreateProfileSyncServiceParamsForTest( 23 CreateProfileSyncServiceParamsForTest(
25 std::unique_ptr<syncer::SyncClient> sync_client, 24 std::unique_ptr<syncer::SyncClient> sync_client,
26 ios::ChromeBrowserState* browser_state) { 25 ios::ChromeBrowserState* browser_state) {
27 browser_sync::ProfileSyncService::InitParams init_params; 26 browser_sync::ProfileSyncService::InitParams init_params;
28 27
29 init_params.signin_wrapper = base::MakeUnique<SigninManagerWrapper>( 28 init_params.signin_wrapper = base::MakeUnique<SigninManagerWrapper>(
30 ios::SigninManagerFactory::GetForBrowserState(browser_state)); 29 ios::SigninManagerFactory::GetForBrowserState(browser_state));
31 init_params.oauth2_token_service = 30 init_params.oauth2_token_service =
32 OAuth2TokenServiceFactory::GetForBrowserState(browser_state); 31 OAuth2TokenServiceFactory::GetForBrowserState(browser_state);
33 init_params.start_behavior = browser_sync::ProfileSyncService::MANUAL_START; 32 init_params.start_behavior = browser_sync::ProfileSyncService::MANUAL_START;
34 init_params.sync_client = 33 init_params.sync_client =
35 sync_client ? std::move(sync_client) 34 sync_client ? std::move(sync_client)
36 : base::MakeUnique<IOSChromeSyncClient>(browser_state); 35 : base::MakeUnique<IOSChromeSyncClient>(browser_state);
37 init_params.network_time_update_callback = 36 init_params.network_time_update_callback =
38 base::Bind(&browser_sync::EmptyNetworkTimeUpdate); 37 base::Bind(&browser_sync::EmptyNetworkTimeUpdate);
39 init_params.base_directory = browser_state->GetStatePath(); 38 init_params.base_directory = browser_state->GetStatePath();
40 init_params.url_request_context = browser_state->GetRequestContext(); 39 init_params.url_request_context = browser_state->GetRequestContext();
41 init_params.debug_identifier = browser_state->GetDebugName(); 40 init_params.debug_identifier = browser_state->GetDebugName();
42 init_params.channel = ::GetChannel(); 41 init_params.channel = ::GetChannel();
43 base::SequencedWorkerPool* blocking_pool = web::WebThread::GetBlockingPool();
44 init_params.blocking_task_runner =
45 blocking_pool->GetSequencedTaskRunnerWithShutdownBehavior(
46 blocking_pool->GetSequenceToken(),
47 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
48 42
49 return init_params; 43 return init_params;
50 } 44 }
51 45
52 std::unique_ptr<KeyedService> BuildMockProfileSyncService( 46 std::unique_ptr<KeyedService> BuildMockProfileSyncService(
53 web::BrowserState* context) { 47 web::BrowserState* context) {
54 return base::MakeUnique<browser_sync::ProfileSyncServiceMock>( 48 return base::MakeUnique<browser_sync::ProfileSyncServiceMock>(
55 CreateProfileSyncServiceParamsForTest( 49 CreateProfileSyncServiceParamsForTest(
56 nullptr, ios::ChromeBrowserState::FromBrowserState(context))); 50 nullptr, ios::ChromeBrowserState::FromBrowserState(context)));
57 } 51 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.cc ('k') | ios/chrome/browser/sync/ios_chrome_sync_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698