OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TEST_SERVER_H_ | 5 #ifndef NET_TEST_TEST_SERVER_H_ |
6 #define NET_TEST_TEST_SERVER_H_ | 6 #define NET_TEST_TEST_SERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
19 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
21 | 21 |
22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
23 #include "base/scoped_handle_win.h" | 23 #include "base/scoped_handle_win.h" |
24 #endif | 24 #endif |
25 | 25 |
26 #if defined(USE_OPENSSL) || defined(USE_NSS) | |
27 #include "base/ref_counted.h" | |
28 #include "net/base/x509_certificate.h" | |
29 #endif | |
30 | |
31 class CommandLine; | 26 class CommandLine; |
32 class DictionaryValue; | 27 class DictionaryValue; |
33 class GURL; | 28 class GURL; |
34 | 29 |
35 namespace net { | 30 namespace net { |
36 | 31 |
37 class AddressList; | 32 class AddressList; |
38 | 33 |
39 // This object bounds the lifetime of an external python-based HTTP/FTP server | 34 // This object bounds the lifetime of an external python-based HTTP/FTP server |
40 // that can provide various responses useful for testing. | 35 // that can provide various responses useful for testing. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Waits for the server to start. Returns true on success. | 144 // Waits for the server to start. Returns true on success. |
150 bool WaitToStart() WARN_UNUSED_RESULT; | 145 bool WaitToStart() WARN_UNUSED_RESULT; |
151 | 146 |
152 // Parses the server data read from the test server. Returns true | 147 // Parses the server data read from the test server. Returns true |
153 // on success. | 148 // on success. |
154 bool ParseServerData(const std::string& server_data) WARN_UNUSED_RESULT; | 149 bool ParseServerData(const std::string& server_data) WARN_UNUSED_RESULT; |
155 | 150 |
156 // Returns path to the root certificate. | 151 // Returns path to the root certificate. |
157 FilePath GetRootCertificatePath(); | 152 FilePath GetRootCertificatePath(); |
158 | 153 |
159 // Returns false if our test root certificate is not trusted. | |
160 bool CheckCATrusted() WARN_UNUSED_RESULT; | |
161 | |
162 // Load the test root cert, if it hasn't been loaded yet. | 154 // Load the test root cert, if it hasn't been loaded yet. |
163 bool LoadTestRootCert() WARN_UNUSED_RESULT; | 155 bool LoadTestRootCert() WARN_UNUSED_RESULT; |
164 | 156 |
165 // Add the command line arguments for the Python test server to | 157 // Add the command line arguments for the Python test server to |
166 // |command_line|. Return true on success. | 158 // |command_line|. Return true on success. |
167 bool AddCommandLineArguments(CommandLine* command_line) const; | 159 bool AddCommandLineArguments(CommandLine* command_line) const; |
168 | 160 |
169 // Document root of the test server. | 161 // Document root of the test server. |
170 FilePath document_root_; | 162 FilePath document_root_; |
171 | 163 |
(...skipping 24 matching lines...) Expand all Loading... |
196 | 188 |
197 #if defined(OS_POSIX) | 189 #if defined(OS_POSIX) |
198 // The file descriptor the child writes to when it starts. | 190 // The file descriptor the child writes to when it starts. |
199 int child_fd_; | 191 int child_fd_; |
200 file_util::ScopedFD child_fd_closer_; | 192 file_util::ScopedFD child_fd_closer_; |
201 #endif | 193 #endif |
202 | 194 |
203 // If |type_| is TYPE_HTTPS, the TLS settings to use for the test server. | 195 // If |type_| is TYPE_HTTPS, the TLS settings to use for the test server. |
204 HTTPSOptions https_options_; | 196 HTTPSOptions https_options_; |
205 | 197 |
206 #if defined(USE_OPENSSL) || defined(USE_NSS) | |
207 scoped_refptr<X509Certificate> cert_; | |
208 #endif | |
209 | |
210 Type type_; | 198 Type type_; |
211 | 199 |
212 // Has the server been started? | 200 // Has the server been started? |
213 bool started_; | 201 bool started_; |
214 | 202 |
215 DISALLOW_COPY_AND_ASSIGN(TestServer); | 203 DISALLOW_COPY_AND_ASSIGN(TestServer); |
216 }; | 204 }; |
217 | 205 |
218 } // namespace net | 206 } // namespace net |
219 | 207 |
220 #endif // NET_TEST_TEST_SERVER_H_ | 208 #endif // NET_TEST_TEST_SERVER_H_ |
OLD | NEW |