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 #ifndef NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 5 #ifndef NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
6 #define NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 6 #define NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
16 #include "net/ssl/ssl_client_cert_type.h" | 17 #include "net/ssl/ssl_client_cert_type.h" |
17 | 18 |
18 class GURL; | 19 class GURL; |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class DictionaryValue; | 22 class DictionaryValue; |
22 } | 23 } |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 | 26 |
26 class AddressList; | 27 class AddressList; |
27 class ScopedPortException; | 28 class ScopedPortException; |
| 29 class X509Certificate; |
28 | 30 |
29 // The base class of Test server implementation. | 31 // The base class of Test server implementation. |
30 class BaseTestServer { | 32 class BaseTestServer { |
31 public: | 33 public: |
32 typedef std::pair<std::string, std::string> StringPair; | 34 typedef std::pair<std::string, std::string> StringPair; |
33 | 35 |
34 // Following types represent protocol schemes. See also | 36 // Following types represent protocol schemes. See also |
35 // http://www.iana.org/assignments/uri-schemes.html | 37 // http://www.iana.org/assignments/uri-schemes.html |
36 enum Type { | 38 enum Type { |
37 TYPE_BASIC_AUTH_PROXY, | 39 TYPE_BASIC_AUTH_PROXY, |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 266 |
265 // Disable creation of anonymous FTP user. | 267 // Disable creation of anonymous FTP user. |
266 void set_no_anonymous_ftp_user(bool no_anonymous_ftp_user) { | 268 void set_no_anonymous_ftp_user(bool no_anonymous_ftp_user) { |
267 no_anonymous_ftp_user_ = no_anonymous_ftp_user; | 269 no_anonymous_ftp_user_ = no_anonymous_ftp_user; |
268 } | 270 } |
269 | 271 |
270 // Marks the root certificate of an HTTPS test server as trusted for | 272 // Marks the root certificate of an HTTPS test server as trusted for |
271 // the duration of tests. | 273 // the duration of tests. |
272 bool LoadTestRootCert() const WARN_UNUSED_RESULT; | 274 bool LoadTestRootCert() const WARN_UNUSED_RESULT; |
273 | 275 |
| 276 // Returns the certificate that the server is using. |
| 277 scoped_refptr<X509Certificate> GetCertificate() const; |
| 278 |
274 protected: | 279 protected: |
275 virtual ~BaseTestServer(); | 280 virtual ~BaseTestServer(); |
276 Type type() const { return type_; } | 281 Type type() const { return type_; } |
277 | 282 |
278 // Gets port currently assigned to host_port_pair_ without checking | 283 // Gets port currently assigned to host_port_pair_ without checking |
279 // whether it's available (server started) or not. | 284 // whether it's available (server started) or not. |
280 uint16 GetPort(); | 285 uint16 GetPort(); |
281 | 286 |
282 // Sets |port| as the actual port used by Python based test server. | 287 // Sets |port| as the actual port used by Python based test server. |
283 void SetPort(uint16 port); | 288 void SetPort(uint16 port); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 bool no_anonymous_ftp_user_; | 345 bool no_anonymous_ftp_user_; |
341 | 346 |
342 scoped_ptr<ScopedPortException> allowed_port_; | 347 scoped_ptr<ScopedPortException> allowed_port_; |
343 | 348 |
344 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 349 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
345 }; | 350 }; |
346 | 351 |
347 } // namespace net | 352 } // namespace net |
348 | 353 |
349 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 354 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
OLD | NEW |