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