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 "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 scoped_ptr<net::URLRequestContext> context_; | 209 scoped_ptr<net::URLRequestContext> context_; |
210 }; | 210 }; |
211 | 211 |
212 #if defined(ENABLE_NOTIFICATIONS) | 212 #if defined(ENABLE_NOTIFICATIONS) |
213 KeyedService* CreateTestDesktopNotificationService( | 213 KeyedService* CreateTestDesktopNotificationService( |
214 content::BrowserContext* profile) { | 214 content::BrowserContext* profile) { |
215 return new DesktopNotificationService(static_cast<Profile*>(profile)); | 215 return new DesktopNotificationService(static_cast<Profile*>(profile)); |
216 } | 216 } |
217 #endif | 217 #endif |
218 | 218 |
219 KeyedService* BuildFallbackIconService(content::BrowserContext* context) { | |
220 Profile* profile = Profile::FromBrowserContext(context); | |
221 return new FallbackIconService( | |
222 ChromeFallbackIconClientFactory::GetForBrowserContext(profile)); | |
223 } | |
224 | |
225 KeyedService* BuildFaviconService(content::BrowserContext* context) { | 219 KeyedService* BuildFaviconService(content::BrowserContext* context) { |
226 Profile* profile = Profile::FromBrowserContext(context); | 220 Profile* profile = Profile::FromBrowserContext(context); |
227 return new favicon::FaviconService( | 221 return new favicon::FaviconService( |
228 ChromeFaviconClientFactory::GetForProfile(profile), | 222 ChromeFaviconClientFactory::GetForProfile(profile), |
229 HistoryServiceFactory::GetForProfile(profile, | 223 HistoryServiceFactory::GetForProfile(profile, |
230 ServiceAccessType::EXPLICIT_ACCESS)); | 224 ServiceAccessType::EXPLICIT_ACCESS)); |
231 } | 225 } |
232 | 226 |
233 KeyedService* BuildHistoryService(content::BrowserContext* context) { | 227 KeyedService* BuildHistoryService(content::BrowserContext* context) { |
234 Profile* profile = Profile::FromBrowserContext(context); | 228 Profile* profile = Profile::FromBrowserContext(context); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 // Failing a post == leaks == heapcheck failure. Make that an immediate test | 567 // Failing a post == leaks == heapcheck failure. Make that an immediate test |
574 // failure. | 568 // failure. |
575 if (resource_context_) { | 569 if (resource_context_) { |
576 CHECK(BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, | 570 CHECK(BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, |
577 resource_context_)); | 571 resource_context_)); |
578 resource_context_ = NULL; | 572 resource_context_ = NULL; |
579 content::RunAllPendingInMessageLoop(BrowserThread::IO); | 573 content::RunAllPendingInMessageLoop(BrowserThread::IO); |
580 } | 574 } |
581 } | 575 } |
582 | 576 |
583 void TestingProfile::CreateFallbackIconService() { | |
584 FaviconServiceFactory::GetInstance()->SetTestingFactory( | |
585 this, BuildFallbackIconService); | |
586 } | |
587 | |
588 void TestingProfile::CreateFaviconService() { | 577 void TestingProfile::CreateFaviconService() { |
589 // It is up to the caller to create the history service if one is needed. | 578 // It is up to the caller to create the history service if one is needed. |
590 FaviconServiceFactory::GetInstance()->SetTestingFactory( | 579 FaviconServiceFactory::GetInstance()->SetTestingFactory( |
591 this, BuildFaviconService); | 580 this, BuildFaviconService); |
592 } | 581 } |
593 | 582 |
594 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { | 583 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { |
595 DestroyHistoryService(); | 584 DestroyHistoryService(); |
596 if (delete_file) { | 585 if (delete_file) { |
597 base::FilePath path = GetPath(); | 586 base::FilePath path = GetPath(); |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 #if defined(ENABLE_EXTENSIONS) | 1131 #if defined(ENABLE_EXTENSIONS) |
1143 extension_policy_, | 1132 extension_policy_, |
1144 #endif | 1133 #endif |
1145 pref_service_.Pass(), | 1134 pref_service_.Pass(), |
1146 original_profile, | 1135 original_profile, |
1147 guest_session_, | 1136 guest_session_, |
1148 supervised_user_id_, | 1137 supervised_user_id_, |
1149 policy_service_.Pass(), | 1138 policy_service_.Pass(), |
1150 testing_factories_); | 1139 testing_factories_); |
1151 } | 1140 } |
OLD | NEW |