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

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

Issue 18119009: Make utility process run in-process when running in single-process mode. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: undo unnecessary changes Created 7 years, 5 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/chrome_test_suite.h" 5 #include "chrome/test/base/chrome_test_suite.h"
6 6
7 #if defined(OS_CHROMEOS) 7 #if defined(OS_CHROMEOS)
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 #endif 10 #endif
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/metrics/stats_table.h" 14 #include "base/metrics/stats_table.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/process_util.h" 16 #include "base/process_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chrome_content_browser_client.h" 20 #include "chrome/browser/chrome_content_browser_client.h"
21 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 21 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
22 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
23 #include "chrome/common/chrome_content_client.h" 23 #include "chrome/common/chrome_content_client.h"
24 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/extensions/chrome_manifest_handlers.h" 25 #include "chrome/common/extensions/chrome_manifest_handlers.h"
26 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" 26 #include "chrome/common/extensions/permissions/chrome_api_permissions.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "chrome/test/base/testing_browser_process.h" 28 #include "chrome/test/base/testing_browser_process.h"
29 #include "chrome/utility/chrome_content_utility_client.h"
29 #include "content/public/test/test_launcher.h" 30 #include "content/public/test/test_launcher.h"
30 #include "extensions/common/extension_paths.h" 31 #include "extensions/common/extension_paths.h"
31 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
32 #include "net/base/net_util.h" 33 #include "net/base/net_util.h"
33 #include "net/dns/mock_host_resolver.h" 34 #include "net/dns/mock_host_resolver.h"
34 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
35 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/base/resource/resource_handle.h" 37 #include "ui/base/resource/resource_handle.h"
37 38
38 #if defined(OS_ANDROID) 39 #if defined(OS_ANDROID)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 138
138 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { 139 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
139 DCHECK(!g_browser_process); 140 DCHECK(!g_browser_process);
140 g_browser_process = new TestingBrowserProcess; 141 g_browser_process = new TestingBrowserProcess;
141 142
142 content_client_.reset(new chrome::ChromeContentClient); 143 content_client_.reset(new chrome::ChromeContentClient);
143 content::SetContentClient(content_client_.get()); 144 content::SetContentClient(content_client_.get());
144 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. 145 // TODO(ios): Bring this back once ChromeContentBrowserClient is building.
145 #if !defined(OS_IOS) 146 #if !defined(OS_IOS)
146 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); 147 browser_content_client_.reset(new chrome::ChromeContentBrowserClient());
147 SetBrowserClientForTesting(browser_content_client_.get()); 148 content::SetBrowserClientForTesting(browser_content_client_.get());
149 utility_content_client_.reset(new chrome::ChromeContentUtilityClient());
150 content::SetUtilityClientForTesting(utility_content_client_.get());
148 #endif 151 #endif
149 152
150 SetUpHostResolver(); 153 SetUpHostResolver();
151 } 154 }
152 155
153 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { 156 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
154 if (g_browser_process) { 157 if (g_browser_process) {
155 BrowserProcess* browser_process = g_browser_process; 158 BrowserProcess* browser_process = g_browser_process;
156 // g_browser_process must be NULL during its own destruction. 159 // g_browser_process must be NULL during its own destruction.
157 g_browser_process = NULL; 160 g_browser_process = NULL;
158 delete browser_process; 161 delete browser_process;
159 } 162 }
160 163
161 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. 164 // TODO(ios): Bring this back once ChromeContentBrowserClient is building.
162 #if !defined(OS_IOS) 165 #if !defined(OS_IOS)
163 browser_content_client_.reset(); 166 browser_content_client_.reset();
167 utility_content_client_.reset();
164 #endif 168 #endif
165 content_client_.reset(); 169 content_client_.reset();
166 content::SetContentClient(NULL); 170 content::SetContentClient(NULL);
167 171
168 TearDownHostResolver(); 172 TearDownHostResolver();
169 } 173 }
170 174
171 private: 175 private:
172 void SetUpHostResolver() { 176 void SetUpHostResolver() {
173 host_resolver_proc_ = new LocalHostResolverProc; 177 host_resolver_proc_ = new LocalHostResolverProc;
174 scoped_host_resolver_proc_.reset( 178 scoped_host_resolver_proc_.reset(
175 new net::ScopedDefaultHostResolverProc(host_resolver_proc_.get())); 179 new net::ScopedDefaultHostResolverProc(host_resolver_proc_.get()));
176 } 180 }
177 181
178 void TearDownHostResolver() { 182 void TearDownHostResolver() {
179 scoped_host_resolver_proc_.reset(); 183 scoped_host_resolver_proc_.reset();
180 host_resolver_proc_ = NULL; 184 host_resolver_proc_ = NULL;
181 } 185 }
182 186
183 scoped_ptr<chrome::ChromeContentClient> content_client_; 187 scoped_ptr<chrome::ChromeContentClient> content_client_;
184 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. 188 // TODO(ios): Bring this back once ChromeContentBrowserClient is building.
185 #if !defined(OS_IOS) 189 #if !defined(OS_IOS)
186 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; 190 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_;
191 scoped_ptr<chrome::ChromeContentUtilityClient> utility_content_client_;
187 #endif 192 #endif
188 193
189 scoped_refptr<LocalHostResolverProc> host_resolver_proc_; 194 scoped_refptr<LocalHostResolverProc> host_resolver_proc_;
190 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_; 195 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_;
191 196
192 DISALLOW_COPY_AND_ASSIGN(ChromeTestSuiteInitializer); 197 DISALLOW_COPY_AND_ASSIGN(ChromeTestSuiteInitializer);
193 }; 198 };
194 199
195 } // namespace 200 } // namespace
196 201
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 #if defined(OS_MACOSX) && !defined(OS_IOS) 301 #if defined(OS_MACOSX) && !defined(OS_IOS)
297 base::mac::SetOverrideFrameworkBundle(NULL); 302 base::mac::SetOverrideFrameworkBundle(NULL);
298 #endif 303 #endif
299 304
300 base::StatsTable::set_current(NULL); 305 base::StatsTable::set_current(NULL);
301 stats_table_.reset(); 306 stats_table_.reset();
302 RemoveSharedMemoryFile(stats_filename_); 307 RemoveSharedMemoryFile(stats_filename_);
303 308
304 base::TestSuite::Shutdown(); 309 base::TestSuite::Shutdown();
305 } 310 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/startup_helper.cc ('k') | chrome/utility/chrome_content_utility_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698