Commit 966cd90b authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

network::HttpServer tests: Wait for the HttpServer to start listening.

The tests use an HttpServer run over a Mojo connection, but they don't
ensure that the HttpServer has started listening for connections before
trying to establish a connection to the server over a client socket
(also used over Mojo). The tests seem to be passing, but it sometimes
times out on Fuchsia, when the HttpServer tries to accept a second
socket. This seems likely due to some other bug (possibly in the
Fuchsia socket layer), but regardless of the underlying cause, having
the test fixture wait for the server to start listening seems to make
the test consistently pass, and is something the tests should be doing
anyways.

Bug: 1032620
Change-Id: I48b57e99923189496d4e405f84a22767ca42a68a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992205Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729477}
parent b6047264
......@@ -188,7 +188,11 @@ class HttpServerTest : public testing::Test, public HttpServer::Delegate {
run_loop.Run();
EXPECT_EQ(net::OK, net_error);
server_.reset(new HttpServer(std::move(server_socket_), this));
server_ = std::make_unique<HttpServer>(std::move(server_socket_), this);
// Wait for the HttpServer to start accepting connections. Since this is
// done in response to a request sent over a Mojo socket, it happens
// asynchronously.
base::RunLoop().RunUntilIdle();
}
void OnConnect(int connection_id) override {
......
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