| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 base::CommandLine::Init(argc, argv); | 118 base::CommandLine::Init(argc, argv); |
| 119 const base::CommandLine& command_line = | 119 const base::CommandLine& command_line = |
| 120 *base::CommandLine::ForCurrentProcess(); | 120 *base::CommandLine::ForCurrentProcess(); |
| 121 if (!command_line.HasSwitch("run-in-mash")) | 121 if (!command_line.HasSwitch("run-in-mash")) |
| 122 return false; | 122 return false; |
| 123 | 123 |
| 124 if (command_line.HasSwitch(switches::kChildProcess) && | 124 if (command_line.HasSwitch(switches::kChildProcess) && |
| 125 !command_line.HasSwitch(MojoTestConnector::kTestSwitch)) { | 125 !command_line.HasSwitch(MojoTestConnector::kTestSwitch)) { |
| 126 base::AtExitManager at_exit; | 126 base::AtExitManager at_exit; |
| 127 shell::InitializeLogging(); | 127 shell::InitializeLogging(); |
| 128 // TODO(sky): nuke once resolve why test isn't shutting down: 594600. |
| 129 LOG(ERROR) << "starting app " << command_line.GetCommandLineString(); |
| 128 shell::WaitForDebuggerIfNecessary(); | 130 shell::WaitForDebuggerIfNecessary(); |
| 129 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) | 131 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) |
| 130 base::RouteStdioToConsole(false); | 132 base::RouteStdioToConsole(false); |
| 131 #endif | 133 #endif |
| 132 *exit_code = shell::ChildProcessMain(); | 134 *exit_code = shell::ChildProcessMain(); |
| 135 // TODO(sky): nuke once resolve why test isn't shutting down: 594600. |
| 133 LOG(ERROR) << "child exit_code=" << *exit_code; | 136 LOG(ERROR) << "child exit_code=" << *exit_code; |
| 134 return true; | 137 return true; |
| 135 } | 138 } |
| 136 | 139 |
| 137 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 140 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
| 138 MashTestLauncherDelegate delegate; | 141 MashTestLauncherDelegate delegate; |
| 139 // --single_process and no primoridal pipe token indicate we were run directly | 142 // --single_process and no primoridal pipe token indicate we were run directly |
| 140 // from the command line. In this case we have to start up MojoShellConnection | 143 // from the command line. In this case we have to start up MojoShellConnection |
| 141 // as though we were embedded. | 144 // as though we were embedded. |
| 142 content::MojoShellConnection::Factory shell_connection_factory; | 145 content::MojoShellConnection::Factory shell_connection_factory; |
| 143 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) && | 146 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) && |
| 144 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { | 147 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { |
| 145 shell_connection_factory = | 148 shell_connection_factory = |
| 146 base::Bind(&CreateMojoShellConnection, &delegate); | 149 base::Bind(&CreateMojoShellConnection, &delegate); |
| 147 content::MojoShellConnection::SetFactoryForTest(&shell_connection_factory); | 150 content::MojoShellConnection::SetFactoryForTest(&shell_connection_factory); |
| 148 } | 151 } |
| 149 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); | 152 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); |
| 153 // TODO(sky): nuke once resolve why test isn't shutting down: 594600. |
| 150 LOG(ERROR) << "RunMashBrowserTests exit_code=" << *exit_code; | 154 LOG(ERROR) << "RunMashBrowserTests exit_code=" << *exit_code; |
| 151 return true; | 155 return true; |
| 152 } | 156 } |
| OLD | NEW |