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 // An implementation of BrowserProcess for unit tests that fails for most | 5 // An implementation of BrowserProcess for unit tests that fails for most |
6 // services. By preventing creation of services, we reduce dependencies and | 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 | 7 // keep the profile clean. Clients of this class must handle the NULL return |
8 // value, however. | 8 // value, however. |
9 | 9 |
10 #ifndef CHROME_TEST_TESTING_BROWSER_PROCESS_H_ | 10 #ifndef CHROME_TEST_TESTING_BROWSER_PROCESS_H_ |
(...skipping 14 matching lines...) Expand all Loading... |
25 class WatchDogThread; | 25 class WatchDogThread; |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 class WaitableEvent; | 28 class WaitableEvent; |
29 } | 29 } |
30 | 30 |
31 namespace policy { | 31 namespace policy { |
32 class BrowserPolicyConnector; | 32 class BrowserPolicyConnector; |
33 } | 33 } |
34 | 34 |
| 35 namespace prerender { |
| 36 class PrerenderTracker; |
| 37 } |
| 38 |
35 namespace ui { | 39 namespace ui { |
36 class Clipboard; | 40 class Clipboard; |
37 } | 41 } |
38 | 42 |
39 class TestingBrowserProcess : public BrowserProcess { | 43 class TestingBrowserProcess : public BrowserProcess { |
40 public: | 44 public: |
41 TestingBrowserProcess(); | 45 TestingBrowserProcess(); |
42 virtual ~TestingBrowserProcess(); | 46 virtual ~TestingBrowserProcess(); |
43 | 47 |
44 virtual void EndSession(); | 48 virtual void EndSession(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 virtual bool plugin_finder_disabled() const; | 138 virtual bool plugin_finder_disabled() const; |
135 | 139 |
136 virtual void CheckForInspectorFiles() {} | 140 virtual void CheckForInspectorFiles() {} |
137 | 141 |
138 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 142 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
139 virtual void StartAutoupdateTimer() {} | 143 virtual void StartAutoupdateTimer() {} |
140 #endif | 144 #endif |
141 | 145 |
142 virtual ChromeNetLog* net_log(); | 146 virtual ChromeNetLog* net_log(); |
143 | 147 |
| 148 virtual prerender::PrerenderTracker* prerender_tracker(); |
| 149 |
144 #if defined(IPC_MESSAGE_LOG_ENABLED) | 150 #if defined(IPC_MESSAGE_LOG_ENABLED) |
145 virtual void SetIPCLoggingEnabled(bool enable) {} | 151 virtual void SetIPCLoggingEnabled(bool enable) {} |
146 #endif | 152 #endif |
147 | 153 |
148 // Set the local state for tests. Consumer is responsible for cleaning it up | 154 // Set the local state for tests. Consumer is responsible for cleaning it up |
149 // afterwards (using ScopedTestingLocalState, for example). | 155 // afterwards (using ScopedTestingLocalState, for example). |
150 void SetLocalState(PrefService* local_state); | 156 void SetLocalState(PrefService* local_state); |
151 void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker); | 157 void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker); |
152 void SetProfileManager(ProfileManager* profile_manager); | 158 void SetProfileManager(ProfileManager* profile_manager); |
153 | 159 |
154 private: | 160 private: |
155 NotificationService notification_service_; | 161 NotificationService notification_service_; |
156 scoped_ptr<base::WaitableEvent> shutdown_event_; | 162 scoped_ptr<base::WaitableEvent> shutdown_event_; |
157 unsigned int module_ref_count_; | 163 unsigned int module_ref_count_; |
158 scoped_ptr<ui::Clipboard> clipboard_; | 164 scoped_ptr<ui::Clipboard> clipboard_; |
159 std::string app_locale_; | 165 std::string app_locale_; |
160 | 166 |
161 // Weak pointer. | 167 // Weak pointer. |
162 PrefService* local_state_; | 168 PrefService* local_state_; |
163 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; | 169 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; |
164 scoped_ptr<GoogleURLTracker> google_url_tracker_; | 170 scoped_ptr<GoogleURLTracker> google_url_tracker_; |
165 scoped_ptr<ProfileManager> profile_manager_; | 171 scoped_ptr<ProfileManager> profile_manager_; |
166 scoped_ptr<NotificationUIManager> notification_ui_manager_; | 172 scoped_ptr<NotificationUIManager> notification_ui_manager_; |
167 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; | 173 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; |
| 174 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; |
168 | 175 |
169 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 176 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
170 }; | 177 }; |
171 | 178 |
172 // Scoper to put a TestingBrowserProcess in |g_browser_process|. | 179 // Scoper to put a TestingBrowserProcess in |g_browser_process|. |
173 class ScopedTestingBrowserProcess { | 180 class ScopedTestingBrowserProcess { |
174 public: | 181 public: |
175 ScopedTestingBrowserProcess(); | 182 ScopedTestingBrowserProcess(); |
176 ~ScopedTestingBrowserProcess(); | 183 ~ScopedTestingBrowserProcess(); |
177 | 184 |
178 TestingBrowserProcess* get() { | 185 TestingBrowserProcess* get() { |
179 return browser_process_.get(); | 186 return browser_process_.get(); |
180 } | 187 } |
181 | 188 |
182 private: | 189 private: |
183 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 190 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
184 // After the transition is over, we should just stack-allocate it. | 191 // After the transition is over, we should just stack-allocate it. |
185 scoped_ptr<TestingBrowserProcess> browser_process_; | 192 scoped_ptr<TestingBrowserProcess> browser_process_; |
186 | 193 |
187 DISALLOW_COPY_AND_ASSIGN(ScopedTestingBrowserProcess); | 194 DISALLOW_COPY_AND_ASSIGN(ScopedTestingBrowserProcess); |
188 }; | 195 }; |
189 | 196 |
190 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_ | 197 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_ |
OLD | NEW |