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

Unified Diff: chrome/test/base/testing_browser_process.cc

Issue 10823212: Relanding this as this did not fix the chromiumos breakage. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/testing_browser_process.cc
===================================================================
--- chrome/test/base/testing_browser_process.cc (revision 150400)
+++ chrome/test/base/testing_browser_process.cc (working copy)
@@ -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 "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard.h"
-#include "testing/gtest/include/gtest/gtest.h"
#if !defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/policy_service_stub.h"
@@ -73,8 +73,10 @@
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::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 @@
}
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;
}
Property changes on: chrome\test\base\testing_browser_process.cc
___________________________________________________________________
Added: svn:mergeinfo
« 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