diff options
-rw-r--r-- | net/net.gyp | 3 | ||||
-rw-r--r-- | net/test/test_server_posix.cc | 16 |
2 files changed, 17 insertions, 2 deletions
diff --git a/net/net.gyp b/net/net.gyp index 4a2db1b..6e7ef98 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -800,7 +800,6 @@ 'net_test_support', '../base/base.gyp:base', '../base/base.gyp:base_i18n', - '../base/base.gyp:test_support_base', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', '../third_party/zlib/zlib.gyp:zlib', @@ -1059,7 +1058,6 @@ 'net_test_support', '../base/base.gyp:base', '../base/base.gyp:base_i18n', - '../base/base.gyp:test_support_base', '../base/base.gyp:test_support_perf', '../testing/gtest.gyp:gtest', ], @@ -1138,6 +1136,7 @@ 'dependencies': [ 'net', '../base/base.gyp:base', + '../base/base.gyp:test_support_base', '../testing/gtest.gyp:gtest', ], 'sources': [ diff --git a/net/test/test_server_posix.cc b/net/test/test_server_posix.cc index 6e65bcf..1456ac8 100644 --- a/net/test/test_server_posix.cc +++ b/net/test/test_server_posix.cc @@ -4,6 +4,8 @@ #include "net/test/test_server.h" +#include <poll.h> + #include <vector> #include "base/file_util.h" @@ -11,6 +13,7 @@ #include "base/process_util.h" #include "base/string_number_conversions.h" #include "base/string_util.h" +#include "base/test/test_timeouts.h" namespace { @@ -107,6 +110,19 @@ bool TestServer::LaunchPython(const FilePath& testserver_path) { } bool TestServer::WaitToStart() { + struct pollfd poll_fds[1]; + + poll_fds[0].fd = child_fd_; + poll_fds[0].events = POLLIN | POLLPRI; + poll_fds[0].revents = 0; + + int rv = HANDLE_EINTR(poll(poll_fds, 1, + TestTimeouts::action_max_timeout_ms())); + if (rv != 1) { + LOG(ERROR) << "Failed to poll for the child file descriptor."; + return false; + } + char buf[8]; ssize_t n = HANDLE_EINTR(read(child_fd_, buf, sizeof(buf))); // We don't need the FD anymore. |