Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: chrome/test/base/testing_browser_process.cc

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/test/base/testing_browser_process.h" 5 #include "chrome/test/base/testing_browser_process.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/notifications/notification_ui_manager.h" 8 #include "chrome/browser/notifications/notification_ui_manager.h"
9 #include "chrome/browser/policy/browser_policy_connector.h" 9 #include "chrome/browser/policy/browser_policy_connector.h"
10 #include "chrome/browser/policy/policy_service.h" 10 #include "chrome/browser/policy/policy_service.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/prerender/prerender_tracker.h" 12 #include "chrome/browser/prerender/prerender_tracker.h"
13 #include "chrome/browser/printing/background_printing_manager.h" 13 #include "chrome/browser/printing/background_printing_manager.h"
14 #include "chrome/browser/printing/print_preview_tab_controller.h" 14 #include "chrome/browser/printing/print_preview_tab_controller.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "net/url_request/url_request_context_getter.h" 18 #include "net/url_request/url_request_context_getter.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 #include "ui/base/clipboard/clipboard.h"
21 21
22 #if !defined(ENABLE_CONFIGURATION_POLICY) 22 #if !defined(ENABLE_CONFIGURATION_POLICY)
23 #include "chrome/browser/policy/policy_service_stub.h" 23 #include "chrome/browser/policy/policy_service_stub.h"
24 #endif // defined(ENABLE_CONFIGURATION_POLICY) 24 #endif // defined(ENABLE_CONFIGURATION_POLICY)
25 25
26 TestingBrowserProcess::TestingBrowserProcess() 26 TestingBrowserProcess::TestingBrowserProcess()
27 : notification_service_(content::NotificationService::Create()), 27 : notification_service_(content::NotificationService::Create()),
28 module_ref_count_(0), 28 module_ref_count_(0),
29 app_locale_("en"), 29 app_locale_("en"),
30 local_state_(NULL), 30 local_state_(NULL),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 chrome_variations::VariationsService* 68 chrome_variations::VariationsService*
69 TestingBrowserProcess::variations_service() { 69 TestingBrowserProcess::variations_service() {
70 return NULL; 70 return NULL;
71 } 71 }
72 72
73 policy::BrowserPolicyConnector* 73 policy::BrowserPolicyConnector*
74 TestingBrowserProcess::browser_policy_connector() { 74 TestingBrowserProcess::browser_policy_connector() {
75 #if defined(ENABLE_CONFIGURATION_POLICY) 75 #if defined(ENABLE_CONFIGURATION_POLICY)
76 if (!browser_policy_connector_.get()) { 76 if (!browser_policy_connector_.get())
77 browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); 77 browser_policy_connector_.reset(new policy::BrowserPolicyConnector());
78 browser_policy_connector_->Init();
79 }
80 #endif 78 #endif
81 return browser_policy_connector_.get(); 79 return browser_policy_connector_.get();
82 } 80 }
83 81
84 policy::PolicyService* TestingBrowserProcess::policy_service() { 82 policy::PolicyService* TestingBrowserProcess::policy_service() {
85 if (!policy_service_.get()) { 83 if (!policy_service_.get()) {
86 #if defined(ENABLE_CONFIGURATION_POLICY) 84 #if defined(ENABLE_CONFIGURATION_POLICY)
87 policy_service_ = browser_policy_connector()->CreatePolicyService(NULL); 85 policy_service_.reset(
86 browser_policy_connector()->CreatePolicyService(NULL));
88 #else 87 #else
89 policy_service_.reset(new policy::PolicyServiceStub()); 88 policy_service_.reset(new policy::PolicyServiceStub());
90 #endif 89 #endif
91 } 90 }
92 return policy_service_.get(); 91 return policy_service_.get();
93 } 92 }
94 93
95 IconManager* TestingBrowserProcess::icon_manager() { 94 IconManager* TestingBrowserProcess::icon_manager() {
96 return NULL; 95 return NULL;
97 } 96 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 242
244 ComponentUpdateService* TestingBrowserProcess::component_updater() { 243 ComponentUpdateService* TestingBrowserProcess::component_updater() {
245 return NULL; 244 return NULL;
246 } 245 }
247 246
248 CRLSetFetcher* TestingBrowserProcess::crl_set_fetcher() { 247 CRLSetFetcher* TestingBrowserProcess::crl_set_fetcher() {
249 return NULL; 248 return NULL;
250 } 249 }
251 250
252 void TestingBrowserProcess::SetLocalState(PrefService* local_state) { 251 void TestingBrowserProcess::SetLocalState(PrefService* local_state) {
253 if (!local_state) { 252 if (!local_state && notification_ui_manager_.get())
254 // The local_state_ PrefService is owned outside of TestingBrowserProcess, 253 notification_ui_manager_.reset(); // Used local_state_.
255 // but some of the members of TestingBrowserProcess hold references to it
256 // (for example, via PrefNotifier members). But given our test
257 // infrastructure which tears down individual tests before freeing the
258 // TestingBrowserProcess, there's not a good way to make local_state outlive
259 // these dependencies. As a workaround, whenever local_state_ is cleared
260 // (assumedly as part of exiting the test and freeing TestingBrowserProcess)
261 // any components owned by TestingBrowserProcess that depend on local_state
262 // are also freed.
263 notification_ui_manager_.reset();
264 browser_policy_connector_.reset();
265 }
266 local_state_ = local_state; 254 local_state_ = local_state;
267 } 255 }
268 256
269 void TestingBrowserProcess::SetIOThread(IOThread* io_thread) { 257 void TestingBrowserProcess::SetIOThread(IOThread* io_thread) {
270 io_thread_ = io_thread; 258 io_thread_ = io_thread;
271 } 259 }
272 260
273 void TestingBrowserProcess::SetBrowserPolicyConnector( 261 void TestingBrowserProcess::SetBrowserPolicyConnector(
274 policy::BrowserPolicyConnector* connector) { 262 policy::BrowserPolicyConnector* connector) {
275 browser_policy_connector_.reset(connector); 263 browser_policy_connector_.reset(connector);
276 } 264 }
277 265
278 void TestingBrowserProcess::SetSafeBrowsingService( 266 void TestingBrowserProcess::SetSafeBrowsingService(
279 SafeBrowsingService* sb_service) { 267 SafeBrowsingService* sb_service) {
280 sb_service_ = sb_service; 268 sb_service_ = sb_service;
281 } 269 }
OLDNEW
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698