summaryrefslogtreecommitdiffstats
path: root/content/app
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 04:25:35 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 04:25:35 +0000
commita88f63686baa4751ab6638413ca7b62f8a3c2738 (patch)
tree0b8a7e13326055789131f47ef4dd60ba707d33f7 /content/app
parentd75d14350f6875855cc465ba06a2e3807b879269 (diff)
downloadchromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.zip
chromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.tar.gz
chromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.tar.bz2
Run ContentMain in a browser_test's browser process. This removes duplication of code in the browser test harness for setting up the browser process, and also ensures that initialization code in ContentMainRunner runs.
Most of the changes are to unit tests which run in browser test executables. These were getting all the setup that these binaries did for browser tests even though they were unit tests. Now they have to explicitly setup objects that they need. This would be done automatically if they were in a unit test binary and therefore using the unit test harness. The goal should be to move these tests to unit test binaries, and make them support launching some tests in separate processes building on the work that Pawel did. BUG=350550 R=sky@chromium.org Review URL: https://codereview.chromium.org/190663012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r--content/app/content_main_runner.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 13d112ab..adf27a9 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -489,7 +489,8 @@ class ContentMainRunnerImpl : public ContentMainRunner {
: 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 @@ class ContentMainRunnerImpl : public ContentMainRunner {
#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 @@ class ContentMainRunnerImpl : public ContentMainRunner {
// 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 @@ class ContentMainRunnerImpl : public ContentMainRunner {
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 @@ class ContentMainRunnerImpl : public ContentMainRunner {
scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_;
#endif
+ base::Closure* ui_task_;
+
DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
};