| 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 "build/build_config.h" | |
| 8 | |
| 9 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 10 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 14 #include "base/prefs/testing_pref_store.h" | 12 #include "base/prefs/testing_pref_store.h" |
| 15 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 16 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 17 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 20 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | 18 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
| 21 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 23 #include "chrome/browser/content_settings/host_content_settings_map.h" | 21 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | |
| 25 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 22 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 26 #include "chrome/browser/extensions/extension_system_factory.h" | 23 #include "chrome/browser/extensions/extension_system_factory.h" |
| 27 #include "chrome/browser/extensions/test_extension_system.h" | 24 #include "chrome/browser/extensions/test_extension_system.h" |
| 28 #include "chrome/browser/favicon/favicon_service.h" | 25 #include "chrome/browser/favicon/favicon_service.h" |
| 29 #include "chrome/browser/favicon/favicon_service_factory.h" | 26 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 30 #include "chrome/browser/history/chrome_history_client.h" | 27 #include "chrome/browser/history/chrome_history_client.h" |
| 31 #include "chrome/browser/history/chrome_history_client_factory.h" | 28 #include "chrome/browser/history/chrome_history_client_factory.h" |
| 32 #include "chrome/browser/history/history_backend.h" | 29 #include "chrome/browser/history/history_backend.h" |
| 33 #include "chrome/browser/history/history_db_task.h" | 30 #include "chrome/browser/history/history_db_task.h" |
| 34 #include "chrome/browser/history/history_service.h" | 31 #include "chrome/browser/history/history_service.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 62 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 59 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 63 #include "components/policy/core/common/policy_service.h" | 60 #include "components/policy/core/common/policy_service.h" |
| 64 #include "components/user_prefs/user_prefs.h" | 61 #include "components/user_prefs/user_prefs.h" |
| 65 #include "content/public/browser/browser_thread.h" | 62 #include "content/public/browser/browser_thread.h" |
| 66 #include "content/public/browser/cookie_store_factory.h" | 63 #include "content/public/browser/cookie_store_factory.h" |
| 67 #include "content/public/browser/notification_service.h" | 64 #include "content/public/browser/notification_service.h" |
| 68 #include "content/public/browser/render_process_host.h" | 65 #include "content/public/browser/render_process_host.h" |
| 69 #include "content/public/browser/storage_partition.h" | 66 #include "content/public/browser/storage_partition.h" |
| 70 #include "content/public/test/mock_resource_context.h" | 67 #include "content/public/test/mock_resource_context.h" |
| 71 #include "content/public/test/test_utils.h" | 68 #include "content/public/test/test_utils.h" |
| 72 #include "extensions/browser/extension_system.h" | |
| 73 #include "extensions/common/constants.h" | 69 #include "extensions/common/constants.h" |
| 74 #include "net/cookies/cookie_monster.h" | 70 #include "net/cookies/cookie_monster.h" |
| 75 #include "net/url_request/url_request_context.h" | 71 #include "net/url_request/url_request_context.h" |
| 76 #include "net/url_request/url_request_context_getter.h" | 72 #include "net/url_request/url_request_context_getter.h" |
| 77 #include "net/url_request/url_request_test_util.h" | 73 #include "net/url_request/url_request_test_util.h" |
| 78 #include "testing/gmock/include/gmock/gmock.h" | 74 #include "testing/gmock/include/gmock/gmock.h" |
| 79 | 75 |
| 80 #if defined(ENABLE_CONFIGURATION_POLICY) | 76 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 81 #include "chrome/browser/policy/schema_registry_service.h" | 77 #include "chrome/browser/policy/schema_registry_service.h" |
| 82 #include "chrome/browser/policy/schema_registry_service_factory.h" | 78 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 83 #include "components/policy/core/common/configuration_policy_provider.h" | 79 #include "components/policy/core/common/configuration_policy_provider.h" |
| 84 #include "components/policy/core/common/policy_service_impl.h" | 80 #include "components/policy/core/common/policy_service_impl.h" |
| 85 #include "components/policy/core/common/schema.h" | 81 #include "components/policy/core/common/schema.h" |
| 86 #else | 82 #else |
| 87 #include "components/policy/core/common/policy_service_stub.h" | 83 #include "components/policy/core/common/policy_service_stub.h" |
| 88 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 84 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 89 | 85 |
| 90 #if defined(ENABLE_EXTENSIONS) | 86 #if defined(ENABLE_EXTENSIONS) |
| 91 #include "chrome/browser/guest_view/guest_view_manager.h" | 87 #include "chrome/browser/guest_view/guest_view_manager.h" |
| 88 #include "extensions/browser/extension_system.h" |
| 92 #endif | 89 #endif |
| 93 | 90 |
| 94 #if defined(OS_ANDROID) | 91 #if defined(OS_ANDROID) |
| 95 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" | 92 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" |
| 96 #endif | 93 #endif |
| 97 | 94 |
| 98 #if defined(ENABLE_MANAGED_USERS) | 95 #if defined(ENABLE_MANAGED_USERS) |
| 99 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 96 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
| 100 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 97 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
| 101 #endif | 98 #endif |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 Profile* TestingProfile::GetOriginalProfile() { | 647 Profile* TestingProfile::GetOriginalProfile() { |
| 651 if (original_profile_) | 648 if (original_profile_) |
| 652 return original_profile_; | 649 return original_profile_; |
| 653 return this; | 650 return this; |
| 654 } | 651 } |
| 655 | 652 |
| 656 bool TestingProfile::IsSupervised() { | 653 bool TestingProfile::IsSupervised() { |
| 657 return !supervised_user_id_.empty(); | 654 return !supervised_user_id_.empty(); |
| 658 } | 655 } |
| 659 | 656 |
| 660 ExtensionService* TestingProfile::GetExtensionService() { | |
| 661 return extensions::ExtensionSystem::Get(this)->extension_service(); | |
| 662 } | |
| 663 | |
| 664 void TestingProfile::SetExtensionSpecialStoragePolicy( | 657 void TestingProfile::SetExtensionSpecialStoragePolicy( |
| 665 ExtensionSpecialStoragePolicy* extension_special_storage_policy) { | 658 ExtensionSpecialStoragePolicy* extension_special_storage_policy) { |
| 666 extension_special_storage_policy_ = extension_special_storage_policy; | 659 extension_special_storage_policy_ = extension_special_storage_policy; |
| 667 } | 660 } |
| 668 | 661 |
| 669 ExtensionSpecialStoragePolicy* | 662 ExtensionSpecialStoragePolicy* |
| 670 TestingProfile::GetExtensionSpecialStoragePolicy() { | 663 TestingProfile::GetExtensionSpecialStoragePolicy() { |
| 671 if (!extension_special_storage_policy_.get()) | 664 if (!extension_special_storage_policy_.get()) |
| 672 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy(NULL); | 665 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy(NULL); |
| 673 return extension_special_storage_policy_.get(); | 666 return extension_special_storage_policy_.get(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 content::ResourceContext* TestingProfile::GetResourceContext() { | 786 content::ResourceContext* TestingProfile::GetResourceContext() { |
| 794 if (!resource_context_) | 787 if (!resource_context_) |
| 795 resource_context_ = new content::MockResourceContext(); | 788 resource_context_ = new content::MockResourceContext(); |
| 796 return resource_context_; | 789 return resource_context_; |
| 797 } | 790 } |
| 798 | 791 |
| 799 HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() { | 792 HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() { |
| 800 if (!host_content_settings_map_.get()) { | 793 if (!host_content_settings_map_.get()) { |
| 801 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); | 794 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); |
| 802 #if defined(ENABLE_EXTENSIONS) | 795 #if defined(ENABLE_EXTENSIONS) |
| 803 ExtensionService* extension_service = GetExtensionService(); | 796 ExtensionService* extension_service = |
| 797 extensions::ExtensionSystem::Get(this)->extension_service(); |
| 804 if (extension_service) | 798 if (extension_service) |
| 805 host_content_settings_map_->RegisterExtensionService(extension_service); | 799 host_content_settings_map_->RegisterExtensionService(extension_service); |
| 806 #endif | 800 #endif |
| 807 } | 801 } |
| 808 return host_content_settings_map_.get(); | 802 return host_content_settings_map_.get(); |
| 809 } | 803 } |
| 810 | 804 |
| 811 content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() { | 805 content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() { |
| 812 #if defined(ENABLE_EXTENSIONS) | 806 #if defined(ENABLE_EXTENSIONS) |
| 813 return GuestViewManager::FromBrowserContext(this); | 807 return GuestViewManager::FromBrowserContext(this); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 path_, | 951 path_, |
| 958 delegate_, | 952 delegate_, |
| 959 extension_policy_, | 953 extension_policy_, |
| 960 pref_service_.Pass(), | 954 pref_service_.Pass(), |
| 961 incognito_, | 955 incognito_, |
| 962 guest_session_, | 956 guest_session_, |
| 963 supervised_user_id_, | 957 supervised_user_id_, |
| 964 policy_service_.Pass(), | 958 policy_service_.Pass(), |
| 965 testing_factories_)); | 959 testing_factories_)); |
| 966 } | 960 } |
| OLD | NEW |