| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/favicon/favicon_service_factory.h" | 28 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 29 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 29 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 30 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_facto
ry.h" | 30 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_facto
ry.h" |
| 31 #include "chrome/browser/history/history_backend.h" | 31 #include "chrome/browser/history/history_backend.h" |
| 32 #include "chrome/browser/history/history_db_task.h" | 32 #include "chrome/browser/history/history_db_task.h" |
| 33 #include "chrome/browser/history/history_service.h" | 33 #include "chrome/browser/history/history_service.h" |
| 34 #include "chrome/browser/history/history_service_factory.h" | 34 #include "chrome/browser/history/history_service_factory.h" |
| 35 #include "chrome/browser/history/shortcuts_backend.h" | 35 #include "chrome/browser/history/shortcuts_backend.h" |
| 36 #include "chrome/browser/history/shortcuts_backend_factory.h" | 36 #include "chrome/browser/history/shortcuts_backend_factory.h" |
| 37 #include "chrome/browser/history/top_sites.h" | 37 #include "chrome/browser/history/top_sites.h" |
| 38 #include "chrome/browser/history/web_history_service_factory.h" |
| 38 #include "chrome/browser/net/proxy_service_factory.h" | 39 #include "chrome/browser/net/proxy_service_factory.h" |
| 39 #include "chrome/browser/notifications/desktop_notification_service.h" | 40 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 40 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 41 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 41 #include "chrome/browser/prefs/browser_prefs.h" | 42 #include "chrome/browser/prefs/browser_prefs.h" |
| 42 #include "chrome/browser/prefs/pref_service_syncable.h" | 43 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 43 #include "chrome/browser/prerender/prerender_manager.h" | 44 #include "chrome/browser/prerender/prerender_manager.h" |
| 44 #include "chrome/browser/profiles/profile_dependency_manager.h" | 45 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 45 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 46 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
| 46 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" | 47 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
| 47 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" | 48 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 340 } |
| 340 // This will create and init the history service. | 341 // This will create and init the history service. |
| 341 HistoryService* history_service = static_cast<HistoryService*>( | 342 HistoryService* history_service = static_cast<HistoryService*>( |
| 342 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 343 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 343 this, BuildHistoryService)); | 344 this, BuildHistoryService)); |
| 344 if (!history_service->Init(this->GetPath(), | 345 if (!history_service->Init(this->GetPath(), |
| 345 BookmarkModelFactory::GetForProfile(this), | 346 BookmarkModelFactory::GetForProfile(this), |
| 346 no_db)) { | 347 no_db)) { |
| 347 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); | 348 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); |
| 348 } | 349 } |
| 350 // Disable WebHistoryService by default, since it makes network requests. |
| 351 WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, NULL); |
| 349 } | 352 } |
| 350 | 353 |
| 351 void TestingProfile::DestroyHistoryService() { | 354 void TestingProfile::DestroyHistoryService() { |
| 352 HistoryService* history_service = | 355 HistoryService* history_service = |
| 353 HistoryServiceFactory::GetForProfileWithoutCreating(this); | 356 HistoryServiceFactory::GetForProfileWithoutCreating(this); |
| 354 if (!history_service) | 357 if (!history_service) |
| 355 return; | 358 return; |
| 356 | 359 |
| 357 history_service->NotifyRenderProcessHostDestruction(0); | 360 history_service->NotifyRenderProcessHostDestruction(0); |
| 358 history_service->SetOnBackendDestroyTask(MessageLoop::QuitClosure()); | 361 history_service->SetOnBackendDestroyTask(MessageLoop::QuitClosure()); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 | 782 |
| 780 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 783 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
| 781 DCHECK(!build_called_); | 784 DCHECK(!build_called_); |
| 782 build_called_ = true; | 785 build_called_ = true; |
| 783 return scoped_ptr<TestingProfile>(new TestingProfile( | 786 return scoped_ptr<TestingProfile>(new TestingProfile( |
| 784 path_, | 787 path_, |
| 785 delegate_, | 788 delegate_, |
| 786 extension_policy_, | 789 extension_policy_, |
| 787 pref_service_.Pass())); | 790 pref_service_.Pass())); |
| 788 } | 791 } |
| OLD | NEW |