| 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/net/pref_proxy_config_service.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 12 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 12 #include "chrome/browser/policy/configuration_policy_provider.h" | 13 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 13 #include "chrome/browser/policy/configuration_policy_provider_keeper.h" | 14 #include "chrome/browser/policy/configuration_policy_provider_keeper.h" |
| 14 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" | 15 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" |
| 16 #include "chrome/common/net/url_request_context_getter.h" |
| 15 #include "ui/base/clipboard/clipboard.h" | 17 #include "ui/base/clipboard/clipboard.h" |
| 16 | 18 |
| 17 TestingBrowserProcess::TestingBrowserProcess() | 19 TestingBrowserProcess::TestingBrowserProcess() |
| 18 : shutdown_event_(new base::WaitableEvent(true, false)), | 20 : shutdown_event_(new base::WaitableEvent(true, false)), |
| 19 module_ref_count_(0), | 21 module_ref_count_(0), |
| 20 app_locale_("en"), | 22 app_locale_("en"), |
| 21 pref_service_(NULL), | 23 pref_service_(NULL), |
| 22 created_configuration_policy_provider_keeper_(false) { | 24 created_configuration_policy_provider_keeper_(false) { |
| 23 } | 25 } |
| 24 | 26 |
| 25 TestingBrowserProcess::~TestingBrowserProcess() { | 27 TestingBrowserProcess::~TestingBrowserProcess() { |
| 28 pref_proxy_config_tracker_ = NULL; |
| 26 } | 29 } |
| 27 | 30 |
| 28 void TestingBrowserProcess::EndSession() { | 31 void TestingBrowserProcess::EndSession() { |
| 29 } | 32 } |
| 30 | 33 |
| 31 ResourceDispatcherHost* TestingBrowserProcess::resource_dispatcher_host() { | 34 ResourceDispatcherHost* TestingBrowserProcess::resource_dispatcher_host() { |
| 32 return NULL; | 35 return NULL; |
| 33 } | 36 } |
| 34 | 37 |
| 35 MetricsService* TestingBrowserProcess::metrics_service() { | 38 MetricsService* TestingBrowserProcess::metrics_service() { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 104 |
| 102 TabCloseableStateWatcher* TestingBrowserProcess::tab_closeable_state_watcher() { | 105 TabCloseableStateWatcher* TestingBrowserProcess::tab_closeable_state_watcher() { |
| 103 return NULL; | 106 return NULL; |
| 104 } | 107 } |
| 105 | 108 |
| 106 safe_browsing::ClientSideDetectionService* | 109 safe_browsing::ClientSideDetectionService* |
| 107 TestingBrowserProcess::safe_browsing_detection_service() { | 110 TestingBrowserProcess::safe_browsing_detection_service() { |
| 108 return NULL; | 111 return NULL; |
| 109 } | 112 } |
| 110 | 113 |
| 114 PrefProxyConfigTracker* TestingBrowserProcess::pref_proxy_config_tracker() { |
| 115 if (!pref_proxy_config_tracker_.get()) { |
| 116 pref_proxy_config_tracker_ = |
| 117 new PrefProxyConfigTracker(local_state()); |
| 118 } |
| 119 return pref_proxy_config_tracker_.get(); |
| 120 } |
| 121 |
| 122 scoped_refptr<URLRequestContextGetter> |
| 123 TestingBrowserProcess::system_request_context() { |
| 124 return NULL; |
| 125 } |
| 126 |
| 127 #if defined(OS_CHROMEOS) |
| 128 chromeos::ProxyConfigServiceImpl* |
| 129 TestingBrowserProcess::chromeos_proxy_config_service_impl() { |
| 130 return NULL; |
| 131 } |
| 132 #endif // defined(OS_CHROMEOS) |
| 133 |
| 111 ui::Clipboard* TestingBrowserProcess::clipboard() { | 134 ui::Clipboard* TestingBrowserProcess::clipboard() { |
| 112 if (!clipboard_.get()) { | 135 if (!clipboard_.get()) { |
| 113 // Note that we need a MessageLoop for the next call to work. | 136 // Note that we need a MessageLoop for the next call to work. |
| 114 clipboard_.reset(new ui::Clipboard); | 137 clipboard_.reset(new ui::Clipboard); |
| 115 } | 138 } |
| 116 return clipboard_.get(); | 139 return clipboard_.get(); |
| 117 } | 140 } |
| 118 | 141 |
| 119 NotificationUIManager* TestingBrowserProcess::notification_ui_manager() { | 142 NotificationUIManager* TestingBrowserProcess::notification_ui_manager() { |
| 120 return NULL; | 143 return NULL; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 235 |
| 213 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { | 236 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { |
| 214 DCHECK_EQ(browser_process_.get(), g_browser_process); | 237 DCHECK_EQ(browser_process_.get(), g_browser_process); |
| 215 | 238 |
| 216 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 239 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
| 217 // After the transition is over, we should just | 240 // After the transition is over, we should just |
| 218 // reset |g_browser_process| to NULL. | 241 // reset |g_browser_process| to NULL. |
| 219 browser_process_.reset(); | 242 browser_process_.reset(); |
| 220 g_browser_process = new TestingBrowserProcess(); | 243 g_browser_process = new TestingBrowserProcess(); |
| 221 } | 244 } |
| OLD | NEW |