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

Unified Diff: content/app/content_main_runner.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: try to fix android by restoring old path just for it Created 6 years, 9 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/test/ui/ui_test_suite.cc ('k') | content/browser/renderer_host/render_widget_host_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/app/content_main_runner.cc
===================================================================
--- content/app/content_main_runner.cc (revision 257432)
+++ content/app/content_main_runner.cc (working copy)
@@ -489,7 +489,8 @@
: is_initialized_(false),
is_shutdown_(false),
completed_basic_startup_(false),
- delegate_(NULL) {
+ delegate_(NULL),
+ ui_task_(NULL) {
#if defined(OS_WIN)
memset(&sandbox_info_, 0, sizeof(sandbox_info_));
#endif
@@ -526,6 +527,8 @@
#endif
virtual int Initialize(const ContentMainParams& params) OVERRIDE {
+ ui_task_ = params.ui_task;
+
#if defined(OS_WIN)
RegisterInvalidParamHandler();
_Module.Init(NULL, static_cast<HINSTANCE>(params.instance));
@@ -612,7 +615,12 @@
// A consequence of this is that you can't use the ctor/dtor-based
// TRACE_EVENT methods on Linux or iOS builds till after we set this up.
#if !defined(OS_ANDROID) && !defined(OS_IOS)
- exit_manager_.reset(new base::AtExitManager);
+ if (!ui_task_) {
+ // When running browser tests, don't create a second AtExitManager as that
+ // interfers with shutdown when objects created before ContentMain is
+ // called are destructed when it returns.
+ exit_manager_.reset(new base::AtExitManager);
+ }
#endif // !OS_ANDROID && !OS_IOS
#if defined(OS_MACOSX)
@@ -769,6 +777,7 @@
command_line.GetSwitchValueASCII(switches::kProcessType);
MainFunctionParams main_params(command_line);
+ main_params.ui_task = ui_task_;
#if defined(OS_WIN)
main_params.sandbox_info = &sandbox_info_;
#elif defined(OS_MACOSX)
@@ -835,6 +844,8 @@
scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_;
#endif
+ base::Closure* ui_task_;
+
DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
};
« no previous file with comments | « chrome/test/ui/ui_test_suite.cc ('k') | content/browser/renderer_host/render_widget_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698