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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 #endif | 117 #endif |
118 virtual MHTMLGenerationManager* mhtml_generation_manager(); | 118 virtual MHTMLGenerationManager* mhtml_generation_manager(); |
119 virtual GpuBlacklistUpdater* gpu_blacklist_updater(); | 119 virtual GpuBlacklistUpdater* gpu_blacklist_updater(); |
120 | 120 |
121 // Set the local state for tests. Consumer is responsible for cleaning it up | 121 // Set the local state for tests. Consumer is responsible for cleaning it up |
122 // afterwards (using ScopedTestingLocalState, for example). | 122 // afterwards (using ScopedTestingLocalState, for example). |
123 void SetLocalState(PrefService* local_state); | 123 void SetLocalState(PrefService* local_state); |
124 void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker); | 124 void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker); |
125 void SetProfileManager(ProfileManager* profile_manager); | 125 void SetProfileManager(ProfileManager* profile_manager); |
126 void SetIOThread(IOThread* io_thread); | 126 void SetIOThread(IOThread* io_thread); |
| 127 void SetDevToolsManager(DevToolsManager*); |
127 | 128 |
128 private: | 129 private: |
129 NotificationService notification_service_; | 130 NotificationService notification_service_; |
130 unsigned int module_ref_count_; | 131 unsigned int module_ref_count_; |
131 scoped_ptr<ui::Clipboard> clipboard_; | 132 scoped_ptr<ui::Clipboard> clipboard_; |
132 std::string app_locale_; | 133 std::string app_locale_; |
133 | 134 |
134 // Weak pointer. | 135 // Weak pointer. |
135 PrefService* local_state_; | 136 PrefService* local_state_; |
136 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; | 137 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; |
137 scoped_ptr<GoogleURLTracker> google_url_tracker_; | 138 scoped_ptr<GoogleURLTracker> google_url_tracker_; |
138 scoped_ptr<ProfileManager> profile_manager_; | 139 scoped_ptr<ProfileManager> profile_manager_; |
139 scoped_ptr<NotificationUIManager> notification_ui_manager_; | 140 scoped_ptr<NotificationUIManager> notification_ui_manager_; |
140 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; | 141 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; |
141 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; | 142 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; |
142 IOThread* io_thread_; | 143 IOThread* io_thread_; |
| 144 DevToolsManager* devtools_manager_; |
143 | 145 |
144 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 146 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
145 }; | 147 }; |
146 | 148 |
147 // Scoper to put a TestingBrowserProcess in |g_browser_process|. | 149 // Scoper to put a TestingBrowserProcess in |g_browser_process|. |
148 class ScopedTestingBrowserProcess { | 150 class ScopedTestingBrowserProcess { |
149 public: | 151 public: |
150 ScopedTestingBrowserProcess(); | 152 ScopedTestingBrowserProcess(); |
151 ~ScopedTestingBrowserProcess(); | 153 ~ScopedTestingBrowserProcess(); |
152 | 154 |
153 TestingBrowserProcess* get() { | 155 TestingBrowserProcess* get() { |
154 return browser_process_.get(); | 156 return browser_process_.get(); |
155 } | 157 } |
156 | 158 |
157 private: | 159 private: |
158 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 160 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
159 // After the transition is over, we should just stack-allocate it. | 161 // After the transition is over, we should just stack-allocate it. |
160 scoped_ptr<TestingBrowserProcess> browser_process_; | 162 scoped_ptr<TestingBrowserProcess> browser_process_; |
161 | 163 |
162 DISALLOW_COPY_AND_ASSIGN(ScopedTestingBrowserProcess); | 164 DISALLOW_COPY_AND_ASSIGN(ScopedTestingBrowserProcess); |
163 }; | 165 }; |
164 | 166 |
165 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_ | 167 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_ |
OLD | NEW |