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_ |
11 #define CHROME_TEST_TESTING_BROWSER_PROCESS_H_ | 11 #define CHROME_TEST_TESTING_BROWSER_PROCESS_H_ |
12 #pragma once | 12 #pragma once |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
19 #include "content/common/notification_service.h" | 19 #include "content/common/notification_service.h" |
20 | 20 |
21 class BackgroundModeManager; | 21 class BackgroundModeManager; |
22 class IOThread; | 22 class IOThread; |
23 class GoogleURLTracker; | 23 class GoogleURLTracker; |
| 24 class MHTMLGenerationManager; |
24 class NotificationUIManager; | 25 class NotificationUIManager; |
25 class PrefService; | 26 class PrefService; |
26 class WatchDogThread; | 27 class WatchDogThread; |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 class WaitableEvent; | 30 class WaitableEvent; |
30 } | 31 } |
31 | 32 |
32 namespace policy { | 33 namespace policy { |
33 class BrowserPolicyConnector; | 34 class BrowserPolicyConnector; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 108 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
108 virtual void StartAutoupdateTimer() {} | 109 virtual void StartAutoupdateTimer() {} |
109 #endif | 110 #endif |
110 | 111 |
111 virtual ChromeNetLog* net_log(); | 112 virtual ChromeNetLog* net_log(); |
112 virtual prerender::PrerenderTracker* prerender_tracker(); | 113 virtual prerender::PrerenderTracker* prerender_tracker(); |
113 | 114 |
114 #if defined(IPC_MESSAGE_LOG_ENABLED) | 115 #if defined(IPC_MESSAGE_LOG_ENABLED) |
115 virtual void SetIPCLoggingEnabled(bool enable) {} | 116 virtual void SetIPCLoggingEnabled(bool enable) {} |
116 #endif | 117 #endif |
| 118 virtual MHTMLGenerationManager* mhtml_generation_manager(); |
117 | 119 |
118 // Set the local state for tests. Consumer is responsible for cleaning it up | 120 // Set the local state for tests. Consumer is responsible for cleaning it up |
119 // afterwards (using ScopedTestingLocalState, for example). | 121 // afterwards (using ScopedTestingLocalState, for example). |
120 void SetLocalState(PrefService* local_state); | 122 void SetLocalState(PrefService* local_state); |
121 void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker); | 123 void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker); |
122 void SetProfileManager(ProfileManager* profile_manager); | 124 void SetProfileManager(ProfileManager* profile_manager); |
123 | 125 |
124 private: | 126 private: |
125 NotificationService notification_service_; | 127 NotificationService notification_service_; |
126 scoped_ptr<base::WaitableEvent> shutdown_event_; | 128 scoped_ptr<base::WaitableEvent> shutdown_event_; |
127 unsigned int module_ref_count_; | 129 unsigned int module_ref_count_; |
128 scoped_ptr<ui::Clipboard> clipboard_; | 130 scoped_ptr<ui::Clipboard> clipboard_; |
129 std::string app_locale_; | 131 std::string app_locale_; |
130 | 132 |
131 // Weak pointer. | 133 // Weak pointer. |
132 PrefService* local_state_; | 134 PrefService* local_state_; |
133 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; | 135 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; |
134 scoped_ptr<GoogleURLTracker> google_url_tracker_; | 136 scoped_ptr<GoogleURLTracker> google_url_tracker_; |
135 scoped_ptr<ProfileManager> profile_manager_; | 137 scoped_ptr<ProfileManager> profile_manager_; |
136 scoped_ptr<NotificationUIManager> notification_ui_manager_; | 138 scoped_ptr<NotificationUIManager> notification_ui_manager_; |
137 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; | 139 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; |
138 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; | 140 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; |
| 141 scoped_ptr<MHTMLGenerationManager> mhtml_generation_manager_; |
139 | 142 |
140 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 143 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
141 }; | 144 }; |
142 | 145 |
143 // Scoper to put a TestingBrowserProcess in |g_browser_process|. | 146 // Scoper to put a TestingBrowserProcess in |g_browser_process|. |
144 class ScopedTestingBrowserProcess { | 147 class ScopedTestingBrowserProcess { |
145 public: | 148 public: |
146 ScopedTestingBrowserProcess(); | 149 ScopedTestingBrowserProcess(); |
147 ~ScopedTestingBrowserProcess(); | 150 ~ScopedTestingBrowserProcess(); |
148 | 151 |
149 TestingBrowserProcess* get() { | 152 TestingBrowserProcess* get() { |
150 return browser_process_.get(); | 153 return browser_process_.get(); |
151 } | 154 } |
152 | 155 |
153 private: | 156 private: |
154 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 157 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
155 // After the transition is over, we should just stack-allocate it. | 158 // After the transition is over, we should just stack-allocate it. |
156 scoped_ptr<TestingBrowserProcess> browser_process_; | 159 scoped_ptr<TestingBrowserProcess> browser_process_; |
157 | 160 |
158 DISALLOW_COPY_AND_ASSIGN(ScopedTestingBrowserProcess); | 161 DISALLOW_COPY_AND_ASSIGN(ScopedTestingBrowserProcess); |
159 }; | 162 }; |
160 | 163 |
161 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_ | 164 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_ |
OLD | NEW |