| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "chrome/browser/webdata/web_data_service_factory.h" | 45 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 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/bookmarks/browser/bookmark_model.h" | 52 #include "components/bookmarks/browser/bookmark_model.h" |
| 53 #include "components/bookmarks/common/bookmark_constants.h" | 53 #include "components/bookmarks/common/bookmark_constants.h" |
| 54 #include "components/content_settings/core/browser/host_content_settings_map.h" | 54 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 55 #include "components/history/core/browser/history_constants.h" |
| 55 #include "components/history/core/browser/top_sites_observer.h" | 56 #include "components/history/core/browser/top_sites_observer.h" |
| 56 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 57 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 57 #include "components/policy/core/common/policy_service.h" | 58 #include "components/policy/core/common/policy_service.h" |
| 58 #include "components/user_prefs/user_prefs.h" | 59 #include "components/user_prefs/user_prefs.h" |
| 59 #include "content/public/browser/browser_thread.h" | 60 #include "content/public/browser/browser_thread.h" |
| 60 #include "content/public/browser/cookie_store_factory.h" | 61 #include "content/public/browser/cookie_store_factory.h" |
| 61 #include "content/public/browser/notification_service.h" | 62 #include "content/public/browser/notification_service.h" |
| 62 #include "content/public/browser/render_process_host.h" | 63 #include "content/public/browser/render_process_host.h" |
| 63 #include "content/public/browser/storage_partition.h" | 64 #include "content/public/browser/storage_partition.h" |
| 64 #include "content/public/test/mock_resource_context.h" | 65 #include "content/public/test/mock_resource_context.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 HistoryService* history_service = new HistoryService(history_client, profile); | 471 HistoryService* history_service = new HistoryService(history_client, profile); |
| 471 if (history_client) | 472 if (history_client) |
| 472 history_client->SetHistoryService(history_service); | 473 history_client->SetHistoryService(history_service); |
| 473 return history_service; | 474 return history_service; |
| 474 } | 475 } |
| 475 | 476 |
| 476 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { | 477 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { |
| 477 DestroyHistoryService(); | 478 DestroyHistoryService(); |
| 478 if (delete_file) { | 479 if (delete_file) { |
| 479 base::FilePath path = GetPath(); | 480 base::FilePath path = GetPath(); |
| 480 path = path.Append(chrome::kHistoryFilename); | 481 path = path.Append(history::kHistoryFilename); |
| 481 if (!base::DeleteFile(path, false) || base::PathExists(path)) | 482 if (!base::DeleteFile(path, false) || base::PathExists(path)) |
| 482 return false; | 483 return false; |
| 483 } | 484 } |
| 484 // This will create and init the history service. | 485 // This will create and init the history service. |
| 485 HistoryService* history_service = static_cast<HistoryService*>( | 486 HistoryService* history_service = static_cast<HistoryService*>( |
| 486 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 487 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 487 this, BuildHistoryService)); | 488 this, BuildHistoryService)); |
| 488 if (!history_service->Init(this->GetPath(), no_db)) { | 489 if (!history_service->Init(this->GetPath(), no_db)) { |
| 489 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); | 490 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); |
| 490 } | 491 } |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 #if defined(ENABLE_EXTENSIONS) | 1040 #if defined(ENABLE_EXTENSIONS) |
| 1040 extension_policy_, | 1041 extension_policy_, |
| 1041 #endif | 1042 #endif |
| 1042 pref_service_.Pass(), | 1043 pref_service_.Pass(), |
| 1043 original_profile, | 1044 original_profile, |
| 1044 guest_session_, | 1045 guest_session_, |
| 1045 supervised_user_id_, | 1046 supervised_user_id_, |
| 1046 policy_service_.Pass(), | 1047 policy_service_.Pass(), |
| 1047 testing_factories_); | 1048 testing_factories_); |
| 1048 } | 1049 } |
| OLD | NEW |