| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "chrome/common/chrome_constants.h" | 46 #include "chrome/common/chrome_constants.h" |
| 47 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
| 48 #include "chrome/common/pref_names.h" | 48 #include "chrome/common/pref_names.h" |
| 49 #include "chrome/common/url_constants.h" | 49 #include "chrome/common/url_constants.h" |
| 50 #include "chrome/test/base/history_index_restore_observer.h" | 50 #include "chrome/test/base/history_index_restore_observer.h" |
| 51 #include "chrome/test/base/testing_pref_service_syncable.h" | 51 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 52 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 52 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 53 #include "components/bookmarks/browser/bookmark_model.h" | 53 #include "components/bookmarks/browser/bookmark_model.h" |
| 54 #include "components/bookmarks/common/bookmark_constants.h" | 54 #include "components/bookmarks/common/bookmark_constants.h" |
| 55 #include "components/content_settings/core/browser/host_content_settings_map.h" | 55 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 56 #include "components/history/content/browser/history_database_helper.h" |
| 56 #include "components/history/core/browser/history_constants.h" | 57 #include "components/history/core/browser/history_constants.h" |
| 58 #include "components/history/core/browser/history_database_params.h" |
| 57 #include "components/history/core/browser/history_db_task.h" | 59 #include "components/history/core/browser/history_db_task.h" |
| 58 #include "components/history/core/browser/top_sites_observer.h" | 60 #include "components/history/core/browser/top_sites_observer.h" |
| 59 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 61 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 60 #include "components/policy/core/common/policy_service.h" | 62 #include "components/policy/core/common/policy_service.h" |
| 61 #include "components/user_prefs/user_prefs.h" | 63 #include "components/user_prefs/user_prefs.h" |
| 62 #include "components/webdata_services/web_data_service_wrapper.h" | 64 #include "components/webdata_services/web_data_service_wrapper.h" |
| 63 #include "content/public/browser/browser_thread.h" | 65 #include "content/public/browser/browser_thread.h" |
| 64 #include "content/public/browser/cookie_store_factory.h" | 66 #include "content/public/browser/cookie_store_factory.h" |
| 65 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
| 66 #include "content/public/browser/render_process_host.h" | 68 #include "content/public/browser/render_process_host.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 if (delete_file) { | 526 if (delete_file) { |
| 525 base::FilePath path = GetPath(); | 527 base::FilePath path = GetPath(); |
| 526 path = path.Append(history::kHistoryFilename); | 528 path = path.Append(history::kHistoryFilename); |
| 527 if (!base::DeleteFile(path, false) || base::PathExists(path)) | 529 if (!base::DeleteFile(path, false) || base::PathExists(path)) |
| 528 return false; | 530 return false; |
| 529 } | 531 } |
| 530 // This will create and init the history service. | 532 // This will create and init the history service. |
| 531 HistoryService* history_service = static_cast<HistoryService*>( | 533 HistoryService* history_service = static_cast<HistoryService*>( |
| 532 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 534 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 533 this, BuildHistoryService)); | 535 this, BuildHistoryService)); |
| 534 if (!history_service->Init(this->GetPath(), no_db)) { | 536 if (!history_service->Init( |
| 537 no_db, history::HistoryDatabaseParamsForPath(this->GetPath()))) { |
| 535 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); | 538 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); |
| 536 } | 539 } |
| 537 // Disable WebHistoryService by default, since it makes network requests. | 540 // Disable WebHistoryService by default, since it makes network requests. |
| 538 WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, NULL); | 541 WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, NULL); |
| 539 return true; | 542 return true; |
| 540 } | 543 } |
| 541 | 544 |
| 542 void TestingProfile::DestroyHistoryService() { | 545 void TestingProfile::DestroyHistoryService() { |
| 543 // TODO(sdefresne): remove this once ChromeHistoryClient is no longer an | 546 // TODO(sdefresne): remove this once ChromeHistoryClient is no longer an |
| 544 // HistoryServiceObserver, http://crbug.com/373326 | 547 // HistoryServiceObserver, http://crbug.com/373326 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 #if defined(ENABLE_EXTENSIONS) | 1068 #if defined(ENABLE_EXTENSIONS) |
| 1066 extension_policy_, | 1069 extension_policy_, |
| 1067 #endif | 1070 #endif |
| 1068 pref_service_.Pass(), | 1071 pref_service_.Pass(), |
| 1069 original_profile, | 1072 original_profile, |
| 1070 guest_session_, | 1073 guest_session_, |
| 1071 supervised_user_id_, | 1074 supervised_user_id_, |
| 1072 policy_service_.Pass(), | 1075 policy_service_.Pass(), |
| 1073 testing_factories_); | 1076 testing_factories_); |
| 1074 } | 1077 } |
| OLD | NEW |