| 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 24 matching lines...) Expand all Loading... |
| 35 #include "chrome/browser/policy/profile_policy_connector.h" | 35 #include "chrome/browser/policy/profile_policy_connector.h" |
| 36 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 36 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 37 #include "chrome/browser/prefs/browser_prefs.h" | 37 #include "chrome/browser/prefs/browser_prefs.h" |
| 38 #include "chrome/browser/prefs/pref_service_syncable.h" | 38 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 39 #include "chrome/browser/prerender/prerender_manager.h" | 39 #include "chrome/browser/prerender/prerender_manager.h" |
| 40 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 40 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
| 41 #include "chrome/browser/profiles/profile_manager.h" | 41 #include "chrome/browser/profiles/profile_manager.h" |
| 42 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 42 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
| 43 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" | 43 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
| 44 #include "chrome/browser/sync/glue/sync_start_util.h" | 44 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 45 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 45 #include "chrome/browser/webdata/web_data_service_factory.h" | 46 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 46 #include "chrome/common/chrome_constants.h" | 47 #include "chrome/common/chrome_constants.h" |
| 47 #include "chrome/common/chrome_switches.h" | 48 #include "chrome/common/chrome_switches.h" |
| 48 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
| 49 #include "chrome/common/url_constants.h" | 50 #include "chrome/common/url_constants.h" |
| 50 #include "chrome/test/base/history_index_restore_observer.h" | 51 #include "chrome/test/base/history_index_restore_observer.h" |
| 51 #include "chrome/test/base/testing_pref_service_syncable.h" | 52 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 52 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 53 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 53 #include "components/bookmarks/browser/bookmark_model.h" | 54 #include "components/bookmarks/browser/bookmark_model.h" |
| 54 #include "components/bookmarks/common/bookmark_constants.h" | 55 #include "components/bookmarks/common/bookmark_constants.h" |
| 55 #include "components/content_settings/core/browser/host_content_settings_map.h" | 56 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 56 #include "components/history/core/browser/history_constants.h" | 57 #include "components/history/core/browser/history_constants.h" |
| 57 #include "components/history/core/browser/history_db_task.h" | 58 #include "components/history/core/browser/history_db_task.h" |
| 58 #include "components/history/core/browser/top_sites_observer.h" | 59 #include "components/history/core/browser/top_sites_observer.h" |
| 59 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 60 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 60 #include "components/policy/core/common/policy_service.h" | 61 #include "components/policy/core/common/policy_service.h" |
| 62 #include "components/ui/zoom/zoom_event_manager.h" |
| 61 #include "components/user_prefs/user_prefs.h" | 63 #include "components/user_prefs/user_prefs.h" |
| 62 #include "components/webdata_services/web_data_service_wrapper.h" | 64 #include "components/webdata_services/web_data_service_wrapper.h" |
| 63 #include "content/public/browser/browser_thread.h" | 65 #include "content/public/browser/browser_thread.h" |
| 64 #include "content/public/browser/cookie_store_factory.h" | 66 #include "content/public/browser/cookie_store_factory.h" |
| 65 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
| 66 #include "content/public/browser/render_process_host.h" | 68 #include "content/public/browser/render_process_host.h" |
| 67 #include "content/public/browser/storage_partition.h" | 69 #include "content/public/browser/storage_partition.h" |
| 70 #include "content/public/browser/zoom_level_delegate.h" |
| 68 #include "content/public/test/mock_resource_context.h" | 71 #include "content/public/test/mock_resource_context.h" |
| 69 #include "content/public/test/test_utils.h" | 72 #include "content/public/test/test_utils.h" |
| 70 #include "extensions/common/constants.h" | 73 #include "extensions/common/constants.h" |
| 71 #include "net/cookies/cookie_monster.h" | 74 #include "net/cookies/cookie_monster.h" |
| 72 #include "net/url_request/url_request_context.h" | 75 #include "net/url_request/url_request_context.h" |
| 73 #include "net/url_request/url_request_context_getter.h" | 76 #include "net/url_request/url_request_context_getter.h" |
| 74 #include "net/url_request/url_request_test_util.h" | 77 #include "net/url_request/url_request_test_util.h" |
| 75 #include "testing/gmock/include/gmock/gmock.h" | 78 #include "testing/gmock/include/gmock/gmock.h" |
| 76 | 79 |
| 77 #if defined(ENABLE_CONFIGURATION_POLICY) | 80 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 void TestingProfile::SetGuestSession(bool guest) { | 645 void TestingProfile::SetGuestSession(bool guest) { |
| 643 guest_session_ = guest; | 646 guest_session_ = guest; |
| 644 } | 647 } |
| 645 | 648 |
| 646 base::FilePath TestingProfile::GetPath() const { | 649 base::FilePath TestingProfile::GetPath() const { |
| 647 return profile_path_; | 650 return profile_path_; |
| 648 } | 651 } |
| 649 | 652 |
| 650 scoped_ptr<content::ZoomLevelDelegate> TestingProfile::CreateZoomLevelDelegate( | 653 scoped_ptr<content::ZoomLevelDelegate> TestingProfile::CreateZoomLevelDelegate( |
| 651 const base::FilePath& partition_path) { | 654 const base::FilePath& partition_path) { |
| 652 return nullptr; | 655 return make_scoped_ptr(new chrome::ChromeZoomLevelPrefs( |
| 656 GetPrefs(), GetPath(), partition_path, |
| 657 ui_zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr())); |
| 653 } | 658 } |
| 654 | 659 |
| 655 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { | 660 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { |
| 656 return base::MessageLoop::current()->message_loop_proxy(); | 661 return base::MessageLoop::current()->message_loop_proxy(); |
| 657 } | 662 } |
| 658 | 663 |
| 659 TestingPrefServiceSyncable* TestingProfile::GetTestingPrefService() { | 664 TestingPrefServiceSyncable* TestingProfile::GetTestingPrefService() { |
| 660 DCHECK(prefs_); | 665 DCHECK(prefs_); |
| 661 DCHECK(testing_prefs_); | 666 DCHECK(testing_prefs_); |
| 662 return testing_prefs_; | 667 return testing_prefs_; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 this, profile_policy_connector_.get()); | 792 this, profile_policy_connector_.get()); |
| 788 CHECK_EQ(profile_policy_connector_.get(), | 793 CHECK_EQ(profile_policy_connector_.get(), |
| 789 policy::ProfilePolicyConnectorFactory::GetForProfile(this)); | 794 policy::ProfilePolicyConnectorFactory::GetForProfile(this)); |
| 790 } | 795 } |
| 791 | 796 |
| 792 PrefService* TestingProfile::GetPrefs() { | 797 PrefService* TestingProfile::GetPrefs() { |
| 793 DCHECK(prefs_); | 798 DCHECK(prefs_); |
| 794 return prefs_.get(); | 799 return prefs_.get(); |
| 795 } | 800 } |
| 796 | 801 |
| 802 chrome::ChromeZoomLevelPrefs* TestingProfile::GetZoomLevelPrefs() { |
| 803 return static_cast<chrome::ChromeZoomLevelPrefs*>( |
| 804 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); |
| 805 } |
| 806 |
| 797 history::TopSites* TestingProfile::GetTopSites() { | 807 history::TopSites* TestingProfile::GetTopSites() { |
| 798 return top_sites_.get(); | 808 return top_sites_.get(); |
| 799 } | 809 } |
| 800 | 810 |
| 801 history::TopSites* TestingProfile::GetTopSitesWithoutCreating() { | 811 history::TopSites* TestingProfile::GetTopSitesWithoutCreating() { |
| 802 return top_sites_.get(); | 812 return top_sites_.get(); |
| 803 } | 813 } |
| 804 | 814 |
| 805 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 815 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
| 806 return NULL; | 816 return NULL; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 #if defined(ENABLE_EXTENSIONS) | 1074 #if defined(ENABLE_EXTENSIONS) |
| 1065 extension_policy_, | 1075 extension_policy_, |
| 1066 #endif | 1076 #endif |
| 1067 pref_service_.Pass(), | 1077 pref_service_.Pass(), |
| 1068 original_profile, | 1078 original_profile, |
| 1069 guest_session_, | 1079 guest_session_, |
| 1070 supervised_user_id_, | 1080 supervised_user_id_, |
| 1071 policy_service_.Pass(), | 1081 policy_service_.Pass(), |
| 1072 testing_factories_); | 1082 testing_factories_); |
| 1073 } | 1083 } |
| OLD | NEW |