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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 } | 789 } |
790 | 790 |
791 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 791 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
792 return NULL; | 792 return NULL; |
793 } | 793 } |
794 | 794 |
795 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 795 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
796 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 796 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
797 } | 797 } |
798 | 798 |
799 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( | |
800 content::ProtocolHandlerMap* protocol_handlers, | |
801 content::URLRequestInterceptorScopedVector request_interceptors) { | |
802 return new net::TestURLRequestContextGetter( | |
803 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | |
804 } | |
805 | |
806 net::URLRequestContextGetter* TestingProfile::GetMediaRequestContext() { | 799 net::URLRequestContextGetter* TestingProfile::GetMediaRequestContext() { |
807 return NULL; | 800 return NULL; |
808 } | 801 } |
809 | 802 |
810 net::URLRequestContextGetter* | 803 net::URLRequestContextGetter* |
811 TestingProfile::GetMediaRequestContextForRenderProcess( | 804 TestingProfile::GetMediaRequestContextForRenderProcess( |
812 int renderer_child_id) { | 805 int renderer_child_id) { |
813 return NULL; | 806 return NULL; |
814 } | 807 } |
815 | 808 |
816 net::URLRequestContextGetter* | 809 net::URLRequestContextGetter* |
817 TestingProfile::GetMediaRequestContextForStoragePartition( | 810 TestingProfile::GetMediaRequestContextForStoragePartition( |
818 const base::FilePath& partition_path, | 811 const base::FilePath& partition_path, |
819 bool in_memory) { | 812 bool in_memory) { |
820 return NULL; | 813 return NULL; |
821 } | 814 } |
822 | 815 |
823 net::URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { | 816 net::URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { |
824 if (!extensions_request_context_.get()) | 817 if (!extensions_request_context_.get()) |
825 extensions_request_context_ = new TestExtensionURLRequestContextGetter(); | 818 extensions_request_context_ = new TestExtensionURLRequestContextGetter(); |
826 return extensions_request_context_.get(); | 819 return extensions_request_context_.get(); |
827 } | 820 } |
828 | 821 |
829 net::SSLConfigService* TestingProfile::GetSSLConfigService() { | 822 net::SSLConfigService* TestingProfile::GetSSLConfigService() { |
830 if (!GetRequestContext()) | 823 if (!GetRequestContext()) |
831 return NULL; | 824 return NULL; |
832 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); | 825 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); |
833 } | 826 } |
834 | 827 |
835 net::URLRequestContextGetter* | |
836 TestingProfile::CreateRequestContextForStoragePartition( | |
837 const base::FilePath& partition_path, | |
838 bool in_memory, | |
839 content::ProtocolHandlerMap* protocol_handlers, | |
840 content::URLRequestInterceptorScopedVector request_interceptors) { | |
841 // We don't test storage partitions here yet, so returning the same dummy | |
842 // context is sufficient for now. | |
843 return GetRequestContext(); | |
844 } | |
845 | |
846 content::ResourceContext* TestingProfile::GetResourceContext() { | 828 content::ResourceContext* TestingProfile::GetResourceContext() { |
847 if (!resource_context_) | 829 if (!resource_context_) |
848 resource_context_ = new content::MockResourceContext(); | 830 resource_context_ = new content::MockResourceContext(); |
849 return resource_context_; | 831 return resource_context_; |
850 } | 832 } |
851 | 833 |
852 content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() { | 834 content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() { |
853 #if defined(ENABLE_EXTENSIONS) | 835 #if defined(ENABLE_EXTENSIONS) |
854 return guest_view::GuestViewManager::FromBrowserContext(this); | 836 return guest_view::GuestViewManager::FromBrowserContext(this); |
855 #else | 837 #else |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 | 923 |
942 content::PermissionManager* TestingProfile::GetPermissionManager() { | 924 content::PermissionManager* TestingProfile::GetPermissionManager() { |
943 return NULL; | 925 return NULL; |
944 } | 926 } |
945 | 927 |
946 content::BackgroundSyncController* | 928 content::BackgroundSyncController* |
947 TestingProfile::GetBackgroundSyncController() { | 929 TestingProfile::GetBackgroundSyncController() { |
948 return nullptr; | 930 return nullptr; |
949 } | 931 } |
950 | 932 |
| 933 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( |
| 934 content::ProtocolHandlerMap* protocol_handlers, |
| 935 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 936 return new net::TestURLRequestContextGetter( |
| 937 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 938 } |
| 939 |
| 940 net::URLRequestContextGetter* |
| 941 TestingProfile::CreateRequestContextForStoragePartition( |
| 942 const base::FilePath& partition_path, |
| 943 bool in_memory, |
| 944 content::ProtocolHandlerMap* protocol_handlers, |
| 945 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 946 // We don't test storage partitions here yet, so returning the same dummy |
| 947 // context is sufficient for now. |
| 948 return GetRequestContext(); |
| 949 } |
| 950 |
951 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { | 951 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { |
952 return true; | 952 return true; |
953 } | 953 } |
954 | 954 |
955 bool TestingProfile::IsGuestSession() const { | 955 bool TestingProfile::IsGuestSession() const { |
956 return guest_session_; | 956 return guest_session_; |
957 } | 957 } |
958 | 958 |
959 Profile::ExitType TestingProfile::GetLastSessionExitType() { | 959 Profile::ExitType TestingProfile::GetLastSessionExitType() { |
960 return last_session_exited_cleanly_ ? EXIT_NORMAL : EXIT_CRASHED; | 960 return last_session_exited_cleanly_ ? EXIT_NORMAL : EXIT_CRASHED; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 // Note: Owned by |original_profile|. | 1035 // Note: Owned by |original_profile|. |
1036 return new TestingProfile(path_, delegate_, | 1036 return new TestingProfile(path_, delegate_, |
1037 #if defined(ENABLE_EXTENSIONS) | 1037 #if defined(ENABLE_EXTENSIONS) |
1038 extension_policy_, | 1038 extension_policy_, |
1039 #endif | 1039 #endif |
1040 std::move(pref_service_), original_profile, | 1040 std::move(pref_service_), original_profile, |
1041 guest_session_, supervised_user_id_, | 1041 guest_session_, supervised_user_id_, |
1042 std::move(policy_service_), testing_factories_, | 1042 std::move(policy_service_), testing_factories_, |
1043 profile_name_); | 1043 profile_name_); |
1044 } | 1044 } |
OLD | NEW |