Index: base/process/process_unittest.cc |
diff --git a/base/process/process_unittest.cc b/base/process/process_unittest.cc |
index a5ba83473311967d927f0e0c99094faa25f7a9c5..5180f64c55a8111a5db6456570d1ac4d38f2776e 100644 |
--- a/base/process/process_unittest.cc |
+++ b/base/process/process_unittest.cc |
@@ -135,6 +135,34 @@ TEST_F(ProcessTest, Terminate) { |
#endif |
} |
+MULTIPROCESS_TEST_MAIN(FastSleepyChildProcess) { |
+ PlatformThread::Sleep(TestTimeouts::tiny_timeout() * 10); |
+ return 0; |
+} |
+ |
+TEST_F(ProcessTest, WaitForExit) { |
+ Process process(SpawnChild("FastSleepyChildProcess")); |
+ ASSERT_TRUE(process.IsValid()); |
+ |
+ const int kDummyExitCode = 42; |
+ int exit_code = kDummyExitCode; |
+ EXPECT_TRUE(process.WaitForExit(&exit_code)); |
+ EXPECT_EQ(0, exit_code); |
+} |
+ |
+TEST_F(ProcessTest, WaitForExitWithTimeout) { |
+ Process process(SpawnChild("SleepyChildProcess")); |
+ ASSERT_TRUE(process.IsValid()); |
+ |
+ const int kDummyExitCode = 42; |
+ int exit_code = kDummyExitCode; |
+ TimeDelta timeout = TestTimeouts::tiny_timeout(); |
+ EXPECT_FALSE(process.WaitForExitWithTimeout(timeout, &exit_code)); |
+ EXPECT_EQ(kDummyExitCode, exit_code); |
+ |
+ process.Terminate(kDummyExitCode); |
+} |
+ |
// Ensure that the priority of a process is restored correctly after |
// backgrounding and restoring. |
// Note: a platform may not be willing or able to lower the priority of |