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

Unified Diff: net/server/http_server_unittest.cc

Issue 594393002: Add net::HttpServer::Delegate::OnConnect() function and set ChromeDriver buffer sizes to 100 MB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow the embedder to close the connection from OnConnect Created 6 years, 3 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 | « net/server/http_server.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/server/http_server_unittest.cc
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc
index 42e56399a10afc4d3ed71d17ebe8573957fad1f8..03f13bdf3b3260512f5196343ef67f99a2a79127 100644
--- a/net/server/http_server_unittest.cc
+++ b/net/server/http_server_unittest.cc
@@ -189,6 +189,8 @@ class HttpServerTest : public testing::Test,
ASSERT_EQ(OK, server_->GetLocalAddress(&server_address_));
}
+ virtual void OnConnect(int connection_id) OVERRIDE {}
+
virtual void OnHttpRequest(int connection_id,
const HttpServerRequestInfo& info) OVERRIDE {
requests_.push_back(std::make_pair(info, connection_id));
@@ -619,4 +621,28 @@ TEST_F(HttpServerTest, MultipleRequestsOnSameConnection) {
ASSERT_TRUE(EndsWith(response3, "Content for /test3", true));
}
+namespace {
mmenke 2014/09/24 15:38:45 nit: Can you just stick this entire file in the a
samuong 2014/09/24 16:32:51 I've done this as much as possible, but HttpServer
+
+class CloseOnConnectHttpServerTest : public HttpServerTest {
+ public:
+ virtual void OnConnect(int connection_id) OVERRIDE {
+ connection_ids_.push_back(connection_id);
+ server_->Close(connection_id);
+ }
+
+ protected:
+ std::vector<int> connection_ids_;
+};
+
+} // namespace
mmenke 2014/09/24 15:38:45 nit: 2 spaces between code and comment.
samuong 2014/09/24 16:32:51 Done.
+
+TEST_F(CloseOnConnectHttpServerTest, ServerImmediatelyClosesConnection) {
+ TestHttpClient client;
+ ASSERT_EQ(OK, client.ConnectAndWait(server_address_));
+ ASSERT_EQ(1ul, connection_ids_.size());
+ client.Send("GET / HTTP/1.1\r\n\r\n");
+ ASSERT_FALSE(RunUntilRequestsReceived(1));
+ ASSERT_EQ(0ul, requests_.size());
+}
+
} // namespace net
« no previous file with comments | « net/server/http_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698