OLD | NEW |
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/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 class TestExtensionURLRequestContextGetter | 175 class TestExtensionURLRequestContextGetter |
176 : public net::URLRequestContextGetter { | 176 : public net::URLRequestContextGetter { |
177 public: | 177 public: |
178 net::URLRequestContext* GetURLRequestContext() override { | 178 net::URLRequestContext* GetURLRequestContext() override { |
179 if (!context_.get()) | 179 if (!context_.get()) |
180 context_.reset(new TestExtensionURLRequestContext()); | 180 context_.reset(new TestExtensionURLRequestContext()); |
181 return context_.get(); | 181 return context_.get(); |
182 } | 182 } |
183 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 183 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
184 const override { | 184 const override { |
185 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 185 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
186 } | 186 } |
187 | 187 |
188 protected: | 188 protected: |
189 ~TestExtensionURLRequestContextGetter() override {} | 189 ~TestExtensionURLRequestContextGetter() override {} |
190 | 190 |
191 private: | 191 private: |
192 std::unique_ptr<net::URLRequestContext> context_; | 192 std::unique_ptr<net::URLRequestContext> context_; |
193 }; | 193 }; |
194 | 194 |
195 std::unique_ptr<KeyedService> BuildHistoryService( | 195 std::unique_ptr<KeyedService> BuildHistoryService( |
(...skipping 18 matching lines...) Expand all Loading... |
214 in_memory_url_index->Init(); | 214 in_memory_url_index->Init(); |
215 return std::move(in_memory_url_index); | 215 return std::move(in_memory_url_index); |
216 } | 216 } |
217 | 217 |
218 std::unique_ptr<KeyedService> BuildBookmarkModel( | 218 std::unique_ptr<KeyedService> BuildBookmarkModel( |
219 content::BrowserContext* context) { | 219 content::BrowserContext* context) { |
220 Profile* profile = Profile::FromBrowserContext(context); | 220 Profile* profile = Profile::FromBrowserContext(context); |
221 std::unique_ptr<BookmarkModel> bookmark_model( | 221 std::unique_ptr<BookmarkModel> bookmark_model( |
222 new BookmarkModel(base::WrapUnique(new ChromeBookmarkClient( | 222 new BookmarkModel(base::WrapUnique(new ChromeBookmarkClient( |
223 profile, ManagedBookmarkServiceFactory::GetForProfile(profile))))); | 223 profile, ManagedBookmarkServiceFactory::GetForProfile(profile))))); |
224 bookmark_model->Load(profile->GetPrefs(), | 224 bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), |
225 profile->GetPath(), | |
226 profile->GetIOTaskRunner(), | 225 profile->GetIOTaskRunner(), |
227 content::BrowserThread::GetMessageLoopProxyForThread( | 226 content::BrowserThread::GetTaskRunnerForThread( |
228 content::BrowserThread::UI)); | 227 content::BrowserThread::UI)); |
229 return std::move(bookmark_model); | 228 return std::move(bookmark_model); |
230 } | 229 } |
231 | 230 |
232 void TestProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, | 231 void TestProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, |
233 sql::InitStatus status) { | 232 sql::InitStatus status) { |
234 NOTREACHED(); | 233 NOTREACHED(); |
235 } | 234 } |
236 | 235 |
237 std::unique_ptr<KeyedService> BuildWebDataService( | 236 std::unique_ptr<KeyedService> BuildWebDataService( |
238 content::BrowserContext* context) { | 237 content::BrowserContext* context) { |
239 const base::FilePath& context_path = context->GetPath(); | 238 const base::FilePath& context_path = context->GetPath(); |
240 return base::WrapUnique(new WebDataServiceWrapper( | 239 return base::WrapUnique(new WebDataServiceWrapper( |
241 context_path, g_browser_process->GetApplicationLocale(), | 240 context_path, g_browser_process->GetApplicationLocale(), |
242 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 241 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
243 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | 242 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), |
244 sync_start_util::GetFlareForSyncableService(context_path), | 243 sync_start_util::GetFlareForSyncableService(context_path), |
245 &TestProfileErrorCallback)); | 244 &TestProfileErrorCallback)); |
246 } | 245 } |
247 | 246 |
248 } // namespace | 247 } // namespace |
249 | 248 |
250 // static | 249 // static |
251 #if defined(OS_CHROMEOS) | 250 #if defined(OS_CHROMEOS) |
252 // Must be kept in sync with | 251 // Must be kept in sync with |
253 // ChromeBrowserMainPartsChromeos::PreEarlyInitialization. | 252 // ChromeBrowserMainPartsChromeos::PreEarlyInitialization. |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 | 945 |
947 content::BackgroundSyncController* | 946 content::BackgroundSyncController* |
948 TestingProfile::GetBackgroundSyncController() { | 947 TestingProfile::GetBackgroundSyncController() { |
949 return nullptr; | 948 return nullptr; |
950 } | 949 } |
951 | 950 |
952 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( | 951 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( |
953 content::ProtocolHandlerMap* protocol_handlers, | 952 content::ProtocolHandlerMap* protocol_handlers, |
954 content::URLRequestInterceptorScopedVector request_interceptors) { | 953 content::URLRequestInterceptorScopedVector request_interceptors) { |
955 return new net::TestURLRequestContextGetter( | 954 return new net::TestURLRequestContextGetter( |
956 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 955 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
957 } | 956 } |
958 | 957 |
959 net::URLRequestContextGetter* | 958 net::URLRequestContextGetter* |
960 TestingProfile::CreateRequestContextForStoragePartition( | 959 TestingProfile::CreateRequestContextForStoragePartition( |
961 const base::FilePath& partition_path, | 960 const base::FilePath& partition_path, |
962 bool in_memory, | 961 bool in_memory, |
963 content::ProtocolHandlerMap* protocol_handlers, | 962 content::ProtocolHandlerMap* protocol_handlers, |
964 content::URLRequestInterceptorScopedVector request_interceptors) { | 963 content::URLRequestInterceptorScopedVector request_interceptors) { |
965 // We don't test storage partitions here yet, so returning the same dummy | 964 // We don't test storage partitions here yet, so returning the same dummy |
966 // context is sufficient for now. | 965 // context is sufficient for now. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 // Note: Owned by |original_profile|. | 1064 // Note: Owned by |original_profile|. |
1066 return new TestingProfile(path_, delegate_, | 1065 return new TestingProfile(path_, delegate_, |
1067 #if defined(ENABLE_EXTENSIONS) | 1066 #if defined(ENABLE_EXTENSIONS) |
1068 extension_policy_, | 1067 extension_policy_, |
1069 #endif | 1068 #endif |
1070 std::move(pref_service_), original_profile, | 1069 std::move(pref_service_), original_profile, |
1071 guest_session_, supervised_user_id_, | 1070 guest_session_, supervised_user_id_, |
1072 std::move(policy_service_), testing_factories_, | 1071 std::move(policy_service_), testing_factories_, |
1073 profile_name_); | 1072 profile_name_); |
1074 } | 1073 } |
OLD | NEW |