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

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

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/live_sync/live_sync_test.cc ('k') | chrome/test/testing_browser_process.cc » ('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 // An implementation of BrowserProcess for unit tests that fails for most
6 // services. By preventing creation of services, we reduce dependencies and
7 // keep the profile clean. Clients of this class must handle the NULL return
8 // value, however.
9
10 #ifndef CHROME_TEST_TESTING_BROWSER_PROCESS_H_
11 #define CHROME_TEST_TESTING_BROWSER_PROCESS_H_
12 #pragma once
13
14 #include <string>
15
16 #include "base/memory/scoped_ptr.h"
17 #include "build/build_config.h"
18 #include "chrome/browser/browser_process.h"
19 #include "content/common/notification_service.h"
20
21 class BackgroundModeManager;
22 class IOThread;
23 class GoogleURLTracker;
24 class MHTMLGenerationManager;
25 class NotificationUIManager;
26 class PrefService;
27 class WatchDogThread;
28
29 namespace base {
30 class WaitableEvent;
31 }
32
33 namespace policy {
34 class BrowserPolicyConnector;
35 }
36
37 namespace prerender {
38 class PrerenderTracker;
39 }
40
41 namespace ui {
42 class Clipboard;
43 }
44
45 class TestingBrowserProcess : public BrowserProcess {
46 public:
47 TestingBrowserProcess();
48 virtual ~TestingBrowserProcess();
49
50 virtual void EndSession();
51 virtual ResourceDispatcherHost* resource_dispatcher_host();
52 virtual MetricsService* metrics_service();
53 virtual IOThread* io_thread();
54
55 virtual base::Thread* file_thread();
56 virtual base::Thread* db_thread();
57 virtual base::Thread* cache_thread();
58 virtual WatchDogThread* watchdog_thread();
59
60 #if defined(OS_CHROMEOS)
61 virtual base::Thread* web_socket_proxy_thread();
62 #endif
63
64 virtual ProfileManager* profile_manager();
65 virtual PrefService* local_state();
66 virtual policy::BrowserPolicyConnector* browser_policy_connector();
67 virtual IconManager* icon_manager();
68 virtual ThumbnailGenerator* GetThumbnailGenerator();
69 virtual DevToolsManager* devtools_manager();
70 virtual SidebarManager* sidebar_manager();
71 virtual TabCloseableStateWatcher* tab_closeable_state_watcher();
72 virtual BackgroundModeManager* background_mode_manager();
73 virtual StatusTray* status_tray();
74 virtual SafeBrowsingService* safe_browsing_service();
75 virtual safe_browsing::ClientSideDetectionService*
76 safe_browsing_detection_service();
77 virtual net::URLRequestContextGetter* system_request_context();
78
79 #if defined(OS_CHROMEOS)
80 virtual chromeos::ProxyConfigServiceImpl*
81 chromeos_proxy_config_service_impl();
82 #endif // defined(OS_CHROMEOS)
83
84 virtual ui::Clipboard* clipboard();
85 virtual ExtensionEventRouterForwarder* extension_event_router_forwarder();
86 virtual NotificationUIManager* notification_ui_manager();
87 virtual GoogleURLTracker* google_url_tracker();
88 virtual IntranetRedirectDetector* intranet_redirect_detector();
89 virtual AutomationProviderList* InitAutomationProviderList();
90 virtual void InitDevToolsHttpProtocolHandler(
91 Profile* profile,
92 const std::string& ip,
93 int port,
94 const std::string& frontend_url);
95 virtual void InitDevToolsLegacyProtocolHandler(int port);
96 virtual unsigned int AddRefModule();
97 virtual unsigned int ReleaseModule();
98 virtual bool IsShuttingDown();
99 virtual printing::PrintJobManager* print_job_manager();
100 virtual printing::PrintPreviewTabController* print_preview_tab_controller();
101 virtual printing::BackgroundPrintingManager* background_printing_manager();
102 virtual const std::string& GetApplicationLocale();
103 virtual void SetApplicationLocale(const std::string& app_locale);
104 virtual DownloadStatusUpdater* download_status_updater();
105 virtual bool plugin_finder_disabled() const;
106 virtual void CheckForInspectorFiles() {}
107
108 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
109 virtual void StartAutoupdateTimer() {}
110 #endif
111
112 virtual ChromeNetLog* net_log();
113 virtual prerender::PrerenderTracker* prerender_tracker();
114
115 #if defined(IPC_MESSAGE_LOG_ENABLED)
116 virtual void SetIPCLoggingEnabled(bool enable) {}
117 #endif
118 virtual MHTMLGenerationManager* mhtml_generation_manager();
119 virtual GpuBlacklistUpdater* gpu_blacklist_updater();
120 virtual ComponentUpdateService* component_updater();
121
122 // Set the local state for tests. Consumer is responsible for cleaning it up
123 // afterwards (using ScopedTestingLocalState, for example).
124 void SetLocalState(PrefService* local_state);
125 void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker);
126 void SetProfileManager(ProfileManager* profile_manager);
127 void SetIOThread(IOThread* io_thread);
128 void SetDevToolsManager(DevToolsManager*);
129
130 private:
131 NotificationService notification_service_;
132 unsigned int module_ref_count_;
133 scoped_ptr<ui::Clipboard> clipboard_;
134 std::string app_locale_;
135
136 // Weak pointer.
137 PrefService* local_state_;
138 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_;
139 scoped_ptr<GoogleURLTracker> google_url_tracker_;
140 scoped_ptr<ProfileManager> profile_manager_;
141 scoped_ptr<NotificationUIManager> notification_ui_manager_;
142 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_;
143 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_;
144 IOThread* io_thread_;
145 scoped_ptr<DevToolsManager> devtools_manager_;
146
147 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess);
148 };
149
150 // Scoper to put a TestingBrowserProcess in |g_browser_process|.
151 class ScopedTestingBrowserProcess {
152 public:
153 ScopedTestingBrowserProcess();
154 ~ScopedTestingBrowserProcess();
155
156 TestingBrowserProcess* get() {
157 return browser_process_.get();
158 }
159
160 private:
161 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062.
162 // After the transition is over, we should just stack-allocate it.
163 scoped_ptr<TestingBrowserProcess> browser_process_;
164
165 DISALLOW_COPY_AND_ASSIGN(ScopedTestingBrowserProcess);
166 };
167
168 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_
OLDNEW
« no previous file with comments | « chrome/test/live_sync/live_sync_test.cc ('k') | chrome/test/testing_browser_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698