| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 scoped_ptr<network_time::NetworkTimeTracker> network_time_tracker_; | 173 scoped_ptr<network_time::NetworkTimeTracker> network_time_tracker_; |
| 174 | 174 |
| 175 // The following objects are not owned by TestingBrowserProcess: | 175 // The following objects are not owned by TestingBrowserProcess: |
| 176 PrefService* local_state_; | 176 PrefService* local_state_; |
| 177 IOThread* io_thread_; | 177 IOThread* io_thread_; |
| 178 net::URLRequestContextGetter* system_request_context_; | 178 net::URLRequestContextGetter* system_request_context_; |
| 179 | 179 |
| 180 scoped_ptr<BrowserProcessPlatformPart> platform_part_; | 180 scoped_ptr<BrowserProcessPlatformPart> platform_part_; |
| 181 | 181 |
| 182 #if defined(ENABLE_EXTENSIONS) |
| 182 scoped_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_; | 183 scoped_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_; |
| 184 #endif |
| 183 | 185 |
| 184 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 186 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
| 185 }; | 187 }; |
| 186 | 188 |
| 187 // RAII (resource acquisition is initialization) for TestingBrowserProcess. | 189 // RAII (resource acquisition is initialization) for TestingBrowserProcess. |
| 188 // Allows you to initialize TestingBrowserProcess/NotificationService before | 190 // Allows you to initialize TestingBrowserProcess/NotificationService before |
| 189 // other member variables. | 191 // other member variables. |
| 190 // | 192 // |
| 191 // This can be helpful if you are running a unit test inside the browser_tests | 193 // This can be helpful if you are running a unit test inside the browser_tests |
| 192 // suite because browser_tests do not make a TestingBrowserProcess for you. | 194 // suite because browser_tests do not make a TestingBrowserProcess for you. |
| 193 // | 195 // |
| 194 // class MyUnitTestRunningAsBrowserTest : public testing::Test { | 196 // class MyUnitTestRunningAsBrowserTest : public testing::Test { |
| 195 // ...stuff... | 197 // ...stuff... |
| 196 // private: | 198 // private: |
| 197 // TestingBrowserProcessInitializer initializer_; | 199 // TestingBrowserProcessInitializer initializer_; |
| 198 // LocalState local_state_; // Needs a BrowserProcess to initialize. | 200 // LocalState local_state_; // Needs a BrowserProcess to initialize. |
| 199 // NotificationRegistrar registar_; // Needs NotificationService. | 201 // NotificationRegistrar registar_; // Needs NotificationService. |
| 200 // }; | 202 // }; |
| 201 class TestingBrowserProcessInitializer { | 203 class TestingBrowserProcessInitializer { |
| 202 public: | 204 public: |
| 203 TestingBrowserProcessInitializer(); | 205 TestingBrowserProcessInitializer(); |
| 204 ~TestingBrowserProcessInitializer(); | 206 ~TestingBrowserProcessInitializer(); |
| 205 | 207 |
| 206 private: | 208 private: |
| 207 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcessInitializer); | 209 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcessInitializer); |
| 208 }; | 210 }; |
| 209 | 211 |
| 210 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ | 212 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ |
| OLD | NEW |