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