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 "net/server/http_server.h" | 5 #include "net/server/http_server.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 HttpServerRequestInfo GetRequest(size_t request_index) { | 242 HttpServerRequestInfo GetRequest(size_t request_index) { |
243 return requests_[request_index].first; | 243 return requests_[request_index].first; |
244 } | 244 } |
245 | 245 |
246 int GetConnectionId(size_t request_index) { | 246 int GetConnectionId(size_t request_index) { |
247 return requests_[request_index].second; | 247 return requests_[request_index].second; |
248 } | 248 } |
249 | 249 |
250 void HandleAcceptResult(std::unique_ptr<StreamSocket> socket) { | 250 void HandleAcceptResult(std::unique_ptr<StreamSocket> socket) { |
251 server_->accepted_socket_.reset(socket.release()); | 251 server_->accepted_socket_ = std::move(socket); |
252 server_->HandleAcceptResult(OK); | 252 server_->HandleAcceptResult(OK); |
253 } | 253 } |
254 | 254 |
255 std::unordered_map<int, bool>& connection_map() { return connection_map_; } | 255 std::unordered_map<int, bool>& connection_map() { return connection_map_; } |
256 | 256 |
257 protected: | 257 protected: |
258 std::unique_ptr<HttpServer> server_; | 258 std::unique_ptr<HttpServer> server_; |
259 IPEndPoint server_address_; | 259 IPEndPoint server_address_; |
260 base::Closure run_loop_quit_func_; | 260 base::Closure run_loop_quit_func_; |
261 std::vector<std::pair<HttpServerRequestInfo, int> > requests_; | 261 std::vector<std::pair<HttpServerRequestInfo, int> > requests_; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 ASSERT_THAT(client.ConnectAndWait(server_address_), IsOk()); | 699 ASSERT_THAT(client.ConnectAndWait(server_address_), IsOk()); |
700 client.Send("GET / HTTP/1.1\r\n\r\n"); | 700 client.Send("GET / HTTP/1.1\r\n\r\n"); |
701 ASSERT_FALSE(RunUntilRequestsReceived(1)); | 701 ASSERT_FALSE(RunUntilRequestsReceived(1)); |
702 ASSERT_EQ(1ul, connection_ids_.size()); | 702 ASSERT_EQ(1ul, connection_ids_.size()); |
703 ASSERT_EQ(0ul, requests_.size()); | 703 ASSERT_EQ(0ul, requests_.size()); |
704 } | 704 } |
705 | 705 |
706 } // namespace | 706 } // namespace |
707 | 707 |
708 } // namespace net | 708 } // namespace net |
OLD | NEW |