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