| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" | 7 #include "build/build_config.h" |
| 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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map.h" | 18 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 20 #include "chrome/browser/extensions/extension_pref_value_map.h" | 20 #include "chrome/browser/extensions/extension_pref_value_map.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 22 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 23 #include "chrome/browser/favicon/favicon_service.h" | 23 #include "chrome/browser/favicon/favicon_service.h" |
| 24 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 24 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 25 #include "chrome/browser/history/history.h" | 25 #include "chrome/browser/history/history.h" |
| 26 #include "chrome/browser/history/history_backend.h" | 26 #include "chrome/browser/history/history_backend.h" |
| 27 #include "chrome/browser/history/top_sites.h" | 27 #include "chrome/browser/history/top_sites.h" |
| 28 #include "chrome/browser/net/gaia/token_service.h" | 28 #include "chrome/browser/net/gaia/token_service.h" |
| 29 #include "chrome/browser/net/pref_proxy_config_service.h" | 29 #include "chrome/browser/net/proxy_service_factory.h" |
| 30 #include "chrome/browser/notifications/desktop_notification_service.h" | 30 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 31 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 31 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 32 #include "chrome/browser/prefs/browser_prefs.h" | 32 #include "chrome/browser/prefs/browser_prefs.h" |
| 33 #include "chrome/browser/prefs/testing_pref_store.h" | 33 #include "chrome/browser/prefs/testing_pref_store.h" |
| 34 #include "chrome/browser/prerender/prerender_manager.h" | 34 #include "chrome/browser/prerender/prerender_manager.h" |
| 35 #include "chrome/browser/profiles/profile_dependency_manager.h" | 35 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 36 #include "chrome/browser/search_engines/template_url_fetcher.h" | 36 #include "chrome/browser/search_engines/template_url_fetcher.h" |
| 37 #include "chrome/browser/search_engines/template_url_service.h" | 37 #include "chrome/browser/search_engines/template_url_service.h" |
| 38 #include "chrome/browser/search_engines/template_url_service_factory.h" | 38 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 39 #include "chrome/browser/speech/chrome_speech_input_preferences.h" | 39 #include "chrome/browser/speech/chrome_speech_input_preferences.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 #include "net/base/cookie_monster.h" | 55 #include "net/base/cookie_monster.h" |
| 56 #include "net/url_request/url_request_context.h" | 56 #include "net/url_request/url_request_context.h" |
| 57 #include "net/url_request/url_request_context_getter.h" | 57 #include "net/url_request/url_request_context_getter.h" |
| 58 #include "net/url_request/url_request_test_util.h" | 58 #include "net/url_request/url_request_test_util.h" |
| 59 #include "testing/gmock/include/gmock/gmock.h" | 59 #include "testing/gmock/include/gmock/gmock.h" |
| 60 #include "webkit/database/database_tracker.h" | 60 #include "webkit/database/database_tracker.h" |
| 61 #include "webkit/fileapi/file_system_context.h" | 61 #include "webkit/fileapi/file_system_context.h" |
| 62 #include "webkit/quota/quota_manager.h" | 62 #include "webkit/quota/quota_manager.h" |
| 63 #include "webkit/quota/mock_quota_manager.h" | 63 #include "webkit/quota/mock_quota_manager.h" |
| 64 | 64 |
| 65 #if defined(OS_CHROMEOS) |
| 66 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 67 #endif // defined(OS_CHROMEOS) |
| 68 |
| 65 using base::Time; | 69 using base::Time; |
| 66 using testing::NiceMock; | 70 using testing::NiceMock; |
| 67 using testing::Return; | 71 using testing::Return; |
| 68 | 72 |
| 69 namespace { | 73 namespace { |
| 70 | 74 |
| 71 // Task used to make sure history has finished processing a request. Intended | 75 // Task used to make sure history has finished processing a request. Intended |
| 72 // for use with BlockUntilHistoryProcessesPendingRequests. | 76 // for use with BlockUntilHistoryProcessesPendingRequests. |
| 73 | 77 |
| 74 class QuittingHistoryDBTask : public HistoryDBTask { | 78 class QuittingHistoryDBTask : public HistoryDBTask { |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 } | 711 } |
| 708 | 712 |
| 709 FilePath TestingProfile::last_selected_directory() { | 713 FilePath TestingProfile::last_selected_directory() { |
| 710 return last_selected_directory_; | 714 return last_selected_directory_; |
| 711 } | 715 } |
| 712 | 716 |
| 713 void TestingProfile::set_last_selected_directory(const FilePath& path) { | 717 void TestingProfile::set_last_selected_directory(const FilePath& path) { |
| 714 last_selected_directory_ = path; | 718 last_selected_directory_ = path; |
| 715 } | 719 } |
| 716 | 720 |
| 717 PrefProxyConfigTracker* TestingProfile::GetProxyConfigTracker() { | 721 PrefProxyConfigTrackerType* TestingProfile::GetProxyConfigTracker() { |
| 718 if (!pref_proxy_config_tracker_) | 722 if (!pref_proxy_config_tracker_.get()) { |
| 719 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs()); | 723 pref_proxy_config_tracker_.reset( |
| 720 | 724 ProxyServiceFactory::CreatePrefProxyConfigTracker(GetPrefs())); |
| 721 return pref_proxy_config_tracker_; | 725 } |
| 726 return pref_proxy_config_tracker_.get(); |
| 722 } | 727 } |
| 723 | 728 |
| 724 void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { | 729 void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { |
| 725 DCHECK(history_service_.get()); | 730 DCHECK(history_service_.get()); |
| 726 DCHECK(MessageLoop::current()); | 731 DCHECK(MessageLoop::current()); |
| 727 | 732 |
| 728 CancelableRequestConsumer consumer; | 733 CancelableRequestConsumer consumer; |
| 729 history_service_->ScheduleDBTask(new QuittingHistoryDBTask(), &consumer); | 734 history_service_->ScheduleDBTask(new QuittingHistoryDBTask(), &consumer); |
| 730 MessageLoop::current()->Run(); | 735 MessageLoop::current()->Run(); |
| 731 } | 736 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 793 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
| 789 return GetExtensionSpecialStoragePolicy(); | 794 return GetExtensionSpecialStoragePolicy(); |
| 790 } | 795 } |
| 791 | 796 |
| 792 void TestingProfile::DestroyWebDataService() { | 797 void TestingProfile::DestroyWebDataService() { |
| 793 if (!web_data_service_.get()) | 798 if (!web_data_service_.get()) |
| 794 return; | 799 return; |
| 795 | 800 |
| 796 web_data_service_->Shutdown(); | 801 web_data_service_->Shutdown(); |
| 797 } | 802 } |
| OLD | NEW |