| 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 <utility> | 7 #include <utility> |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 42 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
| 43 #include "chrome/browser/profiles/profile_manager.h" | 43 #include "chrome/browser/profiles/profile_manager.h" |
| 44 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 44 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
| 45 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" | 45 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
| 46 #include "chrome/browser/search_engines/template_url_service_factory.h" | 46 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 47 #include "chrome/browser/sync/glue/sync_start_util.h" | 47 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 48 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | 48 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 49 #include "chrome/browser/web_data_service_factory.h" | 49 #include "chrome/browser/web_data_service_factory.h" |
| 50 #include "chrome/common/chrome_constants.h" | 50 #include "chrome/common/chrome_constants.h" |
| 51 #include "chrome/common/chrome_switches.h" | 51 #include "chrome/common/chrome_switches.h" |
| 52 #include "chrome/common/features.h" |
| 52 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
| 53 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
| 54 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 55 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 55 #include "components/bookmarks/browser/bookmark_model.h" | 56 #include "components/bookmarks/browser/bookmark_model.h" |
| 56 #include "components/bookmarks/common/bookmark_constants.h" | 57 #include "components/bookmarks/common/bookmark_constants.h" |
| 57 #include "components/content_settings/core/browser/host_content_settings_map.h" | 58 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 58 #include "components/favicon/core/fallback_icon_service.h" | 59 #include "components/favicon/core/fallback_icon_service.h" |
| 59 #include "components/favicon/core/favicon_service.h" | 60 #include "components/favicon/core/favicon_service.h" |
| 60 #include "components/history/content/browser/content_visit_delegate.h" | 61 #include "components/history/content/browser/content_visit_delegate.h" |
| 61 #include "components/history/content/browser/history_database_helper.h" | 62 #include "components/history/content/browser/history_database_helper.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" | 118 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" |
| 118 #endif | 119 #endif |
| 119 | 120 |
| 120 #if defined(ENABLE_SUPERVISED_USERS) | 121 #if defined(ENABLE_SUPERVISED_USERS) |
| 121 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 122 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 122 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" | 123 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" |
| 123 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 124 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
| 124 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 125 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
| 125 #endif | 126 #endif |
| 126 | 127 |
| 128 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 129 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 130 #endif |
| 131 |
| 127 using base::Time; | 132 using base::Time; |
| 128 using bookmarks::BookmarkModel; | 133 using bookmarks::BookmarkModel; |
| 129 using content::BrowserThread; | 134 using content::BrowserThread; |
| 130 using content::DownloadManagerDelegate; | 135 using content::DownloadManagerDelegate; |
| 131 using testing::NiceMock; | 136 using testing::NiceMock; |
| 132 using testing::Return; | 137 using testing::Return; |
| 133 | 138 |
| 134 namespace { | 139 namespace { |
| 135 | 140 |
| 136 // Default profile name | 141 // Default profile name |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 base::ThreadTaskRunnerHandle::Get()->PostTask( | 608 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 604 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 609 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 605 base::RunLoop().Run(); | 610 base::RunLoop().Run(); |
| 606 } | 611 } |
| 607 | 612 |
| 608 void TestingProfile::CreateBookmarkModel(bool delete_file) { | 613 void TestingProfile::CreateBookmarkModel(bool delete_file) { |
| 609 if (delete_file) { | 614 if (delete_file) { |
| 610 base::FilePath path = GetPath().Append(bookmarks::kBookmarksFileName); | 615 base::FilePath path = GetPath().Append(bookmarks::kBookmarksFileName); |
| 611 base::DeleteFile(path, false); | 616 base::DeleteFile(path, false); |
| 612 } | 617 } |
| 618 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 619 offline_pages::OfflinePageModelFactory::GetInstance()->SetTestingFactory( |
| 620 this, offline_pages::OfflinePageModelFactory::GetMockFactory()); |
| 621 #endif |
| 613 ManagedBookmarkServiceFactory::GetInstance()->SetTestingFactory( | 622 ManagedBookmarkServiceFactory::GetInstance()->SetTestingFactory( |
| 614 this, ManagedBookmarkServiceFactory::GetDefaultFactory()); | 623 this, ManagedBookmarkServiceFactory::GetDefaultFactory()); |
| 615 // This creates the BookmarkModel. | 624 // This creates the BookmarkModel. |
| 616 ignore_result(BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( | 625 ignore_result(BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( |
| 617 this, BuildBookmarkModel)); | 626 this, BuildBookmarkModel)); |
| 618 } | 627 } |
| 619 | 628 |
| 620 void TestingProfile::CreateWebDataService() { | 629 void TestingProfile::CreateWebDataService() { |
| 621 WebDataServiceFactory::GetInstance()->SetTestingFactory( | 630 WebDataServiceFactory::GetInstance()->SetTestingFactory( |
| 622 this, BuildWebDataService); | 631 this, BuildWebDataService); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 // Note: Owned by |original_profile|. | 1082 // Note: Owned by |original_profile|. |
| 1074 return new TestingProfile(path_, delegate_, | 1083 return new TestingProfile(path_, delegate_, |
| 1075 #if defined(ENABLE_EXTENSIONS) | 1084 #if defined(ENABLE_EXTENSIONS) |
| 1076 extension_policy_, | 1085 extension_policy_, |
| 1077 #endif | 1086 #endif |
| 1078 std::move(pref_service_), original_profile, | 1087 std::move(pref_service_), original_profile, |
| 1079 guest_session_, supervised_user_id_, | 1088 guest_session_, supervised_user_id_, |
| 1080 std::move(policy_service_), testing_factories_, | 1089 std::move(policy_service_), testing_factories_, |
| 1081 profile_name_); | 1090 profile_name_); |
| 1082 } | 1091 } |
| OLD | NEW |