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

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

Issue 228553002: Preference dis/allowing supervised users creation is now available as owner setting, not only as de… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test-specific logic added: check for BrowserPolicyConnector existence used. Created 6 years, 7 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
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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/apps/chrome_apps_client.h" 10 #include "chrome/browser/apps/chrome_apps_client.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 TestingBrowserProcess::TestingBrowserProcess() 65 TestingBrowserProcess::TestingBrowserProcess()
66 : notification_service_(content::NotificationService::Create()), 66 : notification_service_(content::NotificationService::Create()),
67 module_ref_count_(0), 67 module_ref_count_(0),
68 app_locale_("en"), 68 app_locale_("en"),
69 local_state_(NULL), 69 local_state_(NULL),
70 io_thread_(NULL), 70 io_thread_(NULL),
71 system_request_context_(NULL), 71 system_request_context_(NULL),
72 platform_part_(new TestingBrowserProcessPlatformPart()), 72 platform_part_(new TestingBrowserProcessPlatformPart()),
73 extensions_browser_client_( 73 extensions_browser_client_(
74 new extensions::ChromeExtensionsBrowserClient) { 74 new extensions::ChromeExtensionsBrowserClient),
75 created_browser_policy_connector_(false) {
75 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); 76 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
76 apps::AppsClient::Set(ChromeAppsClient::GetInstance()); 77 apps::AppsClient::Set(ChromeAppsClient::GetInstance());
77 } 78 }
78 79
79 TestingBrowserProcess::~TestingBrowserProcess() { 80 TestingBrowserProcess::~TestingBrowserProcess() {
80 EXPECT_FALSE(local_state_); 81 EXPECT_FALSE(local_state_);
81 #if defined(ENABLE_CONFIGURATION_POLICY) 82 #if defined(ENABLE_CONFIGURATION_POLICY)
82 SetBrowserPolicyConnector(NULL); 83 SetBrowserPolicyConnector(NULL);
83 #endif 84 #endif
84 extensions::ExtensionsBrowserClient::Set(NULL); 85 extensions::ExtensionsBrowserClient::Set(NULL);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 chrome_variations::VariationsService* 140 chrome_variations::VariationsService*
140 TestingBrowserProcess::variations_service() { 141 TestingBrowserProcess::variations_service() {
141 return NULL; 142 return NULL;
142 } 143 }
143 144
144 policy::BrowserPolicyConnector* 145 policy::BrowserPolicyConnector*
145 TestingBrowserProcess::browser_policy_connector() { 146 TestingBrowserProcess::browser_policy_connector() {
146 #if defined(ENABLE_CONFIGURATION_POLICY) 147 #if defined(ENABLE_CONFIGURATION_POLICY)
147 if (!browser_policy_connector_) 148 if (!browser_policy_connector_)
148 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); 149 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector();
150 created_browser_policy_connector_ = true;
149 return browser_policy_connector_.get(); 151 return browser_policy_connector_.get();
150 #else 152 #else
151 return NULL; 153 return NULL;
152 #endif 154 #endif
153 } 155 }
154 156
157 bool TestingBrowserProcess::is_browser_policy_connector_created() {
158 return created_browser_policy_connector_;
159 }
160
155 policy::PolicyService* TestingBrowserProcess::policy_service() { 161 policy::PolicyService* TestingBrowserProcess::policy_service() {
156 #if defined(OS_IOS) 162 #if defined(OS_IOS)
157 NOTIMPLEMENTED(); 163 NOTIMPLEMENTED();
158 return NULL; 164 return NULL;
159 #elif defined(ENABLE_CONFIGURATION_POLICY) 165 #elif defined(ENABLE_CONFIGURATION_POLICY)
160 return browser_policy_connector()->GetPolicyService(); 166 return browser_policy_connector()->GetPolicyService();
161 #else 167 #else
162 if (!policy_service_) 168 if (!policy_service_)
163 policy_service_.reset(new policy::PolicyServiceStub()); 169 policy_service_.reset(new policy::PolicyServiceStub());
164 return policy_service_.get(); 170 return policy_service_.get();
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 418
413 /////////////////////////////////////////////////////////////////////////////// 419 ///////////////////////////////////////////////////////////////////////////////
414 420
415 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { 421 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() {
416 TestingBrowserProcess::CreateInstance(); 422 TestingBrowserProcess::CreateInstance();
417 } 423 }
418 424
419 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { 425 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() {
420 TestingBrowserProcess::DeleteInstance(); 426 TestingBrowserProcess::DeleteInstance();
421 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698