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

Unified Diff: base/process/process_unittest.cc

Issue 2735113003: Changing SpawnChild to return a struct.
Patch Set: Created 3 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 | « base/process/process_metrics_unittest.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_unittest.cc
diff --git a/base/process/process_unittest.cc b/base/process/process_unittest.cc
index 619d22b5d95007937598948874d31fa109031607..12c1b0d2585d5076aea9c0eb879465c96b3ce4e0 100644
--- a/base/process/process_unittest.cc
+++ b/base/process/process_unittest.cc
@@ -42,7 +42,8 @@ class ProcessTest : public MultiProcessTest {
};
TEST_F(ProcessTest, Create) {
- Process process(SpawnChild("SimpleChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("SimpleChildProcess");
+ Process process(std::move(spawn_result.process));
ASSERT_TRUE(process.IsValid());
ASSERT_FALSE(process.is_current());
process.Close();
@@ -58,7 +59,8 @@ TEST_F(ProcessTest, CreateCurrent) {
}
TEST_F(ProcessTest, Move) {
- Process process1(SpawnChild("SimpleChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("SimpleChildProcess");
+ Process process1(std::move(spawn_result.process));
EXPECT_TRUE(process1.IsValid());
Process process2;
@@ -77,7 +79,8 @@ TEST_F(ProcessTest, Move) {
}
TEST_F(ProcessTest, Duplicate) {
- Process process1(SpawnChild("SimpleChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("SimpleChildProcess");
+ Process process1(std::move(spawn_result.process));
ASSERT_TRUE(process1.IsValid());
Process process2 = process1.Duplicate();
@@ -107,7 +110,8 @@ TEST_F(ProcessTest, DuplicateCurrent) {
}
TEST_F(ProcessTest, DeprecatedGetProcessFromHandle) {
- Process process1(SpawnChild("SimpleChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("SimpleChildProcess");
+ Process process1(std::move(spawn_result.process));
ASSERT_TRUE(process1.IsValid());
Process process2 = Process::DeprecatedGetProcessFromHandle(process1.Handle());
@@ -127,7 +131,8 @@ MULTIPROCESS_TEST_MAIN(SleepyChildProcess) {
}
TEST_F(ProcessTest, Terminate) {
- Process process(SpawnChild("SleepyChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("SleepyChildProcess");
+ Process process(std::move(spawn_result.process));
ASSERT_TRUE(process.IsValid());
const int kDummyExitCode = 42;
@@ -173,7 +178,9 @@ MULTIPROCESS_TEST_MAIN(TerminateCurrentProcessImmediatelyWithCode0) {
}
TEST_F(ProcessTest, TerminateCurrentProcessImmediatelyWithZeroExitCode) {
- Process process(SpawnChild("TerminateCurrentProcessImmediatelyWithCode0"));
+ SpawnChildResult spawn_result =
+ SpawnChild("TerminateCurrentProcessImmediatelyWithCode0");
+ Process process(std::move(spawn_result.process));
ASSERT_TRUE(process.IsValid());
int exit_code = 42;
ASSERT_TRUE(process.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(),
@@ -188,7 +195,9 @@ MULTIPROCESS_TEST_MAIN(TerminateCurrentProcessImmediatelyWithCode250) {
}
TEST_F(ProcessTest, TerminateCurrentProcessImmediatelyWithNonZeroExitCode) {
- Process process(SpawnChild("TerminateCurrentProcessImmediatelyWithCode250"));
+ SpawnChildResult spawn_result =
+ SpawnChild("TerminateCurrentProcessImmediatelyWithCode250");
+ Process process(std::move(spawn_result.process));
ASSERT_TRUE(process.IsValid());
int exit_code = 42;
ASSERT_TRUE(process.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(),
@@ -202,7 +211,8 @@ MULTIPROCESS_TEST_MAIN(FastSleepyChildProcess) {
}
TEST_F(ProcessTest, WaitForExit) {
- Process process(SpawnChild("FastSleepyChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("FastSleepyChildProcess");
+ Process process(std::move(spawn_result.process));
ASSERT_TRUE(process.IsValid());
const int kDummyExitCode = 42;
@@ -212,7 +222,8 @@ TEST_F(ProcessTest, WaitForExit) {
}
TEST_F(ProcessTest, WaitForExitWithTimeout) {
- Process process(SpawnChild("SleepyChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("SleepyChildProcess");
+ Process process(std::move(spawn_result.process));
ASSERT_TRUE(process.IsValid());
const int kDummyExitCode = 42;
@@ -231,7 +242,8 @@ TEST_F(ProcessTest, WaitForExitWithTimeout) {
TEST_F(ProcessTest, SetProcessBackgrounded) {
if (!Process::CanBackgroundProcesses())
return;
- Process process(SpawnChild("SimpleChildProcess"));
+ SpawnChildResult spawn_result = SpawnChild("SimpleChildProcess");
+ Process process(std::move(spawn_result.process));
int old_priority = process.GetPriority();
#if defined(OS_WIN)
EXPECT_TRUE(process.SetProcessBackgrounded(true));
« no previous file with comments | « base/process/process_metrics_unittest.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698