OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/test/testing_browser_process.h" |
| 6 |
| 7 #include "base/string_util.h" |
| 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "chrome/browser/google/google_url_tracker.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 12 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 13 #include "chrome/browser/policy/configuration_policy_provider_keeper.h" |
| 14 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" |
| 15 #include "ui/base/clipboard/clipboard.h" |
| 16 |
| 17 TestingBrowserProcess::TestingBrowserProcess() |
| 18 : shutdown_event_(new base::WaitableEvent(true, false)), |
| 19 module_ref_count_(0), |
| 20 app_locale_("en"), |
| 21 pref_service_(NULL), |
| 22 created_configuration_policy_provider_keeper_(false) { |
| 23 } |
| 24 |
| 25 TestingBrowserProcess::~TestingBrowserProcess() { |
| 26 } |
| 27 |
| 28 void TestingBrowserProcess::EndSession() { |
| 29 } |
| 30 |
| 31 ResourceDispatcherHost* TestingBrowserProcess::resource_dispatcher_host() { |
| 32 return NULL; |
| 33 } |
| 34 |
| 35 MetricsService* TestingBrowserProcess::metrics_service() { |
| 36 return NULL; |
| 37 } |
| 38 |
| 39 IOThread* TestingBrowserProcess::io_thread() { |
| 40 return NULL; |
| 41 } |
| 42 |
| 43 #if defined(OS_LINUX) |
| 44 base::Thread* TestingBrowserProcess::background_x11_thread() { |
| 45 return NULL; |
| 46 } |
| 47 #endif |
| 48 |
| 49 base::Thread* TestingBrowserProcess::file_thread() { |
| 50 return NULL; |
| 51 } |
| 52 |
| 53 base::Thread* TestingBrowserProcess::db_thread() { |
| 54 return NULL; |
| 55 } |
| 56 |
| 57 base::Thread* TestingBrowserProcess::cache_thread() { |
| 58 return NULL; |
| 59 } |
| 60 |
| 61 ProfileManager* TestingBrowserProcess::profile_manager() { |
| 62 return NULL; |
| 63 } |
| 64 |
| 65 PrefService* TestingBrowserProcess::local_state() { |
| 66 return pref_service_; |
| 67 } |
| 68 |
| 69 policy::ConfigurationPolicyProviderKeeper* |
| 70 TestingBrowserProcess::configuration_policy_provider_keeper() { |
| 71 if (!created_configuration_policy_provider_keeper_) { |
| 72 DCHECK(configuration_policy_provider_keeper_.get() == NULL); |
| 73 created_configuration_policy_provider_keeper_ = true; |
| 74 const policy::ConfigurationPolicyProvider::PolicyDefinitionList* |
| 75 policy_list = policy::ConfigurationPolicyPrefStore:: |
| 76 GetChromePolicyDefinitionList(); |
| 77 configuration_policy_provider_keeper_.reset( |
| 78 new policy::ConfigurationPolicyProviderKeeper( |
| 79 new policy::DummyConfigurationPolicyProvider(policy_list), |
| 80 new policy::DummyConfigurationPolicyProvider(policy_list), |
| 81 new policy::DummyConfigurationPolicyProvider(policy_list))); |
| 82 } |
| 83 return configuration_policy_provider_keeper_.get(); |
| 84 } |
| 85 |
| 86 IconManager* TestingBrowserProcess::icon_manager() { |
| 87 return NULL; |
| 88 } |
| 89 |
| 90 ThumbnailGenerator* TestingBrowserProcess::GetThumbnailGenerator() { |
| 91 return NULL; |
| 92 } |
| 93 |
| 94 DevToolsManager* TestingBrowserProcess::devtools_manager() { |
| 95 return NULL; |
| 96 } |
| 97 |
| 98 SidebarManager* TestingBrowserProcess::sidebar_manager() { |
| 99 return NULL; |
| 100 } |
| 101 |
| 102 TabCloseableStateWatcher* TestingBrowserProcess::tab_closeable_state_watcher() { |
| 103 return NULL; |
| 104 } |
| 105 |
| 106 safe_browsing::ClientSideDetectionService* |
| 107 TestingBrowserProcess::safe_browsing_detection_service() { |
| 108 return NULL; |
| 109 } |
| 110 |
| 111 ui::Clipboard* TestingBrowserProcess::clipboard() { |
| 112 if (!clipboard_.get()) { |
| 113 // Note that we need a MessageLoop for the next call to work. |
| 114 clipboard_.reset(new ui::Clipboard); |
| 115 } |
| 116 return clipboard_.get(); |
| 117 } |
| 118 |
| 119 NotificationUIManager* TestingBrowserProcess::notification_ui_manager() { |
| 120 return NULL; |
| 121 } |
| 122 |
| 123 GoogleURLTracker* TestingBrowserProcess::google_url_tracker() { |
| 124 return google_url_tracker_.get(); |
| 125 } |
| 126 |
| 127 IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() { |
| 128 return NULL; |
| 129 } |
| 130 |
| 131 AutomationProviderList* TestingBrowserProcess::InitAutomationProviderList() { |
| 132 return NULL; |
| 133 } |
| 134 |
| 135 void TestingBrowserProcess::InitDevToolsHttpProtocolHandler( |
| 136 const std::string& ip, |
| 137 int port, |
| 138 const std::string& frontend_url) { |
| 139 } |
| 140 |
| 141 void TestingBrowserProcess::InitDevToolsLegacyProtocolHandler(int port) { |
| 142 } |
| 143 |
| 144 unsigned int TestingBrowserProcess::AddRefModule() { |
| 145 return ++module_ref_count_; |
| 146 } |
| 147 |
| 148 unsigned int TestingBrowserProcess::ReleaseModule() { |
| 149 DCHECK(module_ref_count_ > 0); |
| 150 return --module_ref_count_; |
| 151 } |
| 152 |
| 153 bool TestingBrowserProcess::IsShuttingDown() { |
| 154 return false; |
| 155 } |
| 156 |
| 157 printing::PrintJobManager* TestingBrowserProcess::print_job_manager() { |
| 158 return NULL; |
| 159 } |
| 160 |
| 161 printing::PrintPreviewTabController* |
| 162 TestingBrowserProcess::print_preview_tab_controller() { |
| 163 return NULL; |
| 164 } |
| 165 |
| 166 const std::string& TestingBrowserProcess::GetApplicationLocale() { |
| 167 return app_locale_; |
| 168 } |
| 169 |
| 170 void TestingBrowserProcess::SetApplicationLocale( |
| 171 const std::string& app_locale) { |
| 172 app_locale_ = app_locale; |
| 173 } |
| 174 |
| 175 DownloadStatusUpdater* TestingBrowserProcess::download_status_updater() { |
| 176 return NULL; |
| 177 } |
| 178 |
| 179 base::WaitableEvent* TestingBrowserProcess::shutdown_event() { |
| 180 return shutdown_event_.get(); |
| 181 } |
| 182 |
| 183 bool TestingBrowserProcess::have_inspector_files() const { |
| 184 return true; |
| 185 } |
| 186 |
| 187 void TestingBrowserProcess::SetPrefService(PrefService* pref_service) { |
| 188 pref_service_ = pref_service; |
| 189 } |
| 190 |
| 191 void TestingBrowserProcess::SetGoogleURLTracker( |
| 192 GoogleURLTracker* google_url_tracker) { |
| 193 google_url_tracker_.reset(google_url_tracker); |
| 194 } |
OLD | NEW |