| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
| 10 #include "base/debug/stack_trace.h" |
| 10 #include "base/i18n/icu_util.h" | 11 #include "base/i18n/icu_util.h" |
| 11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 13 #include "base/process/launch.h" | 14 #include "base/process/launch.h" |
| 14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "chrome/test/base/chrome_test_launcher.h" | 18 #include "chrome/test/base/chrome_test_launcher.h" |
| 18 #include "chrome/test/base/chrome_test_suite.h" | 19 #include "chrome/test/base/chrome_test_suite.h" |
| 19 #include "chrome/test/base/mojo_test_connector.h" | 20 #include "chrome/test/base/mojo_test_connector.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 const base::CommandLine& command_line = | 146 const base::CommandLine& command_line = |
| 146 *base::CommandLine::ForCurrentProcess(); | 147 *base::CommandLine::ForCurrentProcess(); |
| 147 if (!command_line.HasSwitch("run-in-mash")) | 148 if (!command_line.HasSwitch("run-in-mash")) |
| 148 return false; | 149 return false; |
| 149 | 150 |
| 150 if (command_line.HasSwitch(MojoTestConnector::kMashApp)) { | 151 if (command_line.HasSwitch(MojoTestConnector::kMashApp)) { |
| 151 #if defined(OS_LINUX) | 152 #if defined(OS_LINUX) |
| 152 base::AtExitManager exit_manager; | 153 base::AtExitManager exit_manager; |
| 153 #endif | 154 #endif |
| 154 base::i18n::InitializeICU(); | 155 base::i18n::InitializeICU(); |
| 156 |
| 157 #if !defined(OFFICIAL_BUILD) |
| 158 base::debug::EnableInProcessStackDumping(); |
| 159 #endif |
| 160 |
| 155 service_manager::RunStandaloneService(base::Bind(&StartChildApp)); | 161 service_manager::RunStandaloneService(base::Bind(&StartChildApp)); |
| 156 *exit_code = 0; | 162 *exit_code = 0; |
| 157 return true; | 163 return true; |
| 158 } | 164 } |
| 159 | 165 |
| 160 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 166 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
| 161 MashTestLauncherDelegate delegate; | 167 MashTestLauncherDelegate delegate; |
| 162 // --single_process and no primoridal pipe token indicate we were run directly | 168 // --single_process and no primoridal pipe token indicate we were run directly |
| 163 // from the command line. In this case we have to start up | 169 // from the command line. In this case we have to start up |
| 164 // ServiceManagerConnection | 170 // ServiceManagerConnection |
| 165 // as though we were embedded. | 171 // as though we were embedded. |
| 166 content::ServiceManagerConnection::Factory service_manager_connection_factory; | 172 content::ServiceManagerConnection::Factory service_manager_connection_factory; |
| 167 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) && | 173 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) && |
| 168 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { | 174 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { |
| 169 service_manager_connection_factory = | 175 service_manager_connection_factory = |
| 170 base::Bind(&CreateServiceManagerConnection, &delegate); | 176 base::Bind(&CreateServiceManagerConnection, &delegate); |
| 171 content::ServiceManagerConnection::SetFactoryForTest( | 177 content::ServiceManagerConnection::SetFactoryForTest( |
| 172 &service_manager_connection_factory); | 178 &service_manager_connection_factory); |
| 173 } | 179 } |
| 174 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); | 180 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); |
| 175 return true; | 181 return true; |
| 176 } | 182 } |
| OLD | NEW |