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

Side by Side Diff: chrome/browser/sync/test/integration/sync_test.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 years, 6 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/sync/test/integration/sync_test.h" 5 #include "chrome/browser/sync/test/integration/sync_test.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "base/process/launch.h" 16 #include "base/process/launch.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
20 #include "base/test/test_timeouts.h" 21 #include "base/test/test_timeouts.h"
21 #include "base/threading/platform_thread.h" 22 #include "base/threading/platform_thread.h"
22 #include "base/values.h" 23 #include "base/values.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 }; 136 };
136 137
137 void SetupNetworkCallback( 138 void SetupNetworkCallback(
138 base::WaitableEvent* done, 139 base::WaitableEvent* done,
139 net::URLRequestContextGetter* url_request_context_getter) { 140 net::URLRequestContextGetter* url_request_context_getter) {
140 url_request_context_getter->GetURLRequestContext()-> 141 url_request_context_getter->GetURLRequestContext()->
141 set_cookie_store(new net::CookieMonster(NULL, NULL)); 142 set_cookie_store(new net::CookieMonster(NULL, NULL));
142 done->Signal(); 143 done->Signal();
143 } 144 }
144 145
145 KeyedService* BuildFakeServerProfileInvalidationProvider( 146 scoped_ptr<KeyedService> BuildFakeServerProfileInvalidationProvider(
146 content::BrowserContext* context) { 147 content::BrowserContext* context) {
147 return new invalidation::ProfileInvalidationProvider( 148 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider(
148 scoped_ptr<invalidation::InvalidationService>( 149 scoped_ptr<invalidation::InvalidationService>(
149 new fake_server::FakeServerInvalidationService)); 150 new fake_server::FakeServerInvalidationService)));
150 } 151 }
151 152
152 KeyedService* BuildP2PProfileInvalidationProvider( 153 scoped_ptr<KeyedService> BuildP2PProfileInvalidationProvider(
153 content::BrowserContext* context, 154 content::BrowserContext* context,
154 syncer::P2PNotificationTarget notification_target) { 155 syncer::P2PNotificationTarget notification_target) {
155 Profile* profile = static_cast<Profile*>(context); 156 Profile* profile = static_cast<Profile*>(context);
156 return new invalidation::ProfileInvalidationProvider( 157 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider(
157 scoped_ptr<invalidation::InvalidationService>( 158 scoped_ptr<invalidation::InvalidationService>(
158 new invalidation::P2PInvalidationService( 159 new invalidation::P2PInvalidationService(
159 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( 160 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider(
160 SigninManagerFactory::GetForProfile(profile), 161 SigninManagerFactory::GetForProfile(profile),
161 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 162 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
162 LoginUIServiceFactory::GetForProfile(profile))), 163 LoginUIServiceFactory::GetForProfile(profile))),
163 profile->GetRequestContext(), 164 profile->GetRequestContext(), notification_target))));
164 notification_target)));
165 } 165 }
166 166
167 KeyedService* BuildSelfNotifyingP2PProfileInvalidationProvider( 167 scoped_ptr<KeyedService> BuildSelfNotifyingP2PProfileInvalidationProvider(
168 content::BrowserContext* context) { 168 content::BrowserContext* context) {
169 return BuildP2PProfileInvalidationProvider(context, syncer::NOTIFY_ALL); 169 return BuildP2PProfileInvalidationProvider(context, syncer::NOTIFY_ALL);
170 } 170 }
171 171
172 KeyedService* BuildRealisticP2PProfileInvalidationProvider( 172 scoped_ptr<KeyedService> BuildRealisticP2PProfileInvalidationProvider(
173 content::BrowserContext* context) { 173 content::BrowserContext* context) {
174 return BuildP2PProfileInvalidationProvider(context, syncer::NOTIFY_OTHERS); 174 return BuildP2PProfileInvalidationProvider(context, syncer::NOTIFY_OTHERS);
175 } 175 }
176 176
177 } // namespace 177 } // namespace
178 178
179 SyncTest::SyncTest(TestType test_type) 179 SyncTest::SyncTest(TestType test_type)
180 : test_type_(test_type), 180 : test_type_(test_type),
181 server_type_(SERVER_TYPE_UNDECIDED), 181 server_type_(SERVER_TYPE_UNDECIDED),
182 num_clients_(-1), 182 num_clients_(-1),
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 content::NotificationService::current()->Notify( 1050 content::NotificationService::current()->Notify(
1051 chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, 1051 chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
1052 content::Source<Profile>(GetProfile(index)), 1052 content::Source<Profile>(GetProfile(index)),
1053 content::Details<const syncer::ModelTypeSet>(&model_types)); 1053 content::Details<const syncer::ModelTypeSet>(&model_types));
1054 } 1054 }
1055 1055
1056 void SyncTest::SetPreexistingPreferencesFileContents( 1056 void SyncTest::SetPreexistingPreferencesFileContents(
1057 const std::string& contents) { 1057 const std::string& contents) {
1058 preexisting_preferences_file_contents_ = contents; 1058 preexisting_preferences_file_contents_ = contents;
1059 } 1059 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698