| 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 <stdint.h> |
| 9 |
| 8 #include <map> | 10 #include <map> |
| 9 #include <string> | 11 #include <string> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 19 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 20 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
| 21 #include "crypto/rsa_private_key.h" | 23 #include "crypto/rsa_private_key.h" |
| 22 #include "net/base/address_list.h" | 24 #include "net/base/address_list.h" |
| 23 #include "net/base/host_port_pair.h" | 25 #include "net/base/host_port_pair.h" |
| 24 #include "net/base/ip_endpoint.h" | 26 #include "net/base/ip_endpoint.h" |
| 25 #include "net/cert/x509_certificate.h" | 27 #include "net/cert/x509_certificate.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Similar to the above method with the difference that it uses the supplied | 165 // Similar to the above method with the difference that it uses the supplied |
| 164 // |hostname| for the URL instead of 127.0.0.1. The hostname should be | 166 // |hostname| for the URL instead of 127.0.0.1. The hostname should be |
| 165 // resolved to 127.0.0.1. | 167 // resolved to 127.0.0.1. |
| 166 GURL GetURL(const std::string& hostname, | 168 GURL GetURL(const std::string& hostname, |
| 167 const std::string& relative_url) const; | 169 const std::string& relative_url) const; |
| 168 | 170 |
| 169 // Returns the address list needed to connect to the server. | 171 // Returns the address list needed to connect to the server. |
| 170 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; | 172 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; |
| 171 | 173 |
| 172 // Returns the port number used by the server. | 174 // Returns the port number used by the server. |
| 173 uint16 port() const { return port_; } | 175 uint16_t port() const { return port_; } |
| 174 | 176 |
| 175 void SetSSLConfig(ServerCertificate cert, const SSLServerConfig& ssl_config); | 177 void SetSSLConfig(ServerCertificate cert, const SSLServerConfig& ssl_config); |
| 176 void SetSSLConfig(ServerCertificate cert); | 178 void SetSSLConfig(ServerCertificate cert); |
| 177 | 179 |
| 178 // Returns the file name of the certificate the server is using. The test | 180 // Returns the file name of the certificate the server is using. The test |
| 179 // certificates can be found in net/data/ssl/certificates/. | 181 // certificates can be found in net/data/ssl/certificates/. |
| 180 std::string GetCertificateName() const; | 182 std::string GetCertificateName() const; |
| 181 | 183 |
| 182 // Returns the certificate that the server is using. | 184 // Returns the certificate that the server is using. |
| 183 scoped_refptr<X509Certificate> GetCertificate() const; | 185 scoped_refptr<X509Certificate> GetCertificate() const; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 const base::Closure& closure) WARN_UNUSED_RESULT; | 250 const base::Closure& closure) WARN_UNUSED_RESULT; |
| 249 | 251 |
| 250 const bool is_using_ssl_; | 252 const bool is_using_ssl_; |
| 251 | 253 |
| 252 scoped_ptr<base::Thread> io_thread_; | 254 scoped_ptr<base::Thread> io_thread_; |
| 253 | 255 |
| 254 scoped_ptr<TCPServerSocket> listen_socket_; | 256 scoped_ptr<TCPServerSocket> listen_socket_; |
| 255 scoped_ptr<StreamSocket> accepted_socket_; | 257 scoped_ptr<StreamSocket> accepted_socket_; |
| 256 | 258 |
| 257 EmbeddedTestServerConnectionListener* connection_listener_; | 259 EmbeddedTestServerConnectionListener* connection_listener_; |
| 258 uint16 port_; | 260 uint16_t port_; |
| 259 GURL base_url_; | 261 GURL base_url_; |
| 260 IPEndPoint local_endpoint_; | 262 IPEndPoint local_endpoint_; |
| 261 | 263 |
| 262 // Owns the HttpConnection objects. | 264 // Owns the HttpConnection objects. |
| 263 std::map<StreamSocket*, HttpConnection*> connections_; | 265 std::map<StreamSocket*, HttpConnection*> connections_; |
| 264 | 266 |
| 265 // Vector of registered and default request handlers. | 267 // Vector of registered and default request handlers. |
| 266 std::vector<HandleRequestCallback> request_handlers_; | 268 std::vector<HandleRequestCallback> request_handlers_; |
| 267 std::vector<HandleRequestCallback> default_request_handlers_; | 269 std::vector<HandleRequestCallback> default_request_handlers_; |
| 268 | 270 |
| 269 base::ThreadChecker thread_checker_; | 271 base::ThreadChecker thread_checker_; |
| 270 | 272 |
| 271 net::SSLServerConfig ssl_config_; | 273 net::SSLServerConfig ssl_config_; |
| 272 ServerCertificate cert_; | 274 ServerCertificate cert_; |
| 273 | 275 |
| 274 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; | 276 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; |
| 275 | 277 |
| 276 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); | 278 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); |
| 277 }; | 279 }; |
| 278 | 280 |
| 279 } // namespace test_server | 281 } // namespace test_server |
| 280 | 282 |
| 281 // TODO(svaldez): Refactor EmbeddedTestServer to be in the net namespace. | 283 // TODO(svaldez): Refactor EmbeddedTestServer to be in the net namespace. |
| 282 using test_server::EmbeddedTestServer; | 284 using test_server::EmbeddedTestServer; |
| 283 | 285 |
| 284 } // namespace net | 286 } // namespace net |
| 285 | 287 |
| 286 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ | 288 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| OLD | NEW |