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/pref_proxy_config_tracker.h" |
30 #include "chrome/browser/net/proxy_service_factory.h" | |
30 #include "chrome/browser/notifications/desktop_notification_service.h" | 31 #include "chrome/browser/notifications/desktop_notification_service.h" |
31 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 32 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
32 #include "chrome/browser/prefs/browser_prefs.h" | 33 #include "chrome/browser/prefs/browser_prefs.h" |
33 #include "chrome/browser/prefs/testing_pref_store.h" | 34 #include "chrome/browser/prefs/testing_pref_store.h" |
34 #include "chrome/browser/prerender/prerender_manager.h" | 35 #include "chrome/browser/prerender/prerender_manager.h" |
35 #include "chrome/browser/profiles/profile_dependency_manager.h" | 36 #include "chrome/browser/profiles/profile_dependency_manager.h" |
36 #include "chrome/browser/search_engines/template_url_fetcher.h" | 37 #include "chrome/browser/search_engines/template_url_fetcher.h" |
37 #include "chrome/browser/search_engines/template_url_service.h" | 38 #include "chrome/browser/search_engines/template_url_service.h" |
38 #include "chrome/browser/search_engines/template_url_service_factory.h" | 39 #include "chrome/browser/search_engines/template_url_service_factory.h" |
39 #include "chrome/browser/speech/chrome_speech_input_preferences.h" | 40 #include "chrome/browser/speech/chrome_speech_input_preferences.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
55 #include "net/base/cookie_monster.h" | 56 #include "net/base/cookie_monster.h" |
56 #include "net/url_request/url_request_context.h" | 57 #include "net/url_request/url_request_context.h" |
57 #include "net/url_request/url_request_context_getter.h" | 58 #include "net/url_request/url_request_context_getter.h" |
58 #include "net/url_request/url_request_test_util.h" | 59 #include "net/url_request/url_request_test_util.h" |
59 #include "testing/gmock/include/gmock/gmock.h" | 60 #include "testing/gmock/include/gmock/gmock.h" |
60 #include "webkit/database/database_tracker.h" | 61 #include "webkit/database/database_tracker.h" |
61 #include "webkit/fileapi/file_system_context.h" | 62 #include "webkit/fileapi/file_system_context.h" |
62 #include "webkit/quota/quota_manager.h" | 63 #include "webkit/quota/quota_manager.h" |
63 #include "webkit/quota/mock_quota_manager.h" | 64 #include "webkit/quota/mock_quota_manager.h" |
64 | 65 |
66 #if defined(OS_CHROMEOS) | |
67 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | |
Mattias Nissler (ping if slow)
2011/10/24 10:18:28
needed?
kuan
2011/10/25 02:01:54
yes, else can't build.
| |
68 #endif // defined(OS_CHROMEOS) | |
69 | |
65 using base::Time; | 70 using base::Time; |
66 using testing::NiceMock; | 71 using testing::NiceMock; |
67 using testing::Return; | 72 using testing::Return; |
68 | 73 |
69 namespace { | 74 namespace { |
70 | 75 |
71 // 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 |
72 // for use with BlockUntilHistoryProcessesPendingRequests. | 77 // for use with BlockUntilHistoryProcessesPendingRequests. |
73 | 78 |
74 class QuittingHistoryDBTask : public HistoryDBTask { | 79 class QuittingHistoryDBTask : public HistoryDBTask { |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 } | 712 } |
708 | 713 |
709 FilePath TestingProfile::last_selected_directory() { | 714 FilePath TestingProfile::last_selected_directory() { |
710 return last_selected_directory_; | 715 return last_selected_directory_; |
711 } | 716 } |
712 | 717 |
713 void TestingProfile::set_last_selected_directory(const FilePath& path) { | 718 void TestingProfile::set_last_selected_directory(const FilePath& path) { |
714 last_selected_directory_ = path; | 719 last_selected_directory_ = path; |
715 } | 720 } |
716 | 721 |
717 PrefProxyConfigTracker* TestingProfile::GetProxyConfigTracker() { | 722 PrefProxyConfigTrackerType* TestingProfile::GetProxyConfigTracker() { |
718 if (!pref_proxy_config_tracker_) | 723 if (!pref_proxy_config_tracker_.get()) { |
719 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs()); | 724 pref_proxy_config_tracker_.reset( |
720 | 725 ProxyServiceFactory::CreatePrefProxyConfigTracker(GetPrefs())); |
721 return pref_proxy_config_tracker_; | 726 } |
727 return pref_proxy_config_tracker_.get(); | |
722 } | 728 } |
723 | 729 |
724 void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { | 730 void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { |
725 DCHECK(history_service_.get()); | 731 DCHECK(history_service_.get()); |
726 DCHECK(MessageLoop::current()); | 732 DCHECK(MessageLoop::current()); |
727 | 733 |
728 CancelableRequestConsumer consumer; | 734 CancelableRequestConsumer consumer; |
729 history_service_->ScheduleDBTask(new QuittingHistoryDBTask(), &consumer); | 735 history_service_->ScheduleDBTask(new QuittingHistoryDBTask(), &consumer); |
730 MessageLoop::current()->Run(); | 736 MessageLoop::current()->Run(); |
731 } | 737 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
788 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 794 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
789 return GetExtensionSpecialStoragePolicy(); | 795 return GetExtensionSpecialStoragePolicy(); |
790 } | 796 } |
791 | 797 |
792 void TestingProfile::DestroyWebDataService() { | 798 void TestingProfile::DestroyWebDataService() { |
793 if (!web_data_service_.get()) | 799 if (!web_data_service_.get()) |
794 return; | 800 return; |
795 | 801 |
796 web_data_service_->Shutdown(); | 802 web_data_service_->Shutdown(); |
797 } | 803 } |
OLD | NEW |