OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <utility> | 6 #include <utility> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 int connect_result_; | 174 int connect_result_; |
175 }; | 175 }; |
176 | 176 |
177 } // namespace | 177 } // namespace |
178 | 178 |
179 class HttpServerTest : public testing::Test, | 179 class HttpServerTest : public testing::Test, |
180 public HttpServer::Delegate { | 180 public HttpServer::Delegate { |
181 public: | 181 public: |
182 HttpServerTest() : quit_after_request_count_(0) {} | 182 HttpServerTest() : quit_after_request_count_(0) {} |
183 | 183 |
184 virtual void SetUp() override { | 184 void SetUp() override { |
185 scoped_ptr<ServerSocket> server_socket( | 185 scoped_ptr<ServerSocket> server_socket( |
186 new TCPServerSocket(NULL, net::NetLog::Source())); | 186 new TCPServerSocket(NULL, net::NetLog::Source())); |
187 server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1); | 187 server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1); |
188 server_.reset(new HttpServer(server_socket.Pass(), this)); | 188 server_.reset(new HttpServer(server_socket.Pass(), this)); |
189 ASSERT_EQ(OK, server_->GetLocalAddress(&server_address_)); | 189 ASSERT_EQ(OK, server_->GetLocalAddress(&server_address_)); |
190 } | 190 } |
191 | 191 |
192 void OnConnect(int connection_id) override {} | 192 void OnConnect(int connection_id) override {} |
193 | 193 |
194 void OnHttpRequest(int connection_id, | 194 void OnHttpRequest(int connection_id, |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); | 629 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); |
630 client.Send("GET / HTTP/1.1\r\n\r\n"); | 630 client.Send("GET / HTTP/1.1\r\n\r\n"); |
631 ASSERT_FALSE(RunUntilRequestsReceived(1)); | 631 ASSERT_FALSE(RunUntilRequestsReceived(1)); |
632 ASSERT_EQ(1ul, connection_ids_.size()); | 632 ASSERT_EQ(1ul, connection_ids_.size()); |
633 ASSERT_EQ(0ul, requests_.size()); | 633 ASSERT_EQ(0ul, requests_.size()); |
634 } | 634 } |
635 | 635 |
636 } // namespace | 636 } // namespace |
637 | 637 |
638 } // namespace net | 638 } // namespace net |
OLD | NEW |