OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_HTTP_CONNECTION_H_ | 5 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_HTTP_CONNECTION_H_ |
6 #define NET_TEST_EMBEDDED_TEST_SERVER_HTTP_CONNECTION_H_ | 6 #define NET_TEST_EMBEDDED_TEST_SERVER_HTTP_CONNECTION_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
17 #include "net/test/embedded_test_server/http_request.h" | 17 #include "net/test/embedded_test_server/http_request.h" |
18 #include "net/test/embedded_test_server/http_response.h" | 18 #include "net/test/embedded_test_server/http_response.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 class StreamSocket; | 22 class StreamSocket; |
23 | 23 |
24 namespace test_server { | 24 namespace test_server { |
25 | 25 |
26 class HttpConnection; | 26 class HttpConnection; |
27 class HttpResponse; | |
28 | 27 |
29 // Calblack called when a request is parsed. Response should be sent | 28 // Calblack called when a request is parsed. Response should be sent |
30 // using HttpConnection::SendResponse() on the |connection| argument. | 29 // using HttpConnection::SendResponse() on the |connection| argument. |
31 typedef base::Callback<void(HttpConnection* connection, | 30 typedef base::Callback<void(HttpConnection* connection, |
32 std::unique_ptr<HttpRequest> request)> | 31 std::unique_ptr<HttpRequest> request)> |
33 HandleRequestCallback; | 32 HandleRequestCallback; |
34 | 33 |
35 // Wraps the connection socket. Accepts incoming data and sends responses. | 34 // Wraps the connection socket. Accepts incoming data and sends responses. |
36 // If a valid request is parsed, then |callback_| is invoked. | 35 // If a valid request is parsed, then |callback_| is invoked. |
37 class HttpConnection { | 36 class HttpConnection { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 68 |
70 base::WeakPtrFactory<HttpConnection> weak_factory_; | 69 base::WeakPtrFactory<HttpConnection> weak_factory_; |
71 | 70 |
72 DISALLOW_COPY_AND_ASSIGN(HttpConnection); | 71 DISALLOW_COPY_AND_ASSIGN(HttpConnection); |
73 }; | 72 }; |
74 | 73 |
75 } // namespace test_server | 74 } // namespace test_server |
76 } // namespace net | 75 } // namespace net |
77 | 76 |
78 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_CONNECTION_H_ | 77 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_CONNECTION_H_ |
OLD | NEW |