OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_TESTING_BROWSER_PROCESS_H_ | 10 #ifndef CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual void ResourceDispatcherHostCreated() OVERRIDE; | 57 virtual void ResourceDispatcherHostCreated() OVERRIDE; |
58 virtual void EndSession() OVERRIDE; | 58 virtual void EndSession() OVERRIDE; |
59 virtual MetricsService* metrics_service() OVERRIDE; | 59 virtual MetricsService* metrics_service() OVERRIDE; |
60 virtual rappor::RapporService* rappor_service() OVERRIDE; | 60 virtual rappor::RapporService* rappor_service() OVERRIDE; |
61 virtual IOThread* io_thread() OVERRIDE; | 61 virtual IOThread* io_thread() OVERRIDE; |
62 virtual WatchDogThread* watchdog_thread() OVERRIDE; | 62 virtual WatchDogThread* watchdog_thread() OVERRIDE; |
63 virtual ProfileManager* profile_manager() OVERRIDE; | 63 virtual ProfileManager* profile_manager() OVERRIDE; |
64 virtual PrefService* local_state() OVERRIDE; | 64 virtual PrefService* local_state() OVERRIDE; |
65 virtual chrome_variations::VariationsService* variations_service() OVERRIDE; | 65 virtual chrome_variations::VariationsService* variations_service() OVERRIDE; |
66 virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; | 66 virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; |
| 67 virtual bool is_browser_policy_connector_created() OVERRIDE; |
67 virtual policy::PolicyService* policy_service() OVERRIDE; | 68 virtual policy::PolicyService* policy_service() OVERRIDE; |
68 virtual IconManager* icon_manager() OVERRIDE; | 69 virtual IconManager* icon_manager() OVERRIDE; |
69 virtual GLStringManager* gl_string_manager() OVERRIDE; | 70 virtual GLStringManager* gl_string_manager() OVERRIDE; |
70 virtual GpuModeManager* gpu_mode_manager() OVERRIDE; | 71 virtual GpuModeManager* gpu_mode_manager() OVERRIDE; |
71 virtual BackgroundModeManager* background_mode_manager() OVERRIDE; | 72 virtual BackgroundModeManager* background_mode_manager() OVERRIDE; |
72 virtual void set_background_mode_manager_for_test( | 73 virtual void set_background_mode_manager_for_test( |
73 scoped_ptr<BackgroundModeManager> manager) OVERRIDE; | 74 scoped_ptr<BackgroundModeManager> manager) OVERRIDE; |
74 virtual StatusTray* status_tray() OVERRIDE; | 75 virtual StatusTray* status_tray() OVERRIDE; |
75 virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; | 76 virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; |
76 virtual safe_browsing::ClientSideDetectionService* | 77 virtual safe_browsing::ClientSideDetectionService* |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 164 |
164 // The following objects are not owned by TestingBrowserProcess: | 165 // The following objects are not owned by TestingBrowserProcess: |
165 PrefService* local_state_; | 166 PrefService* local_state_; |
166 IOThread* io_thread_; | 167 IOThread* io_thread_; |
167 net::URLRequestContextGetter* system_request_context_; | 168 net::URLRequestContextGetter* system_request_context_; |
168 | 169 |
169 scoped_ptr<BrowserProcessPlatformPart> platform_part_; | 170 scoped_ptr<BrowserProcessPlatformPart> platform_part_; |
170 | 171 |
171 scoped_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_; | 172 scoped_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_; |
172 | 173 |
| 174 bool created_browser_policy_connector_; |
| 175 |
173 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 176 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
174 }; | 177 }; |
175 | 178 |
176 // RAII (resource acquisition is initialization) for TestingBrowserProcess. | 179 // RAII (resource acquisition is initialization) for TestingBrowserProcess. |
177 // Allows you to initialize TestingBrowserProcess/NotificationService before | 180 // Allows you to initialize TestingBrowserProcess/NotificationService before |
178 // other member variables. | 181 // other member variables. |
179 // | 182 // |
180 // This can be helpful if you are running a unit test inside the browser_tests | 183 // This can be helpful if you are running a unit test inside the browser_tests |
181 // suite because browser_tests do not make a TestingBrowserProcess for you. | 184 // suite because browser_tests do not make a TestingBrowserProcess for you. |
182 // | 185 // |
183 // class MyUnitTestRunningAsBrowserTest : public testing::Test { | 186 // class MyUnitTestRunningAsBrowserTest : public testing::Test { |
184 // ...stuff... | 187 // ...stuff... |
185 // private: | 188 // private: |
186 // TestingBrowserProcessInitializer initializer_; | 189 // TestingBrowserProcessInitializer initializer_; |
187 // LocalState local_state_; // Needs a BrowserProcess to initialize. | 190 // LocalState local_state_; // Needs a BrowserProcess to initialize. |
188 // NotificationRegistrar registar_; // Needs NotificationService. | 191 // NotificationRegistrar registar_; // Needs NotificationService. |
189 // }; | 192 // }; |
190 class TestingBrowserProcessInitializer { | 193 class TestingBrowserProcessInitializer { |
191 public: | 194 public: |
192 TestingBrowserProcessInitializer(); | 195 TestingBrowserProcessInitializer(); |
193 ~TestingBrowserProcessInitializer(); | 196 ~TestingBrowserProcessInitializer(); |
194 | 197 |
195 private: | 198 private: |
196 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcessInitializer); | 199 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcessInitializer); |
197 }; | 200 }; |
198 | 201 |
199 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ | 202 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ |
OLD | NEW |