Index: util/test/multiprocess.cc |
diff --git a/util/test/multiprocess.cc b/util/test/multiprocess.cc |
index 4c0ce3a0c55b58ec530e19bdaf15b4cdb3c546bb..24c2e44f238ad8ca1920f0a5820e3b0dd4157434 100644 |
--- a/util/test/multiprocess.cc |
+++ b/util/test/multiprocess.cc |
@@ -22,6 +22,7 @@ |
#include "base/auto_reset.h" |
#include "base/files/scoped_file.h" |
+#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/strings/stringprintf.h" |
#include "gtest/gtest.h" |
@@ -113,9 +114,9 @@ void Multiprocess::Run() { |
} |
if (reason_ == kTerminationNormal) { |
- message += base::StringPrintf("exit with code %d", code_); |
+ message += base::StringPrintf(" exit with code %d", code_); |
} else if (reason == kTerminationSignal) { |
- message += base::StringPrintf("termination by signal %d", code_); |
+ message += base::StringPrintf(" termination by signal %d", code_); |
} |
if (reason != reason_ || code != code_) { |
@@ -159,17 +160,33 @@ pid_t Multiprocess::ChildPID() const { |
int Multiprocess::ReadPipeFD() const { |
int fd = info_->child_pid ? info_->pipe_c2p_read.get() |
: info_->pipe_p2c_read.get(); |
- EXPECT_NE(-1, fd); |
+ CHECK_NE(fd, -1); |
return fd; |
} |
int Multiprocess::WritePipeFD() const { |
int fd = info_->child_pid ? info_->pipe_p2c_write.get() |
: info_->pipe_c2p_write.get(); |
- EXPECT_NE(-1, fd); |
+ CHECK_NE(fd, -1); |
return fd; |
} |
+void Multiprocess::CloseReadPipe() { |
+ if (info_->child_pid) { |
+ info_->pipe_c2p_read.reset(); |
+ } else { |
+ info_->pipe_p2c_read.reset(); |
+ } |
+} |
+ |
+void Multiprocess::CloseWritePipe() { |
+ if (info_->child_pid) { |
+ info_->pipe_p2c_write.reset(); |
+ } else { |
+ info_->pipe_c2p_write.reset(); |
+ } |
+} |
+ |
void Multiprocess::RunParent() { |
// The parent uses the read end of c2p and the write end of p2c. |
info_->pipe_c2p_write.reset(); |