Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: chrome/test/testing_browser_process.cc

Issue 7616019: Reorganize chrome/test, part #9 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/testing_browser_process.h ('k') | chrome/test/testing_browser_process_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "chrome/browser/google/google_url_tracker.h"
9 #include "chrome/browser/notifications/notification_ui_manager.h"
10 #include "chrome/browser/policy/browser_policy_connector.h"
11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/prerender/prerender_tracker.h"
13 #include "chrome/browser/printing/background_printing_manager.h"
14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "content/browser/debugger/devtools_manager.h"
16 #include "net/url_request/url_request_context_getter.h"
17 #include "ui/base/clipboard/clipboard.h"
18 #include "testing/gtest/include/gtest/gtest.h"
19
20 TestingBrowserProcess::TestingBrowserProcess()
21 : module_ref_count_(0),
22 app_locale_("en"),
23 local_state_(NULL),
24 io_thread_(NULL),
25 devtools_manager_(NULL) {
26 }
27
28 TestingBrowserProcess::~TestingBrowserProcess() {
29 EXPECT_FALSE(local_state_);
30 }
31
32 void TestingBrowserProcess::EndSession() {
33 }
34
35 ResourceDispatcherHost* TestingBrowserProcess::resource_dispatcher_host() {
36 return NULL;
37 }
38
39 MetricsService* TestingBrowserProcess::metrics_service() {
40 return NULL;
41 }
42
43 IOThread* TestingBrowserProcess::io_thread() {
44 return io_thread_;
45 }
46
47 base::Thread* TestingBrowserProcess::file_thread() {
48 return NULL;
49 }
50
51 base::Thread* TestingBrowserProcess::db_thread() {
52 return NULL;
53 }
54
55 base::Thread* TestingBrowserProcess::cache_thread() {
56 return NULL;
57 }
58
59 WatchDogThread* TestingBrowserProcess::watchdog_thread() {
60 return NULL;
61 }
62
63 #if defined(OS_CHROMEOS)
64 base::Thread* TestingBrowserProcess::web_socket_proxy_thread() {
65 return NULL;
66 }
67 #endif
68
69 ProfileManager* TestingBrowserProcess::profile_manager() {
70 return profile_manager_.get();
71 }
72
73 void TestingBrowserProcess::SetProfileManager(ProfileManager* profile_manager) {
74 profile_manager_.reset(profile_manager);
75 }
76
77 PrefService* TestingBrowserProcess::local_state() {
78 return local_state_;
79 }
80
81 policy::BrowserPolicyConnector*
82 TestingBrowserProcess::browser_policy_connector() {
83 #if defined(ENABLE_CONFIGURATION_POLICY)
84 if (!browser_policy_connector_.get()) {
85 browser_policy_connector_.reset(
86 policy::BrowserPolicyConnector::CreateForTests());
87 }
88 #endif
89 return browser_policy_connector_.get();
90 }
91
92 IconManager* TestingBrowserProcess::icon_manager() {
93 return NULL;
94 }
95
96 ThumbnailGenerator* TestingBrowserProcess::GetThumbnailGenerator() {
97 return NULL;
98 }
99
100 DevToolsManager* TestingBrowserProcess::devtools_manager() {
101 return devtools_manager_.get();
102 }
103
104 SidebarManager* TestingBrowserProcess::sidebar_manager() {
105 return NULL;
106 }
107
108 TabCloseableStateWatcher* TestingBrowserProcess::tab_closeable_state_watcher() {
109 return NULL;
110 }
111
112 BackgroundModeManager* TestingBrowserProcess::background_mode_manager() {
113 return NULL;
114 }
115
116 StatusTray* TestingBrowserProcess::status_tray() {
117 return NULL;
118 }
119
120 SafeBrowsingService* TestingBrowserProcess::safe_browsing_service() {
121 return NULL;
122 }
123
124 safe_browsing::ClientSideDetectionService*
125 TestingBrowserProcess::safe_browsing_detection_service() {
126 return NULL;
127 }
128
129 net::URLRequestContextGetter* TestingBrowserProcess::system_request_context() {
130 return NULL;
131 }
132
133 #if defined(OS_CHROMEOS)
134 chromeos::ProxyConfigServiceImpl*
135 TestingBrowserProcess::chromeos_proxy_config_service_impl() {
136 return NULL;
137 }
138 #endif // defined(OS_CHROMEOS)
139
140 ui::Clipboard* TestingBrowserProcess::clipboard() {
141 if (!clipboard_.get()) {
142 // Note that we need a MessageLoop for the next call to work.
143 clipboard_.reset(new ui::Clipboard);
144 }
145 return clipboard_.get();
146 }
147
148 ExtensionEventRouterForwarder*
149 TestingBrowserProcess::extension_event_router_forwarder() {
150 return NULL;
151 }
152
153 NotificationUIManager* TestingBrowserProcess::notification_ui_manager() {
154 if (!notification_ui_manager_.get())
155 notification_ui_manager_.reset(
156 NotificationUIManager::Create(local_state()));
157 return notification_ui_manager_.get();
158 }
159
160 GoogleURLTracker* TestingBrowserProcess::google_url_tracker() {
161 return google_url_tracker_.get();
162 }
163
164 IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() {
165 return NULL;
166 }
167
168 AutomationProviderList* TestingBrowserProcess::InitAutomationProviderList() {
169 return NULL;
170 }
171
172 void TestingBrowserProcess::InitDevToolsHttpProtocolHandler(
173 Profile* profile,
174 const std::string& ip,
175 int port,
176 const std::string& frontend_url) {
177 }
178
179 void TestingBrowserProcess::InitDevToolsLegacyProtocolHandler(int port) {
180 }
181
182 unsigned int TestingBrowserProcess::AddRefModule() {
183 return ++module_ref_count_;
184 }
185
186 unsigned int TestingBrowserProcess::ReleaseModule() {
187 DCHECK_GT(module_ref_count_, 0U);
188 return --module_ref_count_;
189 }
190
191 bool TestingBrowserProcess::IsShuttingDown() {
192 return false;
193 }
194
195 printing::PrintJobManager* TestingBrowserProcess::print_job_manager() {
196 return NULL;
197 }
198
199 printing::PrintPreviewTabController*
200 TestingBrowserProcess::print_preview_tab_controller() {
201 return NULL;
202 }
203
204 printing::BackgroundPrintingManager*
205 TestingBrowserProcess::background_printing_manager() {
206 if (!background_printing_manager_.get()) {
207 background_printing_manager_.reset(
208 new printing::BackgroundPrintingManager());
209 }
210 return background_printing_manager_.get();
211 }
212
213 const std::string& TestingBrowserProcess::GetApplicationLocale() {
214 return app_locale_;
215 }
216
217 void TestingBrowserProcess::SetApplicationLocale(
218 const std::string& app_locale) {
219 app_locale_ = app_locale;
220 }
221
222 DownloadStatusUpdater* TestingBrowserProcess::download_status_updater() {
223 return NULL;
224 }
225
226 bool TestingBrowserProcess::plugin_finder_disabled() const {
227 return false;
228 }
229
230 ChromeNetLog* TestingBrowserProcess::net_log() {
231 return NULL;
232 }
233
234 prerender::PrerenderTracker* TestingBrowserProcess::prerender_tracker() {
235 if (!prerender_tracker_.get())
236 prerender_tracker_.reset(new prerender::PrerenderTracker());
237 return prerender_tracker_.get();
238 }
239
240 MHTMLGenerationManager* TestingBrowserProcess::mhtml_generation_manager() {
241 return NULL;
242 }
243
244 GpuBlacklistUpdater* TestingBrowserProcess::gpu_blacklist_updater() {
245 return NULL;
246 }
247
248 ComponentUpdateService* TestingBrowserProcess::component_updater() {
249 return NULL;
250 }
251
252 void TestingBrowserProcess::SetLocalState(PrefService* local_state) {
253 if (!local_state && notification_ui_manager_.get())
254 notification_ui_manager_.reset(); // Used local_state_.
255 local_state_ = local_state;
256 }
257
258 void TestingBrowserProcess::SetGoogleURLTracker(
259 GoogleURLTracker* google_url_tracker) {
260 google_url_tracker_.reset(google_url_tracker);
261 }
262
263 void TestingBrowserProcess::SetIOThread(IOThread* io_thread) {
264 io_thread_ = io_thread;
265 }
266
267 void TestingBrowserProcess::SetDevToolsManager(DevToolsManager* manager) {
268 devtools_manager_.reset(manager);
269 }
270
271 ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() {
272 #if defined(OS_WIN)
273 // This is not really Windows-specific, the transition is just being done
274 // in stages, and Windows is first. See below for more info.
275 DCHECK(!g_browser_process);
276 #else
277 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062.
278 // ChromeTestSuite sets up a global TestingBrowserProcess
279 // for all tests. We need to get rid of it, because it contains
280 // a NotificationService, and there can be only one NotificationService
281 // per thread.
282 DCHECK(g_browser_process);
283 delete g_browser_process;
284 #endif
285 browser_process_.reset(new TestingBrowserProcess);
286 g_browser_process = browser_process_.get();
287 }
288
289 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() {
290 DCHECK_EQ(browser_process_.get(), g_browser_process);
291
292 #if defined(OS_WIN)
293 // This is not really Windows-specific, the transition is just being done
294 // in stages, and Windows is first. See below for more info.
295 g_browser_process = NULL;
296 #else
297 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062.
298 // After the transition is over, we should just
299 // reset |g_browser_process| to NULL.
300 browser_process_.reset();
301 g_browser_process = new TestingBrowserProcess();
302 #endif
303 }
OLDNEW
« no previous file with comments | « chrome/test/testing_browser_process.h ('k') | chrome/test/testing_browser_process_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698