Get rid of multiprocess_test's debug_on_start arguments.

(It was only ever given a "true" value once, and even that seemed dubious.)

R=phajdan.jr@chromium.org
TBR=darin@chromium.org, jeremy@chromium.org

Review URL: https://codereview.chromium.org/191483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255801 0039d316-1c4b-4281-b951-d872f2087c98
parent a958382b
...@@ -144,7 +144,7 @@ MULTIPROCESS_TEST_MAIN(MismatchedMallocChildProcess) { ...@@ -144,7 +144,7 @@ MULTIPROCESS_TEST_MAIN(MismatchedMallocChildProcess) {
// and e.g. mismatched new[]/delete would cause a hang because // and e.g. mismatched new[]/delete would cause a hang because
// of re-entering malloc. // of re-entering malloc.
TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) { TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) {
ProcessHandle child = this->SpawnChild("MismatchedMallocChildProcess", false); ProcessHandle child = SpawnChild("MismatchedMallocChildProcess");
ASSERT_NE(kNullProcessHandle, child); ASSERT_NE(kNullProcessHandle, child);
ASSERT_TRUE(WaitForSingleProcess(child, TestTimeouts::action_timeout())); ASSERT_TRUE(WaitForSingleProcess(child, TestTimeouts::action_timeout()));
} }
......
...@@ -648,7 +648,7 @@ TEST_F(SharedMemoryProcessTest, Tasks) { ...@@ -648,7 +648,7 @@ TEST_F(SharedMemoryProcessTest, Tasks) {
ProcessHandle handles[kNumTasks]; ProcessHandle handles[kNumTasks];
for (int index = 0; index < kNumTasks; ++index) { for (int index = 0; index < kNumTasks; ++index) {
handles[index] = SpawnChild("SharedMemoryTestMain", false); handles[index] = SpawnChild("SharedMemoryTestMain");
ASSERT_TRUE(handles[index]); ASSERT_TRUE(handles[index]);
} }
......
...@@ -211,7 +211,7 @@ TEST_F(StatsTableTest, DISABLED_MultipleProcesses) { ...@@ -211,7 +211,7 @@ TEST_F(StatsTableTest, DISABLED_MultipleProcesses) {
// Spawn the processes. // Spawn the processes.
for (int16 index = 0; index < kMaxProcs; index++) { for (int16 index = 0; index < kMaxProcs; index++) {
procs[index] = this->SpawnChild("StatsTableMultipleProcessMain", false); procs[index] = SpawnChild("StatsTableMultipleProcessMain");
EXPECT_NE(kNullProcessHandle, procs[index]); EXPECT_NE(kNullProcessHandle, procs[index]);
} }
......
...@@ -144,8 +144,9 @@ MULTIPROCESS_TEST_MAIN(SimpleChildProcess) { ...@@ -144,8 +144,9 @@ MULTIPROCESS_TEST_MAIN(SimpleChildProcess) {
return 0; return 0;
} }
// TODO(viettrungluu): This should be in a "MultiProcessTestTest".
TEST_F(ProcessUtilTest, SpawnChild) { TEST_F(ProcessUtilTest, SpawnChild) {
base::ProcessHandle handle = this->SpawnChild("SimpleChildProcess", false); base::ProcessHandle handle = SpawnChild("SimpleChildProcess");
ASSERT_NE(base::kNullProcessHandle, handle); ASSERT_NE(base::kNullProcessHandle, handle);
EXPECT_TRUE(base::WaitForSingleProcess( EXPECT_TRUE(base::WaitForSingleProcess(
handle, TestTimeouts::action_max_timeout())); handle, TestTimeouts::action_max_timeout()));
...@@ -161,7 +162,7 @@ TEST_F(ProcessUtilTest, KillSlowChild) { ...@@ -161,7 +162,7 @@ TEST_F(ProcessUtilTest, KillSlowChild) {
const std::string signal_file = const std::string signal_file =
ProcessUtilTest::GetSignalFilePath(kSignalFileSlow); ProcessUtilTest::GetSignalFilePath(kSignalFileSlow);
remove(signal_file.c_str()); remove(signal_file.c_str());
base::ProcessHandle handle = this->SpawnChild("SlowChildProcess", false); base::ProcessHandle handle = SpawnChild("SlowChildProcess");
ASSERT_NE(base::kNullProcessHandle, handle); ASSERT_NE(base::kNullProcessHandle, handle);
SignalChildren(signal_file.c_str()); SignalChildren(signal_file.c_str());
EXPECT_TRUE(base::WaitForSingleProcess( EXPECT_TRUE(base::WaitForSingleProcess(
...@@ -175,7 +176,7 @@ TEST_F(ProcessUtilTest, DISABLED_GetTerminationStatusExit) { ...@@ -175,7 +176,7 @@ TEST_F(ProcessUtilTest, DISABLED_GetTerminationStatusExit) {
const std::string signal_file = const std::string signal_file =
ProcessUtilTest::GetSignalFilePath(kSignalFileSlow); ProcessUtilTest::GetSignalFilePath(kSignalFileSlow);
remove(signal_file.c_str()); remove(signal_file.c_str());
base::ProcessHandle handle = this->SpawnChild("SlowChildProcess", false); base::ProcessHandle handle = SpawnChild("SlowChildProcess");
ASSERT_NE(base::kNullProcessHandle, handle); ASSERT_NE(base::kNullProcessHandle, handle);
int exit_code = 42; int exit_code = 42;
...@@ -198,7 +199,7 @@ TEST_F(ProcessUtilTest, DISABLED_GetTerminationStatusExit) { ...@@ -198,7 +199,7 @@ TEST_F(ProcessUtilTest, DISABLED_GetTerminationStatusExit) {
TEST_F(ProcessUtilTest, GetProcId) { TEST_F(ProcessUtilTest, GetProcId) {
base::ProcessId id1 = base::GetProcId(GetCurrentProcess()); base::ProcessId id1 = base::GetProcId(GetCurrentProcess());
EXPECT_NE(0ul, id1); EXPECT_NE(0ul, id1);
base::ProcessHandle handle = this->SpawnChild("SimpleChildProcess", false); base::ProcessHandle handle = SpawnChild("SimpleChildProcess");
ASSERT_NE(base::kNullProcessHandle, handle); ASSERT_NE(base::kNullProcessHandle, handle);
base::ProcessId id2 = base::GetProcId(handle); base::ProcessId id2 = base::GetProcId(handle);
EXPECT_NE(0ul, id2); EXPECT_NE(0ul, id2);
...@@ -243,8 +244,7 @@ TEST_F(ProcessUtilTest, MAYBE_GetTerminationStatusCrash) { ...@@ -243,8 +244,7 @@ TEST_F(ProcessUtilTest, MAYBE_GetTerminationStatusCrash) {
const std::string signal_file = const std::string signal_file =
ProcessUtilTest::GetSignalFilePath(kSignalFileCrash); ProcessUtilTest::GetSignalFilePath(kSignalFileCrash);
remove(signal_file.c_str()); remove(signal_file.c_str());
base::ProcessHandle handle = this->SpawnChild("CrashingChildProcess", base::ProcessHandle handle = SpawnChild("CrashingChildProcess");
false);
ASSERT_NE(base::kNullProcessHandle, handle); ASSERT_NE(base::kNullProcessHandle, handle);
int exit_code = 42; int exit_code = 42;
...@@ -291,8 +291,7 @@ TEST_F(ProcessUtilTest, GetTerminationStatusKill) { ...@@ -291,8 +291,7 @@ TEST_F(ProcessUtilTest, GetTerminationStatusKill) {
const std::string signal_file = const std::string signal_file =
ProcessUtilTest::GetSignalFilePath(kSignalFileKill); ProcessUtilTest::GetSignalFilePath(kSignalFileKill);
remove(signal_file.c_str()); remove(signal_file.c_str());
base::ProcessHandle handle = this->SpawnChild("KilledChildProcess", base::ProcessHandle handle = SpawnChild("KilledChildProcess");
false);
ASSERT_NE(base::kNullProcessHandle, handle); ASSERT_NE(base::kNullProcessHandle, handle);
int exit_code = 42; int exit_code = 42;
...@@ -322,7 +321,7 @@ TEST_F(ProcessUtilTest, GetTerminationStatusKill) { ...@@ -322,7 +321,7 @@ TEST_F(ProcessUtilTest, GetTerminationStatusKill) {
// Note: a platform may not be willing or able to lower the priority of // Note: a platform may not be willing or able to lower the priority of
// a process. The calls to SetProcessBackground should be noops then. // a process. The calls to SetProcessBackground should be noops then.
TEST_F(ProcessUtilTest, SetProcessBackgrounded) { TEST_F(ProcessUtilTest, SetProcessBackgrounded) {
base::ProcessHandle handle = this->SpawnChild("SimpleChildProcess", false); base::ProcessHandle handle = SpawnChild("SimpleChildProcess");
base::Process process(handle); base::Process process(handle);
int old_priority = process.GetPriority(); int old_priority = process.GetPriority();
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -393,8 +392,8 @@ TEST_F(ProcessUtilTest, LaunchAsUser) { ...@@ -393,8 +392,8 @@ TEST_F(ProcessUtilTest, LaunchAsUser) {
ASSERT_TRUE(OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &token)); ASSERT_TRUE(OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &token));
base::LaunchOptions options; base::LaunchOptions options;
options.as_user = token; options.as_user = token;
EXPECT_TRUE(base::LaunchProcess( EXPECT_TRUE(base::LaunchProcess(MakeCmdLine("SimpleChildProcess"), options,
this->MakeCmdLine("SimpleChildProcess", false), options, NULL)); NULL));
} }
static const char kEventToTriggerHandleSwitch[] = "event-to-trigger-handle"; static const char kEventToTriggerHandleSwitch[] = "event-to-trigger-handle";
...@@ -430,7 +429,7 @@ TEST_F(ProcessUtilTest, InheritSpecifiedHandles) { ...@@ -430,7 +429,7 @@ TEST_F(ProcessUtilTest, InheritSpecifiedHandles) {
base::LaunchOptions options; base::LaunchOptions options;
options.handles_to_inherit = &handles_to_inherit; options.handles_to_inherit = &handles_to_inherit;
CommandLine cmd_line = MakeCmdLine("TriggerEventChildProcess", false); CommandLine cmd_line = MakeCmdLine("TriggerEventChildProcess");
cmd_line.AppendSwitchASCII(kEventToTriggerHandleSwitch, cmd_line.AppendSwitchASCII(kEventToTriggerHandleSwitch,
base::Uint64ToString(reinterpret_cast<uint64>(event.handle()))); base::Uint64ToString(reinterpret_cast<uint64>(event.handle())));
...@@ -507,8 +506,8 @@ int ProcessUtilTest::CountOpenFDsInChild() { ...@@ -507,8 +506,8 @@ int ProcessUtilTest::CountOpenFDsInChild() {
fd_mapping_vec.push_back(std::pair<int, int>(fds[1], kChildPipe)); fd_mapping_vec.push_back(std::pair<int, int>(fds[1], kChildPipe));
base::LaunchOptions options; base::LaunchOptions options;
options.fds_to_remap = &fd_mapping_vec; options.fds_to_remap = &fd_mapping_vec;
base::ProcessHandle handle = this->SpawnChildWithOptions( base::ProcessHandle handle =
"ProcessUtilsLeakFDChildProcess", options, false); SpawnChildWithOptions("ProcessUtilsLeakFDChildProcess", options);
CHECK(handle); CHECK(handle);
int ret = IGNORE_EINTR(close(fds[1])); int ret = IGNORE_EINTR(close(fds[1]));
DPCHECK(ret == 0); DPCHECK(ret == 0);
...@@ -814,8 +813,7 @@ bool IsProcessDead(base::ProcessHandle child) { ...@@ -814,8 +813,7 @@ bool IsProcessDead(base::ProcessHandle child) {
} }
TEST_F(ProcessUtilTest, DelayedTermination) { TEST_F(ProcessUtilTest, DelayedTermination) {
base::ProcessHandle child_process = base::ProcessHandle child_process = SpawnChild("process_util_test_never_die");
SpawnChild("process_util_test_never_die", false);
ASSERT_TRUE(child_process); ASSERT_TRUE(child_process);
base::EnsureProcessTerminated(child_process); base::EnsureProcessTerminated(child_process);
base::WaitForSingleProcess(child_process, base::TimeDelta::FromSeconds(5)); base::WaitForSingleProcess(child_process, base::TimeDelta::FromSeconds(5));
...@@ -834,7 +832,7 @@ MULTIPROCESS_TEST_MAIN(process_util_test_never_die) { ...@@ -834,7 +832,7 @@ MULTIPROCESS_TEST_MAIN(process_util_test_never_die) {
TEST_F(ProcessUtilTest, ImmediateTermination) { TEST_F(ProcessUtilTest, ImmediateTermination) {
base::ProcessHandle child_process = base::ProcessHandle child_process =
SpawnChild("process_util_test_die_immediately", false); SpawnChild("process_util_test_die_immediately");
ASSERT_TRUE(child_process); ASSERT_TRUE(child_process);
// Give it time to die. // Give it time to die.
sleep(2); sleep(2);
......
...@@ -13,17 +13,13 @@ namespace base { ...@@ -13,17 +13,13 @@ namespace base {
ProcessHandle SpawnMultiProcessTestChild( ProcessHandle SpawnMultiProcessTestChild(
const std::string& procname, const std::string& procname,
const CommandLine& base_command_line, const CommandLine& base_command_line,
const LaunchOptions& options, const LaunchOptions& options) {
bool debug_on_start) {
CommandLine command_line(base_command_line); CommandLine command_line(base_command_line);
// TODO(viettrungluu): See comment above |MakeCmdLine()| in the header file. // TODO(viettrungluu): See comment above |MakeCmdLine()| in the header file.
// This is a temporary hack, since |MakeCmdLine()| has to provide a full // This is a temporary hack, since |MakeCmdLine()| has to provide a full
// command line. // command line.
if (!command_line.HasSwitch(switches::kTestChildProcess)) { if (!command_line.HasSwitch(switches::kTestChildProcess))
command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
if (debug_on_start)
command_line.AppendSwitch(switches::kDebugOnStart);
}
ProcessHandle handle = kNullProcessHandle; ProcessHandle handle = kNullProcessHandle;
LaunchProcess(command_line, options, &handle); LaunchProcess(command_line, options, &handle);
...@@ -40,31 +36,23 @@ CommandLine GetMultiProcessTestChildBaseCommandLine() { ...@@ -40,31 +36,23 @@ CommandLine GetMultiProcessTestChildBaseCommandLine() {
MultiProcessTest::MultiProcessTest() { MultiProcessTest::MultiProcessTest() {
} }
ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname, ProcessHandle MultiProcessTest::SpawnChild(const std::string& procname) {
bool debug_on_start) {
LaunchOptions options; LaunchOptions options;
#if defined(OS_WIN) #if defined(OS_WIN)
options.start_hidden = true; options.start_hidden = true;
#endif #endif
return SpawnChildWithOptions(procname, options, debug_on_start); return SpawnChildWithOptions(procname, options);
} }
ProcessHandle MultiProcessTest::SpawnChildWithOptions( ProcessHandle MultiProcessTest::SpawnChildWithOptions(
const std::string& procname, const std::string& procname,
const LaunchOptions& options, const LaunchOptions& options) {
bool debug_on_start) { return SpawnMultiProcessTestChild(procname, MakeCmdLine(procname), options);
return SpawnMultiProcessTestChild(procname,
MakeCmdLine(procname, debug_on_start),
options,
debug_on_start);
} }
CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname, CommandLine MultiProcessTest::MakeCmdLine(const std::string& procname) {
bool debug_on_start) {
CommandLine command_line = GetMultiProcessTestChildBaseCommandLine(); CommandLine command_line = GetMultiProcessTestChildBaseCommandLine();
command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); command_line.AppendSwitchASCII(switches::kTestChildProcess, procname);
if (debug_on_start)
command_line.AppendSwitch(switches::kDebugOnStart);
return command_line; return command_line;
} }
......
...@@ -35,7 +35,7 @@ namespace base { ...@@ -35,7 +35,7 @@ namespace base {
// // Start a child process and run |a_test_func|. // // Start a child process and run |a_test_func|.
// base::ProcessHandle test_child_handle = // base::ProcessHandle test_child_handle =
// base::SpawnMultiProcessTestChild("a_test_func", command_line, // base::SpawnMultiProcessTestChild("a_test_func", command_line,
// options, false); // options);
// //
// // Do stuff involving |test_child_handle| and the child process.... // // Do stuff involving |test_child_handle| and the child process....
// //
...@@ -61,8 +61,7 @@ namespace base { ...@@ -61,8 +61,7 @@ namespace base {
ProcessHandle SpawnMultiProcessTestChild( ProcessHandle SpawnMultiProcessTestChild(
const std::string& procname, const std::string& procname,
const CommandLine& command_line, const CommandLine& command_line,
const LaunchOptions& options, const LaunchOptions& options);
bool debug_on_start);
// Gets the base command line for |SpawnMultiProcessTestChild()|. To this, you // Gets the base command line for |SpawnMultiProcessTestChild()|. To this, you
// may add any flags needed for your child process. // may add any flags needed for your child process.
...@@ -107,14 +106,13 @@ class MultiProcessTest : public PlatformTest { ...@@ -107,14 +106,13 @@ class MultiProcessTest : public PlatformTest {
// } // }
// //
// Returns the handle to the child, or NULL on failure // Returns the handle to the child, or NULL on failure
ProcessHandle SpawnChild(const std::string& procname, bool debug_on_start); ProcessHandle SpawnChild(const std::string& procname);
// Run a child process using the given launch options. // Run a child process using the given launch options.
// //
// Note: On Windows, you probably want to set |options.start_hidden|. // Note: On Windows, you probably want to set |options.start_hidden|.
ProcessHandle SpawnChildWithOptions(const std::string& procname, ProcessHandle SpawnChildWithOptions(const std::string& procname,
const LaunchOptions& options, const LaunchOptions& options);
bool debug_on_start);
// Set up the command line used to spawn the child process. // Set up the command line used to spawn the child process.
// Override this to add things to the command line (calling this first in the // Override this to add things to the command line (calling this first in the
...@@ -123,8 +121,7 @@ class MultiProcessTest : public PlatformTest { ...@@ -123,8 +121,7 @@ class MultiProcessTest : public PlatformTest {
// which they then use directly with |LaunchProcess()|. // which they then use directly with |LaunchProcess()|.
// TODO(viettrungluu): Remove this and add a virtual // TODO(viettrungluu): Remove this and add a virtual
// |ModifyChildCommandLine()|; make the two divergent uses more sane. // |ModifyChildCommandLine()|; make the two divergent uses more sane.
virtual CommandLine MakeCmdLine(const std::string& procname, virtual CommandLine MakeCmdLine(const std::string& procname);
bool debug_on_start);
private: private:
DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); DISALLOW_COPY_AND_ASSIGN(MultiProcessTest);
......
...@@ -17,11 +17,9 @@ namespace base { ...@@ -17,11 +17,9 @@ namespace base {
// minimum to execute the method specified by procname (in the child process). // minimum to execute the method specified by procname (in the child process).
// - |base_command_line| is ignored. // - |base_command_line| is ignored.
// - All options except |fds_to_remap| are ignored. // - All options except |fds_to_remap| are ignored.
// - |debug_on_start| is ignored.
ProcessHandle SpawnMultiProcessTestChild(const std::string& procname, ProcessHandle SpawnMultiProcessTestChild(const std::string& procname,
const CommandLine& base_command_line, const CommandLine& base_command_line,
const LaunchOptions& options, const LaunchOptions& options) {
bool debug_on_start) {
// TODO(viettrungluu): The FD-remapping done below is wrong in the presence of // TODO(viettrungluu): The FD-remapping done below is wrong in the presence of
// cycles (e.g., fd1 -> fd2, fd2 -> fd1). crbug.com/326576 // cycles (e.g., fd1 -> fd2, fd2 -> fd1). crbug.com/326576
FileHandleMappingVector empty; FileHandleMappingVector empty;
......
...@@ -46,8 +46,7 @@ MULTIPROCESS_TEST_MAIN(ReturnNine) { ...@@ -46,8 +46,7 @@ MULTIPROCESS_TEST_MAIN(ReturnNine) {
void ScopedProcessInformationTest::DoCreateProcess( void ScopedProcessInformationTest::DoCreateProcess(
const std::string& main_id, PROCESS_INFORMATION* process_handle) { const std::string& main_id, PROCESS_INFORMATION* process_handle) {
std::wstring cmd_line = std::wstring cmd_line = MakeCmdLine(main_id).GetCommandLineString();
this->MakeCmdLine(main_id, false).GetCommandLineString();
STARTUPINFO startup_info = {}; STARTUPINFO startup_info = {};
startup_info.cb = sizeof(startup_info); startup_info.cb = sizeof(startup_info);
......
...@@ -62,7 +62,7 @@ TEST_F(StartupInformationTest, InheritStdOut) { ...@@ -62,7 +62,7 @@ TEST_F(StartupInformationTest, InheritStdOut) {
sizeof(events[0]))); sizeof(events[0])));
std::wstring cmd_line = std::wstring cmd_line =
this->MakeCmdLine("FireInheritedEvents", false).GetCommandLineString(); MakeCmdLine("FireInheritedEvents").GetCommandLineString();
PROCESS_INFORMATION temp_process_info = {}; PROCESS_INFORMATION temp_process_info = {};
ASSERT_TRUE(::CreateProcess(NULL, const_cast<wchar_t*>(cmd_line.c_str()), ASSERT_TRUE(::CreateProcess(NULL, const_cast<wchar_t*>(cmd_line.c_str()),
......
...@@ -317,8 +317,7 @@ class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest, ...@@ -317,8 +317,7 @@ class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest,
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
// MultiProcessTest implementation. // MultiProcessTest implementation.
virtual CommandLine MakeCmdLine(const std::string& procname, virtual CommandLine MakeCmdLine(const std::string& procname) OVERRIDE;
bool debug_on_start) OVERRIDE;
bool LaunchBrowser(const CommandLine& command_line, Profile* profile) { bool LaunchBrowser(const CommandLine& command_line, Profile* profile) {
int return_code = 0; int return_code = 0;
...@@ -434,9 +433,9 @@ base::ProcessHandle CloudPrintProxyPolicyStartupTest::Launch( ...@@ -434,9 +433,9 @@ base::ProcessHandle CloudPrintProxyPolicyStartupTest::Launch(
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
base::LaunchOptions options; base::LaunchOptions options;
options.fds_to_remap = &ipc_file_list; options.fds_to_remap = &ipc_file_list;
base::ProcessHandle handle = SpawnChildWithOptions(name, options, false); base::ProcessHandle handle = SpawnChildWithOptions(name, options);
#else #else
base::ProcessHandle handle = SpawnChild(name, false); base::ProcessHandle handle = SpawnChild(name);
#endif #endif
EXPECT_TRUE(handle); EXPECT_TRUE(handle);
return handle; return handle;
...@@ -475,9 +474,8 @@ void CloudPrintProxyPolicyStartupTest::OnChannelConnected(int32 peer_pid) { ...@@ -475,9 +474,8 @@ void CloudPrintProxyPolicyStartupTest::OnChannelConnected(int32 peer_pid) {
} }
CommandLine CloudPrintProxyPolicyStartupTest::MakeCmdLine( CommandLine CloudPrintProxyPolicyStartupTest::MakeCmdLine(
const std::string& procname, const std::string& procname) {
bool debug_on_start) { CommandLine cl = MultiProcessTest::MakeCmdLine(procname);
CommandLine cl = MultiProcessTest::MakeCmdLine(procname, debug_on_start);
cl.AppendSwitchASCII(switches::kProcessChannelID, startup_channel_id_); cl.AppendSwitchASCII(switches::kProcessChannelID, startup_channel_id_);
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
cl.AppendSwitchASCII(kTestExecutablePath, executable_path_.value()); cl.AppendSwitchASCII(kTestExecutablePath, executable_path_.value());
......
...@@ -51,7 +51,7 @@ std::string MultiProcessLockTest::GenerateLockName() { ...@@ -51,7 +51,7 @@ std::string MultiProcessLockTest::GenerateLockName() {
void MultiProcessLockTest::ExpectLockIsLocked(const std::string &name) { void MultiProcessLockTest::ExpectLockIsLocked(const std::string &name) {
ScopedEnvironmentVariable var(kLockEnviromentVarName, name); ScopedEnvironmentVariable var(kLockEnviromentVarName, name);
base::ProcessHandle handle = SpawnChild("MultiProcessLockTryFailMain", false); base::ProcessHandle handle = SpawnChild("MultiProcessLockTryFailMain");
ASSERT_TRUE(handle); ASSERT_TRUE(handle);
int exit_code = 0; int exit_code = 0;
EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code)); EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code));
...@@ -61,8 +61,7 @@ void MultiProcessLockTest::ExpectLockIsLocked(const std::string &name) { ...@@ -61,8 +61,7 @@ void MultiProcessLockTest::ExpectLockIsLocked(const std::string &name) {
void MultiProcessLockTest::ExpectLockIsUnlocked( void MultiProcessLockTest::ExpectLockIsUnlocked(
const std::string &name) { const std::string &name) {
ScopedEnvironmentVariable var(kLockEnviromentVarName, name); ScopedEnvironmentVariable var(kLockEnviromentVarName, name);
base::ProcessHandle handle = SpawnChild("MultiProcessLockTrySucceedMain", base::ProcessHandle handle = SpawnChild("MultiProcessLockTrySucceedMain");
false);
ASSERT_TRUE(handle); ASSERT_TRUE(handle);
int exit_code = 0; int exit_code = 0;
EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code)); EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code));
......
...@@ -95,7 +95,7 @@ void ServiceProcessStateTest::SetUp() { ...@@ -95,7 +95,7 @@ void ServiceProcessStateTest::SetUp() {
} }
void ServiceProcessStateTest::LaunchAndWait(const std::string& name) { void ServiceProcessStateTest::LaunchAndWait(const std::string& name) {
base::ProcessHandle handle = SpawnChild(name, false); base::ProcessHandle handle = SpawnChild(name);
ASSERT_TRUE(handle); ASSERT_TRUE(handle);
int exit_code = 0; int exit_code = 0;
ASSERT_TRUE(base::WaitForExitCode(handle, &exit_code)); ASSERT_TRUE(base::WaitForExitCode(handle, &exit_code));
...@@ -185,8 +185,7 @@ TEST_F(ServiceProcessStateTest, SharedMem) { ...@@ -185,8 +185,7 @@ TEST_F(ServiceProcessStateTest, SharedMem) {
} }
TEST_F(ServiceProcessStateTest, MAYBE_ForceShutdown) { TEST_F(ServiceProcessStateTest, MAYBE_ForceShutdown) {
base::ProcessHandle handle = SpawnChild("ServiceProcessStateTestShutdown", base::ProcessHandle handle = SpawnChild("ServiceProcessStateTestShutdown");
true);
ASSERT_TRUE(handle); ASSERT_TRUE(handle);
for (int i = 0; !CheckServiceProcessReady() && i < 10; ++i) { for (int i = 0; !CheckServiceProcessReady() && i < 10; ++i) {
base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); base::PlatformThread::Sleep(TestTimeouts::tiny_timeout());
......
...@@ -34,8 +34,7 @@ class MacDirAccessSandboxTest : public base::MultiProcessTest { ...@@ -34,8 +34,7 @@ class MacDirAccessSandboxTest : public base::MultiProcessTest {
public: public:
bool CheckSandbox(const std::string& directory_to_try) { bool CheckSandbox(const std::string& directory_to_try) {
setenv(kSandboxAccessPathKey, directory_to_try.c_str(), 1); setenv(kSandboxAccessPathKey, directory_to_try.c_str(), 1);
base::ProcessHandle child_process = SpawnChild("mac_sandbox_path_access", base::ProcessHandle child_process = SpawnChild("mac_sandbox_path_access");
false);
if (child_process == base::kNullProcessHandle) { if (child_process == base::kNullProcessHandle) {
LOG(WARNING) << "SpawnChild failed"; LOG(WARNING) << "SpawnChild failed";
return false; return false;
......
...@@ -78,8 +78,7 @@ bool MacSandboxTest::RunTestInSandbox(SandboxType sandbox_type, ...@@ -78,8 +78,7 @@ bool MacSandboxTest::RunTestInSandbox(SandboxType sandbox_type,
if (test_data) if (test_data)
setenv(kTestDataKey, test_data, 1); setenv(kTestDataKey, test_data, 1);
base::ProcessHandle child_process = SpawnChild("mac_sandbox_test_runner", base::ProcessHandle child_process = SpawnChild("mac_sandbox_test_runner");
false);
if (child_process == base::kNullProcessHandle) { if (child_process == base::kNullProcessHandle) {
LOG(WARNING) << "SpawnChild failed"; LOG(WARNING) << "SpawnChild failed";
return false; return false;
......
...@@ -285,8 +285,7 @@ TEST_F(IPCChannelPosixTest, AdvancedConnected) { ...@@ -285,8 +285,7 @@ TEST_F(IPCChannelPosixTest, AdvancedConnected) {
ASSERT_TRUE(channel.AcceptsConnections()); ASSERT_TRUE(channel.AcceptsConnections());
ASSERT_FALSE(channel.HasAcceptedConnection()); ASSERT_FALSE(channel.HasAcceptedConnection());
base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc", base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc");
false);
ASSERT_TRUE(handle); ASSERT_TRUE(handle);
SpinRunLoop(TestTimeouts::action_max_timeout()); SpinRunLoop(TestTimeouts::action_max_timeout());
ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
...@@ -315,8 +314,7 @@ TEST_F(IPCChannelPosixTest, ResetState) { ...@@ -315,8 +314,7 @@ TEST_F(IPCChannelPosixTest, ResetState) {
ASSERT_TRUE(channel.AcceptsConnections()); ASSERT_TRUE(channel.AcceptsConnections());
ASSERT_FALSE(channel.HasAcceptedConnection()); ASSERT_FALSE(channel.HasAcceptedConnection());
base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc", base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc");
false);
ASSERT_TRUE(handle); ASSERT_TRUE(handle);
SpinRunLoop(TestTimeouts::action_max_timeout()); SpinRunLoop(TestTimeouts::action_max_timeout());
ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
...@@ -324,8 +322,7 @@ TEST_F(IPCChannelPosixTest, ResetState) { ...@@ -324,8 +322,7 @@ TEST_F(IPCChannelPosixTest, ResetState) {
channel.ResetToAcceptingConnectionState(); channel.ResetToAcceptingConnectionState();
ASSERT_FALSE(channel.HasAcceptedConnection()); ASSERT_FALSE(channel.HasAcceptedConnection());
base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixTestConnectionProc", base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixTestConnectionProc");
false);
ASSERT_TRUE(handle2); ASSERT_TRUE(handle2);
SpinRunLoop(TestTimeouts::action_max_timeout()); SpinRunLoop(TestTimeouts::action_max_timeout());
ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
...@@ -374,14 +371,12 @@ TEST_F(IPCChannelPosixTest, MultiConnection) { ...@@ -374,14 +371,12 @@ TEST_F(IPCChannelPosixTest, MultiConnection) {
ASSERT_TRUE(channel.AcceptsConnections()); ASSERT_TRUE(channel.AcceptsConnections());
ASSERT_FALSE(channel.HasAcceptedConnection()); ASSERT_FALSE(channel.HasAcceptedConnection());
base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc", base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc");
false);
ASSERT_TRUE(handle); ASSERT_TRUE(handle);
SpinRunLoop(TestTimeouts::action_max_timeout()); SpinRunLoop(TestTimeouts::action_max_timeout());
ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
ASSERT_TRUE(channel.HasAcceptedConnection()); ASSERT_TRUE(channel.HasAcceptedConnection());
base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixFailConnectionProc", base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixFailConnectionProc");
false);
ASSERT_TRUE(handle2); ASSERT_TRUE(handle2);
SpinRunLoop(TestTimeouts::action_max_timeout()); SpinRunLoop(TestTimeouts::action_max_timeout());
int exit_code = 0; int exit_code = 0;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "ipc/ipc_descriptors.h" #include "ipc/ipc_descriptors.h"
#include "ipc/ipc_switches.h"
#if defined(OS_POSIX) #if defined(OS_POSIX)
#include "base/posix/global_descriptors.h" #include "base/posix/global_descriptors.h"
...@@ -96,11 +95,9 @@ bool IPCTestBase::StartClient() { ...@@ -96,11 +95,9 @@ bool IPCTestBase::StartClient() {
DCHECK(client_process_ == base::kNullProcessHandle); DCHECK(client_process_ == base::kNullProcessHandle);
std::string test_main = test_client_name_ + "TestClientMain"; std::string test_main = test_client_name_ + "TestClientMain";
bool debug_on_start =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugChildren);
#if defined(OS_WIN) #if defined(OS_WIN)
client_process_ = SpawnChild(test_main, debug_on_start); client_process_ = SpawnChild(test_main);
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
base::FileHandleMappingVector fds_to_map; base::FileHandleMappingVector fds_to_map;
const int ipcfd = channel_.get() ? channel_->GetClientFileDescriptor() : const int ipcfd = channel_.get() ? channel_->GetClientFileDescriptor() :
...@@ -110,7 +107,7 @@ bool IPCTestBase::StartClient() { ...@@ -110,7 +107,7 @@ bool IPCTestBase::StartClient() {
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
base::LaunchOptions options; base::LaunchOptions options;
options.fds_to_remap = &fds_to_map; options.fds_to_remap = &fds_to_map;
client_process_ = SpawnChildWithOptions(test_main, options, debug_on_start); client_process_ = SpawnChildWithOptions(test_main, options);
#endif #endif
return client_process_ != base::kNullProcessHandle; return client_process_ != base::kNullProcessHandle;
......
...@@ -48,8 +48,8 @@ void MultiprocessTestHelper::StartChild(const std::string& test_child_name) { ...@@ -48,8 +48,8 @@ void MultiprocessTestHelper::StartChild(const std::string& test_child_name) {
#error "Not supported yet." #error "Not supported yet."
#endif #endif
test_child_handle_ = base::SpawnMultiProcessTestChild( test_child_handle_ =
test_child_main, command_line, options, false); base::SpawnMultiProcessTestChild(test_child_main, command_line, options);
platform_channel_pair_->ChildProcessLaunched(); platform_channel_pair_->ChildProcessLaunched();
CHECK_NE(test_child_handle_, base::kNullProcessHandle); CHECK_NE(test_child_handle_, base::kNullProcessHandle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment