| 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/notifications/desktop_notification_service_factory.h" | 35 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 36 #include "chrome/browser/policy/profile_policy_connector.h" | 36 #include "chrome/browser/policy/profile_policy_connector.h" |
| 37 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 37 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 38 #include "chrome/browser/prefs/browser_prefs.h" | 38 #include "chrome/browser/prefs/browser_prefs.h" |
| 39 #include "chrome/browser/prefs/pref_service_syncable.h" | 39 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 40 #include "chrome/browser/prerender/prerender_manager.h" | 40 #include "chrome/browser/prerender/prerender_manager.h" |
| 41 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 41 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
| 42 #include "chrome/browser/profiles/profile_manager.h" | 42 #include "chrome/browser/profiles/profile_manager.h" |
| 43 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 43 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
| 44 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" | 44 #include "chrome/browser/search_engines/template_url_fetcher_factory.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/bookmarks/browser/bookmark_model.h" | 53 #include "components/bookmarks/browser/bookmark_model.h" |
| 53 #include "components/bookmarks/common/bookmark_constants.h" | 54 #include "components/bookmarks/common/bookmark_constants.h" |
| 54 #include "components/content_settings/core/browser/host_content_settings_map.h" | 55 #include "components/content_settings/core/browser/host_content_settings_map.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" |
| 65 #include "content/public/browser/zoom_level_delegate.h" |
| 64 #include "content/public/test/mock_resource_context.h" | 66 #include "content/public/test/mock_resource_context.h" |
| 65 #include "content/public/test/test_utils.h" | 67 #include "content/public/test/test_utils.h" |
| 66 #include "extensions/common/constants.h" | 68 #include "extensions/common/constants.h" |
| 67 #include "net/cookies/cookie_monster.h" | 69 #include "net/cookies/cookie_monster.h" |
| 68 #include "net/url_request/url_request_context.h" | 70 #include "net/url_request/url_request_context.h" |
| 69 #include "net/url_request/url_request_context_getter.h" | 71 #include "net/url_request/url_request_context_getter.h" |
| 70 #include "net/url_request/url_request_test_util.h" | 72 #include "net/url_request/url_request_test_util.h" |
| 71 #include "testing/gmock/include/gmock/gmock.h" | 73 #include "testing/gmock/include/gmock/gmock.h" |
| 72 | 74 |
| 73 #if defined(ENABLE_CONFIGURATION_POLICY) | 75 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 void TestingProfile::SetGuestSession(bool guest) { | 631 void TestingProfile::SetGuestSession(bool guest) { |
| 630 guest_session_ = guest; | 632 guest_session_ = guest; |
| 631 } | 633 } |
| 632 | 634 |
| 633 base::FilePath TestingProfile::GetPath() const { | 635 base::FilePath TestingProfile::GetPath() const { |
| 634 return profile_path_; | 636 return profile_path_; |
| 635 } | 637 } |
| 636 | 638 |
| 637 scoped_ptr<content::ZoomLevelDelegate> TestingProfile::CreateZoomLevelDelegate( | 639 scoped_ptr<content::ZoomLevelDelegate> TestingProfile::CreateZoomLevelDelegate( |
| 638 const base::FilePath& partition_path) { | 640 const base::FilePath& partition_path) { |
| 639 return nullptr; | 641 return make_scoped_ptr( |
| 642 new chrome::ChromeZoomLevelPrefs(GetPrefs(), GetPath(), partition_path)); |
| 640 } | 643 } |
| 641 | 644 |
| 642 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { | 645 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { |
| 643 return base::MessageLoop::current()->message_loop_proxy(); | 646 return base::MessageLoop::current()->message_loop_proxy(); |
| 644 } | 647 } |
| 645 | 648 |
| 646 TestingPrefServiceSyncable* TestingProfile::GetTestingPrefService() { | 649 TestingPrefServiceSyncable* TestingProfile::GetTestingPrefService() { |
| 647 DCHECK(prefs_); | 650 DCHECK(prefs_); |
| 648 DCHECK(testing_prefs_); | 651 DCHECK(testing_prefs_); |
| 649 return testing_prefs_; | 652 return testing_prefs_; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 this, profile_policy_connector_.get()); | 765 this, profile_policy_connector_.get()); |
| 763 CHECK_EQ(profile_policy_connector_.get(), | 766 CHECK_EQ(profile_policy_connector_.get(), |
| 764 policy::ProfilePolicyConnectorFactory::GetForProfile(this)); | 767 policy::ProfilePolicyConnectorFactory::GetForProfile(this)); |
| 765 } | 768 } |
| 766 | 769 |
| 767 PrefService* TestingProfile::GetPrefs() { | 770 PrefService* TestingProfile::GetPrefs() { |
| 768 DCHECK(prefs_); | 771 DCHECK(prefs_); |
| 769 return prefs_.get(); | 772 return prefs_.get(); |
| 770 } | 773 } |
| 771 | 774 |
| 775 chrome::ChromeZoomLevelPrefs* TestingProfile::GetZoomLevelPrefs() { |
| 776 return static_cast<chrome::ChromeZoomLevelPrefs*>( |
| 777 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); |
| 778 } |
| 779 |
| 772 history::TopSites* TestingProfile::GetTopSites() { | 780 history::TopSites* TestingProfile::GetTopSites() { |
| 773 return top_sites_.get(); | 781 return top_sites_.get(); |
| 774 } | 782 } |
| 775 | 783 |
| 776 history::TopSites* TestingProfile::GetTopSitesWithoutCreating() { | 784 history::TopSites* TestingProfile::GetTopSitesWithoutCreating() { |
| 777 return top_sites_.get(); | 785 return top_sites_.get(); |
| 778 } | 786 } |
| 779 | 787 |
| 780 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 788 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
| 781 return NULL; | 789 return NULL; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 #if defined(ENABLE_EXTENSIONS) | 1047 #if defined(ENABLE_EXTENSIONS) |
| 1040 extension_policy_, | 1048 extension_policy_, |
| 1041 #endif | 1049 #endif |
| 1042 pref_service_.Pass(), | 1050 pref_service_.Pass(), |
| 1043 original_profile, | 1051 original_profile, |
| 1044 guest_session_, | 1052 guest_session_, |
| 1045 supervised_user_id_, | 1053 supervised_user_id_, |
| 1046 policy_service_.Pass(), | 1054 policy_service_.Pass(), |
| 1047 testing_factories_); | 1055 testing_factories_); |
| 1048 } | 1056 } |
| OLD | NEW |