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

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

Issue 56253002: Move ExtensionsProcessManager to src/extensions, part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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/chrome_browser_extensions.gypi ('k') | extensions/browser/extensions_browser_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/chrome_test_suite.cc
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index 7183b5ca1cfe62bf72a33ed3280c8faa39ba7ad6..bd9d92be50f7ad4978c4c48107b05e7264539743 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -93,6 +93,24 @@ class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener {
DCHECK(!g_browser_process);
g_browser_process = new TestingBrowserProcess;
+ SetUpContentClients();
+ SetUpExtensionsClients();
+ }
+
+ virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
+ TearDownExtensionsClients();
+ TearDownContentClients();
+
+ if (g_browser_process) {
+ BrowserProcess* browser_process = g_browser_process;
+ // g_browser_process must be NULL during its own destruction.
+ g_browser_process = NULL;
+ delete browser_process;
+ }
+ }
+
+ private:
+ void SetUpContentClients() {
content_client_.reset(new chrome::ChromeContentClient);
content::SetContentClient(content_client_.get());
// TODO(ios): Bring this back once ChromeContentBrowserClient is building.
@@ -104,14 +122,7 @@ class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener {
#endif
}
- virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
- if (g_browser_process) {
- BrowserProcess* browser_process = g_browser_process;
- // g_browser_process must be NULL during its own destruction.
- g_browser_process = NULL;
- delete browser_process;
- }
-
+ void TearDownContentClients() {
// TODO(ios): Bring this back once ChromeContentBrowserClient is building.
#if !defined(OS_IOS)
browser_content_client_.reset();
@@ -121,7 +132,18 @@ class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener {
content::SetContentClient(NULL);
}
- private:
+ void SetUpExtensionsClients() {
+ extensions_browser_client_.reset(
+ new extensions::ChromeExtensionsBrowserClient);
+ extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
+ }
+
+ void TearDownExtensionsClients() {
+ extensions_browser_client_.reset();
+ extensions::ExtensionsBrowserClient::Set(NULL);
+ }
+
+ // Client implementations for the content module.
scoped_ptr<chrome::ChromeContentClient> content_client_;
// TODO(ios): Bring this back once ChromeContentBrowserClient is building.
#if !defined(OS_IOS)
@@ -129,6 +151,10 @@ class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener {
scoped_ptr<chrome::ChromeContentUtilityClient> utility_content_client_;
#endif
+ // Client implementations for the extensions module.
+ scoped_ptr<extensions::ChromeExtensionsBrowserClient>
+ extensions_browser_client_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeTestSuiteInitializer);
};
@@ -172,8 +198,6 @@ void ChromeTestSuite::Initialize() {
extensions::ExtensionsClient::Set(
extensions::ChromeExtensionsClient::GetInstance());
- extensions::ExtensionsBrowserClient::Set(
- extensions::ChromeExtensionsBrowserClient::GetInstance());
// Only want to do this for unit tests.
if (!content::GetCurrentTestLauncherDelegate()) {
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | extensions/browser/extensions_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698