diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 21:09:59 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 21:09:59 +0000 |
commit | 5c4c89f985b7005f4c09634c11c7862245b639b0 (patch) | |
tree | 68533605629b176aded60479468cb2cb6fbc8419 /chrome/test/base/testing_browser_process.cc | |
parent | c7995335a0dfd47d0ee64671696287c29ca85847 (diff) | |
download | chromium_src-5c4c89f985b7005f4c09634c11c7862245b639b0.zip chromium_src-5c4c89f985b7005f4c09634c11c7862245b639b0.tar.gz chromium_src-5c4c89f985b7005f4c09634c11c7862245b639b0.tar.bz2 |
Relanding this as this did not fix the chromiumos breakage.
Revert 150391 - Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail.
Will revert back if it does not address the redness.
Revert 150380 - Add support for loading user cloud policy on desktop, behind the --load-cloud-policy-on-signin flag.
Move UserCloudPolicyManager to be owned by the Profile as a step towards supporting multiple profiles.
Added TestingProfile::Builder as a start towards taming the madness of all the different constructors and setters.
BUG=141123
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10693022
TBR=atwilson@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10823208
TBR=ananta@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10823212
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150404 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/base/testing_browser_process.cc')
-rw-r--r-- | chrome/test/base/testing_browser_process.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc index 5251c93..da4fa89 100644 --- a/chrome/test/base/testing_browser_process.cc +++ b/chrome/test/base/testing_browser_process.cc @@ -16,8 +16,8 @@ #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "content/public/browser/notification_service.h" #include "net/url_request/url_request_context_getter.h" -#include "ui/base/clipboard/clipboard.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/clipboard/clipboard.h" #if !defined(ENABLE_CONFIGURATION_POLICY) #include "chrome/browser/policy/policy_service_stub.h" @@ -73,8 +73,10 @@ chrome_variations::VariationsService* policy::BrowserPolicyConnector* TestingBrowserProcess::browser_policy_connector() { #if defined(ENABLE_CONFIGURATION_POLICY) - if (!browser_policy_connector_.get()) + if (!browser_policy_connector_.get()) { browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); + browser_policy_connector_->Init(); + } #endif return browser_policy_connector_.get(); } @@ -82,8 +84,7 @@ policy::BrowserPolicyConnector* policy::PolicyService* TestingBrowserProcess::policy_service() { if (!policy_service_.get()) { #if defined(ENABLE_CONFIGURATION_POLICY) - policy_service_.reset( - browser_policy_connector()->CreatePolicyService(NULL)); + policy_service_ = browser_policy_connector()->CreatePolicyService(NULL); #else policy_service_.reset(new policy::PolicyServiceStub()); #endif @@ -249,8 +250,19 @@ CRLSetFetcher* TestingBrowserProcess::crl_set_fetcher() { } void TestingBrowserProcess::SetLocalState(PrefService* local_state) { - if (!local_state && notification_ui_manager_.get()) - notification_ui_manager_.reset(); // Used local_state_. + if (!local_state) { + // The local_state_ PrefService is owned outside of TestingBrowserProcess, + // but some of the members of TestingBrowserProcess hold references to it + // (for example, via PrefNotifier members). But given our test + // infrastructure which tears down individual tests before freeing the + // TestingBrowserProcess, there's not a good way to make local_state outlive + // these dependencies. As a workaround, whenever local_state_ is cleared + // (assumedly as part of exiting the test and freeing TestingBrowserProcess) + // any components owned by TestingBrowserProcess that depend on local_state + // are also freed. + notification_ui_manager_.reset(); + browser_policy_connector_.reset(); + } local_state_ = local_state; } |