| 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/mock_quota_manager.h" | 62 #include "webkit/quota/mock_quota_manager.h" |
| 63 #include "webkit/quota/quota_manager.h" | 63 #include "webkit/quota/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 content::BrowserThread; | 70 using content::BrowserThread; |
| 67 using testing::NiceMock; | 71 using testing::NiceMock; |
| 68 using testing::Return; | 72 using testing::Return; |
| 69 | 73 |
| 70 namespace { | 74 namespace { |
| 71 | 75 |
| 72 // Task used to make sure history has finished processing a request. Intended | 76 // Task used to make sure history has finished processing a request. Intended |
| 73 // for use with BlockUntilHistoryProcessesPendingRequests. | 77 // for use with BlockUntilHistoryProcessesPendingRequests. |
| 74 | 78 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 | 716 |
| 713 FilePath TestingProfile::last_selected_directory() { | 717 FilePath TestingProfile::last_selected_directory() { |
| 714 return last_selected_directory_; | 718 return last_selected_directory_; |
| 715 } | 719 } |
| 716 | 720 |
| 717 void TestingProfile::set_last_selected_directory(const FilePath& path) { | 721 void TestingProfile::set_last_selected_directory(const FilePath& path) { |
| 718 last_selected_directory_ = path; | 722 last_selected_directory_ = path; |
| 719 } | 723 } |
| 720 | 724 |
| 721 PrefProxyConfigTracker* TestingProfile::GetProxyConfigTracker() { | 725 PrefProxyConfigTracker* TestingProfile::GetProxyConfigTracker() { |
| 722 if (!pref_proxy_config_tracker_) | 726 if (!pref_proxy_config_tracker_.get()) { |
| 723 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs()); | 727 pref_proxy_config_tracker_.reset( |
| 724 | 728 ProxyServiceFactory::CreatePrefProxyConfigTracker(GetPrefs())); |
| 725 return pref_proxy_config_tracker_; | 729 } |
| 730 return pref_proxy_config_tracker_.get(); |
| 726 } | 731 } |
| 727 | 732 |
| 728 void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { | 733 void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { |
| 729 DCHECK(history_service_.get()); | 734 DCHECK(history_service_.get()); |
| 730 DCHECK(MessageLoop::current()); | 735 DCHECK(MessageLoop::current()); |
| 731 | 736 |
| 732 CancelableRequestConsumer consumer; | 737 CancelableRequestConsumer consumer; |
| 733 history_service_->ScheduleDBTask(new QuittingHistoryDBTask(), &consumer); | 738 history_service_->ScheduleDBTask(new QuittingHistoryDBTask(), &consumer); |
| 734 MessageLoop::current()->Run(); | 739 MessageLoop::current()->Run(); |
| 735 } | 740 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 801 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
| 797 return GetExtensionSpecialStoragePolicy(); | 802 return GetExtensionSpecialStoragePolicy(); |
| 798 } | 803 } |
| 799 | 804 |
| 800 void TestingProfile::DestroyWebDataService() { | 805 void TestingProfile::DestroyWebDataService() { |
| 801 if (!web_data_service_.get()) | 806 if (!web_data_service_.get()) |
| 802 return; | 807 return; |
| 803 | 808 |
| 804 web_data_service_->Shutdown(); | 809 web_data_service_->Shutdown(); |
| 805 } | 810 } |
| OLD | NEW |