| 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_EMBEDDED_TEST_SERVER_H_ | 5 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| 6 #define NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ | 6 #define NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Shuts down the server. | 160 // Shuts down the server. |
| 161 void ShutdownOnIOThread(); | 161 void ShutdownOnIOThread(); |
| 162 | 162 |
| 163 // Handles a request when it is parsed. It passes the request to registed | 163 // Handles a request when it is parsed. It passes the request to registed |
| 164 // request handlers and sends a http response. | 164 // request handlers and sends a http response. |
| 165 void HandleRequest(HttpConnection* connection, | 165 void HandleRequest(HttpConnection* connection, |
| 166 scoped_ptr<HttpRequest> request); | 166 scoped_ptr<HttpRequest> request); |
| 167 | 167 |
| 168 // StreamListenSocket::Delegate overrides: | 168 // StreamListenSocket::Delegate overrides: |
| 169 virtual void DidAccept(StreamListenSocket* server, | 169 virtual void DidAccept(StreamListenSocket* server, |
| 170 scoped_ptr<StreamListenSocket> connection) OVERRIDE; | 170 scoped_ptr<StreamListenSocket> connection) override; |
| 171 virtual void DidRead(StreamListenSocket* connection, | 171 virtual void DidRead(StreamListenSocket* connection, |
| 172 const char* data, | 172 const char* data, |
| 173 int length) OVERRIDE; | 173 int length) override; |
| 174 virtual void DidClose(StreamListenSocket* connection) OVERRIDE; | 174 virtual void DidClose(StreamListenSocket* connection) override; |
| 175 | 175 |
| 176 HttpConnection* FindConnection(StreamListenSocket* socket); | 176 HttpConnection* FindConnection(StreamListenSocket* socket); |
| 177 | 177 |
| 178 // Posts a task to the |io_thread_| and waits for a reply. | 178 // Posts a task to the |io_thread_| and waits for a reply. |
| 179 bool PostTaskToIOThreadAndWait( | 179 bool PostTaskToIOThreadAndWait( |
| 180 const base::Closure& closure) WARN_UNUSED_RESULT; | 180 const base::Closure& closure) WARN_UNUSED_RESULT; |
| 181 | 181 |
| 182 scoped_ptr<base::Thread> io_thread_; | 182 scoped_ptr<base::Thread> io_thread_; |
| 183 | 183 |
| 184 scoped_ptr<HttpListenSocket> listen_socket_; | 184 scoped_ptr<HttpListenSocket> listen_socket_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 197 // invalidate its weak pointers before any other members are destroyed. | 197 // invalidate its weak pointers before any other members are destroyed. |
| 198 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; | 198 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; |
| 199 | 199 |
| 200 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); | 200 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 } // namespace test_servers | 203 } // namespace test_servers |
| 204 } // namespace net | 204 } // namespace net |
| 205 | 205 |
| 206 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ | 206 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| OLD | NEW |