| 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 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/policy/schema_registry_service_factory.h" | 40 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 41 #include "chrome/browser/prefs/browser_prefs.h" | 41 #include "chrome/browser/prefs/browser_prefs.h" |
| 42 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 42 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 43 #include "chrome/browser/prerender/prerender_manager.h" | 43 #include "chrome/browser/prerender/prerender_manager.h" |
| 44 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 44 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
| 45 #include "chrome/browser/profiles/profile_manager.h" | 45 #include "chrome/browser/profiles/profile_manager.h" |
| 46 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 46 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
| 47 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" | 47 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
| 48 #include "chrome/browser/search_engines/template_url_service_factory.h" | 48 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 49 #include "chrome/browser/sync/glue/sync_start_util.h" | 49 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 50 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | |
| 51 #include "chrome/browser/web_data_service_factory.h" | 50 #include "chrome/browser/web_data_service_factory.h" |
| 52 #include "chrome/common/chrome_constants.h" | 51 #include "chrome/common/chrome_constants.h" |
| 53 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 54 #include "chrome/common/features.h" | 53 #include "chrome/common/features.h" |
| 55 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 56 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
| 57 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 56 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 58 #include "components/bookmarks/browser/bookmark_model.h" | 57 #include "components/bookmarks/browser/bookmark_model.h" |
| 59 #include "components/bookmarks/common/bookmark_constants.h" | 58 #include "components/bookmarks/common/bookmark_constants.h" |
| 60 #include "components/content_settings/core/browser/host_content_settings_map.h" | 59 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 78 #include "components/policy/core/common/schema.h" | 77 #include "components/policy/core/common/schema.h" |
| 79 #include "components/prefs/testing_pref_store.h" | 78 #include "components/prefs/testing_pref_store.h" |
| 80 #include "components/proxy_config/pref_proxy_config_tracker.h" | 79 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 81 #include "components/sync/model/fake_sync_change_processor.h" | 80 #include "components/sync/model/fake_sync_change_processor.h" |
| 82 #include "components/sync/model/sync_error_factory_mock.h" | 81 #include "components/sync/model/sync_error_factory_mock.h" |
| 83 #include "components/sync_preferences/pref_service_mock_factory.h" | 82 #include "components/sync_preferences/pref_service_mock_factory.h" |
| 84 #include "components/sync_preferences/pref_service_syncable.h" | 83 #include "components/sync_preferences/pref_service_syncable.h" |
| 85 #include "components/sync_preferences/testing_pref_service_syncable.h" | 84 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 86 #include "components/user_prefs/user_prefs.h" | 85 #include "components/user_prefs/user_prefs.h" |
| 87 #include "components/webdata_services/web_data_service_wrapper.h" | 86 #include "components/webdata_services/web_data_service_wrapper.h" |
| 88 #include "components/zoom/zoom_event_manager.h" | |
| 89 #include "content/public/browser/browser_thread.h" | 87 #include "content/public/browser/browser_thread.h" |
| 90 #include "content/public/browser/cookie_store_factory.h" | 88 #include "content/public/browser/cookie_store_factory.h" |
| 91 #include "content/public/browser/notification_service.h" | 89 #include "content/public/browser/notification_service.h" |
| 92 #include "content/public/browser/render_process_host.h" | 90 #include "content/public/browser/render_process_host.h" |
| 93 #include "content/public/browser/storage_partition.h" | 91 #include "content/public/browser/storage_partition.h" |
| 94 #include "content/public/browser/zoom_level_delegate.h" | |
| 95 #include "content/public/test/mock_resource_context.h" | 92 #include "content/public/test/mock_resource_context.h" |
| 96 #include "content/public/test/test_utils.h" | 93 #include "content/public/test/test_utils.h" |
| 97 #include "extensions/common/constants.h" | 94 #include "extensions/common/constants.h" |
| 98 #include "extensions/features/features.h" | 95 #include "extensions/features/features.h" |
| 99 #include "net/cookies/cookie_store.h" | 96 #include "net/cookies/cookie_store.h" |
| 100 #include "net/url_request/url_request_context.h" | 97 #include "net/url_request/url_request_context.h" |
| 101 #include "net/url_request/url_request_context_getter.h" | 98 #include "net/url_request/url_request_context_getter.h" |
| 102 #include "net/url_request/url_request_test_util.h" | 99 #include "net/url_request/url_request_test_util.h" |
| 103 #include "testing/gmock/include/gmock/gmock.h" | 100 #include "testing/gmock/include/gmock/gmock.h" |
| 104 | 101 |
| 105 #if BUILDFLAG(ENABLE_EXTENSIONS) | 102 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 106 #include "chrome/browser/extensions/extension_service.h" | 103 #include "chrome/browser/extensions/extension_service.h" |
| 107 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 104 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 108 #include "chrome/browser/extensions/extension_system_factory.h" | 105 #include "chrome/browser/extensions/extension_system_factory.h" |
| 109 #include "chrome/browser/extensions/test_extension_system.h" | 106 #include "chrome/browser/extensions/test_extension_system.h" |
| 110 #include "components/guest_view/browser/guest_view_manager.h" | 107 #include "components/guest_view/browser/guest_view_manager.h" |
| 111 #include "extensions/browser/event_router_factory.h" | 108 #include "extensions/browser/event_router_factory.h" |
| 112 #include "extensions/browser/extension_pref_value_map.h" | 109 #include "extensions/browser/extension_pref_value_map.h" |
| 113 #include "extensions/browser/extension_pref_value_map_factory.h" | 110 #include "extensions/browser/extension_pref_value_map_factory.h" |
| 114 #include "extensions/browser/extension_prefs.h" | 111 #include "extensions/browser/extension_prefs.h" |
| 115 #include "extensions/browser/extension_prefs_factory.h" | 112 #include "extensions/browser/extension_prefs_factory.h" |
| 116 #include "extensions/browser/extension_prefs_observer.h" | 113 #include "extensions/browser/extension_prefs_observer.h" |
| 117 #include "extensions/browser/extension_system.h" | 114 #include "extensions/browser/extension_system.h" |
| 118 #endif | 115 #endif |
| 119 | 116 |
| 120 #if defined(OS_ANDROID) | 117 #if defined(OS_ANDROID) |
| 121 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" | 118 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" |
| 122 #endif | 119 #else // !defined(OS_ANDROID) |
| 120 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 121 #include "components/zoom/zoom_event_manager.h" |
| 122 #include "content/public/browser/zoom_level_delegate.h" |
| 123 #endif // defined(OS_ANDROID) |
| 123 | 124 |
| 124 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 125 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 125 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 126 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 126 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" | 127 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" |
| 127 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 128 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
| 128 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 129 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
| 129 #endif | 130 #endif |
| 130 | 131 |
| 131 #if defined(OS_ANDROID) | 132 #if defined(OS_ANDROID) |
| 132 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 133 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 } | 669 } |
| 669 | 670 |
| 670 void TestingProfile::SetGuestSession(bool guest) { | 671 void TestingProfile::SetGuestSession(bool guest) { |
| 671 guest_session_ = guest; | 672 guest_session_ = guest; |
| 672 } | 673 } |
| 673 | 674 |
| 674 base::FilePath TestingProfile::GetPath() const { | 675 base::FilePath TestingProfile::GetPath() const { |
| 675 return profile_path_; | 676 return profile_path_; |
| 676 } | 677 } |
| 677 | 678 |
| 679 #if !defined(OS_ANDROID) |
| 678 std::unique_ptr<content::ZoomLevelDelegate> | 680 std::unique_ptr<content::ZoomLevelDelegate> |
| 679 TestingProfile::CreateZoomLevelDelegate(const base::FilePath& partition_path) { | 681 TestingProfile::CreateZoomLevelDelegate(const base::FilePath& partition_path) { |
| 680 return base::MakeUnique<ChromeZoomLevelPrefs>( | 682 return base::MakeUnique<ChromeZoomLevelPrefs>( |
| 681 GetPrefs(), GetPath(), partition_path, | 683 GetPrefs(), GetPath(), partition_path, |
| 682 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); | 684 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); |
| 683 } | 685 } |
| 686 #endif // !defined(OS_ANDROID) |
| 684 | 687 |
| 685 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { | 688 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { |
| 686 return base::ThreadTaskRunnerHandle::Get(); | 689 return base::ThreadTaskRunnerHandle::Get(); |
| 687 } | 690 } |
| 688 | 691 |
| 689 sync_preferences::TestingPrefServiceSyncable* | 692 sync_preferences::TestingPrefServiceSyncable* |
| 690 TestingProfile::GetTestingPrefService() { | 693 TestingProfile::GetTestingPrefService() { |
| 691 DCHECK(prefs_); | 694 DCHECK(prefs_); |
| 692 DCHECK(testing_prefs_); | 695 DCHECK(testing_prefs_); |
| 693 return testing_prefs_; | 696 return testing_prefs_; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 PrefService* TestingProfile::GetPrefs() { | 848 PrefService* TestingProfile::GetPrefs() { |
| 846 DCHECK(prefs_); | 849 DCHECK(prefs_); |
| 847 return prefs_.get(); | 850 return prefs_.get(); |
| 848 } | 851 } |
| 849 | 852 |
| 850 const PrefService* TestingProfile::GetPrefs() const { | 853 const PrefService* TestingProfile::GetPrefs() const { |
| 851 DCHECK(prefs_); | 854 DCHECK(prefs_); |
| 852 return prefs_.get(); | 855 return prefs_.get(); |
| 853 } | 856 } |
| 854 | 857 |
| 858 #if !defined(OS_ANDROID) |
| 855 ChromeZoomLevelPrefs* TestingProfile::GetZoomLevelPrefs() { | 859 ChromeZoomLevelPrefs* TestingProfile::GetZoomLevelPrefs() { |
| 856 return static_cast<ChromeZoomLevelPrefs*>( | 860 return static_cast<ChromeZoomLevelPrefs*>( |
| 857 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); | 861 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); |
| 858 } | 862 } |
| 863 #endif // !defined(OS_ANDROID) |
| 859 | 864 |
| 860 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 865 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
| 861 return NULL; | 866 return NULL; |
| 862 } | 867 } |
| 863 | 868 |
| 864 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 869 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
| 865 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 870 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 866 } | 871 } |
| 867 | 872 |
| 868 net::URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { | 873 net::URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 // Note: Owned by |original_profile|. | 1105 // Note: Owned by |original_profile|. |
| 1101 return new TestingProfile(path_, delegate_, | 1106 return new TestingProfile(path_, delegate_, |
| 1102 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1107 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1103 extension_policy_, | 1108 extension_policy_, |
| 1104 #endif | 1109 #endif |
| 1105 std::move(pref_service_), original_profile, | 1110 std::move(pref_service_), original_profile, |
| 1106 guest_session_, supervised_user_id_, | 1111 guest_session_, supervised_user_id_, |
| 1107 std::move(policy_service_), testing_factories_, | 1112 std::move(policy_service_), testing_factories_, |
| 1108 profile_name_); | 1113 profile_name_); |
| 1109 } | 1114 } |
| OLD | NEW |