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

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

Issue 1882243004: Convert //chrome/browser/sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_test_util.h" 5 #include "chrome/browser/sync/profile_sync_test_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "chrome/browser/signin/signin_manager_factory.h" 13 #include "chrome/browser/signin/signin_manager_factory.h"
13 #include "chrome/browser/sync/chrome_sync_client.h" 14 #include "chrome/browser/sync/chrome_sync_client.h"
14 #include "chrome/common/channel_info.h" 15 #include "chrome/common/channel_info.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "components/browser_sync/browser/profile_sync_service.h" 17 #include "components/browser_sync/browser/profile_sync_service.h"
17 #include "components/browser_sync/browser/profile_sync_test_util.h" 18 #include "components/browser_sync/browser/profile_sync_test_util.h"
18 #include "components/signin/core/browser/signin_manager.h" 19 #include "components/signin/core/browser/signin_manager.h"
19 #include "components/sync_driver/signin_manager_wrapper.h" 20 #include "components/sync_driver/signin_manager_wrapper.h"
20 #include "components/sync_driver/startup_controller.h" 21 #include "components/sync_driver/startup_controller.h"
21 #include "components/sync_driver/sync_api_component_factory_mock.h" 22 #include "components/sync_driver/sync_api_component_factory_mock.h"
22 23
23 ProfileSyncService::InitParams CreateProfileSyncServiceParamsForTest( 24 ProfileSyncService::InitParams CreateProfileSyncServiceParamsForTest(
24 Profile* profile) { 25 Profile* profile) {
25 auto sync_client = 26 auto sync_client =
26 make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)); 27 base::WrapUnique(new browser_sync::ChromeSyncClient(profile));
27 28
28 sync_client->SetSyncApiComponentFactoryForTesting( 29 sync_client->SetSyncApiComponentFactoryForTesting(
29 make_scoped_ptr(new SyncApiComponentFactoryMock())); 30 base::WrapUnique(new SyncApiComponentFactoryMock()));
30 31
31 ProfileSyncService::InitParams init_params = 32 ProfileSyncService::InitParams init_params =
32 CreateProfileSyncServiceParamsForTest(std::move(sync_client), profile); 33 CreateProfileSyncServiceParamsForTest(std::move(sync_client), profile);
33 34
34 return init_params; 35 return init_params;
35 } 36 }
36 37
37 ProfileSyncService::InitParams CreateProfileSyncServiceParamsForTest( 38 ProfileSyncService::InitParams CreateProfileSyncServiceParamsForTest(
38 scoped_ptr<sync_driver::SyncClient> sync_client, 39 std::unique_ptr<sync_driver::SyncClient> sync_client,
39 Profile* profile) { 40 Profile* profile) {
40 ProfileSyncService::InitParams init_params; 41 ProfileSyncService::InitParams init_params;
41 42
42 init_params.signin_wrapper = make_scoped_ptr( 43 init_params.signin_wrapper = base::WrapUnique(
43 new SigninManagerWrapper(SigninManagerFactory::GetForProfile(profile))); 44 new SigninManagerWrapper(SigninManagerFactory::GetForProfile(profile)));
44 init_params.oauth2_token_service = 45 init_params.oauth2_token_service =
45 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 46 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
46 init_params.start_behavior = ProfileSyncService::MANUAL_START; 47 init_params.start_behavior = ProfileSyncService::MANUAL_START;
47 init_params.sync_client = std::move(sync_client); 48 init_params.sync_client = std::move(sync_client);
48 init_params.network_time_update_callback = 49 init_params.network_time_update_callback =
49 base::Bind(&browser_sync::EmptyNetworkTimeUpdate); 50 base::Bind(&browser_sync::EmptyNetworkTimeUpdate);
50 init_params.base_directory = profile->GetPath(); 51 init_params.base_directory = profile->GetPath();
51 init_params.url_request_context = profile->GetRequestContext(); 52 init_params.url_request_context = profile->GetRequestContext();
52 init_params.debug_identifier = profile->GetDebugName(); 53 init_params.debug_identifier = profile->GetDebugName();
53 init_params.channel = chrome::GetChannel(); 54 init_params.channel = chrome::GetChannel();
54 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread( 55 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread(
55 content::BrowserThread::DB); 56 content::BrowserThread::DB);
56 init_params.file_thread = 57 init_params.file_thread =
57 content::BrowserThread::GetMessageLoopProxyForThread( 58 content::BrowserThread::GetMessageLoopProxyForThread(
58 content::BrowserThread::FILE); 59 content::BrowserThread::FILE);
59 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); 60 init_params.blocking_pool = content::BrowserThread::GetBlockingPool();
60 61
61 return init_params; 62 return init_params;
62 } 63 }
63 64
64 scoped_ptr<TestingProfile> MakeSignedInTestingProfile() { 65 std::unique_ptr<TestingProfile> MakeSignedInTestingProfile() {
65 auto profile = make_scoped_ptr(new TestingProfile()); 66 auto profile = base::WrapUnique(new TestingProfile());
66 SigninManagerFactory::GetForProfile(profile.get()) 67 SigninManagerFactory::GetForProfile(profile.get())
67 ->SetAuthenticatedAccountInfo("12345", "foo"); 68 ->SetAuthenticatedAccountInfo("12345", "foo");
68 return profile; 69 return profile;
69 } 70 }
70 71
71 scoped_ptr<KeyedService> BuildMockProfileSyncService( 72 std::unique_ptr<KeyedService> BuildMockProfileSyncService(
72 content::BrowserContext* context) { 73 content::BrowserContext* context) {
73 return make_scoped_ptr( 74 return base::WrapUnique(
74 new ProfileSyncServiceMock(CreateProfileSyncServiceParamsForTest( 75 new ProfileSyncServiceMock(CreateProfileSyncServiceParamsForTest(
75 Profile::FromBrowserContext(context)))); 76 Profile::FromBrowserContext(context))));
76 } 77 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_test_util.h ('k') | chrome/browser/sync/sessions/notification_service_sessions_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698