| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 Profile* profile = static_cast<Profile*>(context); | 468 Profile* profile = static_cast<Profile*>(context); |
| 468 HistoryService* history_service = new HistoryService( | 469 HistoryService* history_service = new HistoryService( |
| 469 ChromeHistoryClientFactory::GetForProfile(profile), profile); | 470 ChromeHistoryClientFactory::GetForProfile(profile), profile); |
| 470 return history_service; | 471 return history_service; |
| 471 } | 472 } |
| 472 | 473 |
| 473 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { | 474 bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { |
| 474 DestroyHistoryService(); | 475 DestroyHistoryService(); |
| 475 if (delete_file) { | 476 if (delete_file) { |
| 476 base::FilePath path = GetPath(); | 477 base::FilePath path = GetPath(); |
| 477 path = path.Append(chrome::kHistoryFilename); | 478 path = path.Append(history::kHistoryFilename); |
| 478 if (!base::DeleteFile(path, false) || base::PathExists(path)) | 479 if (!base::DeleteFile(path, false) || base::PathExists(path)) |
| 479 return false; | 480 return false; |
| 480 } | 481 } |
| 481 // This will create and init the history service. | 482 // This will create and init the history service. |
| 482 HistoryService* history_service = static_cast<HistoryService*>( | 483 HistoryService* history_service = static_cast<HistoryService*>( |
| 483 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 484 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 484 this, BuildHistoryService)); | 485 this, BuildHistoryService)); |
| 485 if (!history_service->Init(this->GetPath(), no_db)) { | 486 if (!history_service->Init(this->GetPath(), no_db)) { |
| 486 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); | 487 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); |
| 487 } | 488 } |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 #if defined(ENABLE_EXTENSIONS) | 1037 #if defined(ENABLE_EXTENSIONS) |
| 1037 extension_policy_, | 1038 extension_policy_, |
| 1038 #endif | 1039 #endif |
| 1039 pref_service_.Pass(), | 1040 pref_service_.Pass(), |
| 1040 original_profile, | 1041 original_profile, |
| 1041 guest_session_, | 1042 guest_session_, |
| 1042 supervised_user_id_, | 1043 supervised_user_id_, |
| 1043 policy_service_.Pass(), | 1044 policy_service_.Pass(), |
| 1044 testing_factories_); | 1045 testing_factories_); |
| 1045 } | 1046 } |
| OLD | NEW |