| 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 #include "chrome/test/testing_browser_process.h" | 5 #include "chrome/test/testing_browser_process.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "chrome/browser/google/google_url_tracker.h" | 9 #include "chrome/browser/google/google_url_tracker.h" |
| 10 #include "chrome/browser/notifications/notification_ui_manager.h" | 10 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 11 #include "chrome/browser/policy/browser_policy_connector.h" | 11 #include "chrome/browser/policy/browser_policy_connector.h" |
| 12 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 12 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 13 #include "chrome/browser/policy/configuration_policy_provider.h" | 13 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 14 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" | 14 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/printing/background_printing_manager.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 18 #include "ui/base/clipboard/clipboard.h" | 19 #include "ui/base/clipboard/clipboard.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 21 |
| 21 TestingBrowserProcess::TestingBrowserProcess() | 22 TestingBrowserProcess::TestingBrowserProcess() |
| 22 : shutdown_event_(new base::WaitableEvent(true, false)), | 23 : shutdown_event_(new base::WaitableEvent(true, false)), |
| 23 module_ref_count_(0), | 24 module_ref_count_(0), |
| 24 app_locale_("en"), | 25 app_locale_("en"), |
| 25 local_state_(NULL) { | 26 local_state_(NULL) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 172 } |
| 172 | 173 |
| 173 void TestingBrowserProcess::InitDevToolsLegacyProtocolHandler(int port) { | 174 void TestingBrowserProcess::InitDevToolsLegacyProtocolHandler(int port) { |
| 174 } | 175 } |
| 175 | 176 |
| 176 unsigned int TestingBrowserProcess::AddRefModule() { | 177 unsigned int TestingBrowserProcess::AddRefModule() { |
| 177 return ++module_ref_count_; | 178 return ++module_ref_count_; |
| 178 } | 179 } |
| 179 | 180 |
| 180 unsigned int TestingBrowserProcess::ReleaseModule() { | 181 unsigned int TestingBrowserProcess::ReleaseModule() { |
| 181 DCHECK(module_ref_count_ > 0); | 182 DCHECK_GT(module_ref_count_, 0U); |
| 182 return --module_ref_count_; | 183 return --module_ref_count_; |
| 183 } | 184 } |
| 184 | 185 |
| 185 bool TestingBrowserProcess::IsShuttingDown() { | 186 bool TestingBrowserProcess::IsShuttingDown() { |
| 186 return false; | 187 return false; |
| 187 } | 188 } |
| 188 | 189 |
| 189 printing::PrintJobManager* TestingBrowserProcess::print_job_manager() { | 190 printing::PrintJobManager* TestingBrowserProcess::print_job_manager() { |
| 190 return NULL; | 191 return NULL; |
| 191 } | 192 } |
| 192 | 193 |
| 193 printing::PrintPreviewTabController* | 194 printing::PrintPreviewTabController* |
| 194 TestingBrowserProcess::print_preview_tab_controller() { | 195 TestingBrowserProcess::print_preview_tab_controller() { |
| 195 return NULL; | 196 return NULL; |
| 196 } | 197 } |
| 197 | 198 |
| 199 printing::BackgroundPrintingManager* |
| 200 TestingBrowserProcess::background_printing_manager() { |
| 201 if (!background_printing_manager_.get()) { |
| 202 background_printing_manager_.reset( |
| 203 new printing::BackgroundPrintingManager()); |
| 204 } |
| 205 return background_printing_manager_.get(); |
| 206 } |
| 207 |
| 198 const std::string& TestingBrowserProcess::GetApplicationLocale() { | 208 const std::string& TestingBrowserProcess::GetApplicationLocale() { |
| 199 return app_locale_; | 209 return app_locale_; |
| 200 } | 210 } |
| 201 | 211 |
| 202 void TestingBrowserProcess::SetApplicationLocale( | 212 void TestingBrowserProcess::SetApplicationLocale( |
| 203 const std::string& app_locale) { | 213 const std::string& app_locale) { |
| 204 app_locale_ = app_locale; | 214 app_locale_ = app_locale; |
| 205 } | 215 } |
| 206 | 216 |
| 207 DownloadStatusUpdater* TestingBrowserProcess::download_status_updater() { | 217 DownloadStatusUpdater* TestingBrowserProcess::download_status_updater() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 254 |
| 245 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { | 255 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { |
| 246 DCHECK_EQ(browser_process_.get(), g_browser_process); | 256 DCHECK_EQ(browser_process_.get(), g_browser_process); |
| 247 | 257 |
| 248 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 258 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
| 249 // After the transition is over, we should just | 259 // After the transition is over, we should just |
| 250 // reset |g_browser_process| to NULL. | 260 // reset |g_browser_process| to NULL. |
| 251 browser_process_.reset(); | 261 browser_process_.reset(); |
| 252 g_browser_process = new TestingBrowserProcess(); | 262 g_browser_process = new TestingBrowserProcess(); |
| 253 } | 263 } |
| OLD | NEW |