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 <vector> | 10 #include <vector> |
11 | 11 |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
18 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
19 | 19 |
20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
21 #include "base/scoped_handle_win.h" | 21 #include "base/scoped_handle_win.h" |
22 #endif | 22 #endif |
23 | 23 |
24 #if defined(USE_NSS) | |
25 #include "base/ref_counted.h" | |
26 #include "net/base/x509_certificate.h" | |
27 #endif | |
28 | |
29 class CommandLine; | 24 class CommandLine; |
30 class GURL; | 25 class GURL; |
31 | 26 |
32 namespace net { | 27 namespace net { |
33 | 28 |
34 class AddressList; | 29 class AddressList; |
35 | 30 |
36 // This object bounds the lifetime of an external python-based HTTP/FTP server | 31 // This object bounds the lifetime of an external python-based HTTP/FTP server |
37 // that can provide various responses useful for testing. | 32 // that can provide various responses useful for testing. |
38 class TestServer { | 33 class TestServer { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 129 |
135 // Launches the Python test server. Returns true on success. | 130 // Launches the Python test server. Returns true on success. |
136 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; | 131 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; |
137 | 132 |
138 // Waits for the server to start. Returns true on success. | 133 // Waits for the server to start. Returns true on success. |
139 bool WaitToStart() WARN_UNUSED_RESULT; | 134 bool WaitToStart() WARN_UNUSED_RESULT; |
140 | 135 |
141 // Returns path to the root certificate. | 136 // Returns path to the root certificate. |
142 FilePath GetRootCertificatePath(); | 137 FilePath GetRootCertificatePath(); |
143 | 138 |
144 // Returns false if our test root certificate is not trusted. | |
145 bool CheckCATrusted() WARN_UNUSED_RESULT; | |
146 | |
147 // Load the test root cert, if it hasn't been loaded yet. | 139 // Load the test root cert, if it hasn't been loaded yet. |
148 bool LoadTestRootCert() WARN_UNUSED_RESULT; | 140 bool LoadTestRootCert() WARN_UNUSED_RESULT; |
149 | 141 |
150 // Add the command line arguments for the Python test server to | 142 // Add the command line arguments for the Python test server to |
151 // |command_line|. Return true on success. | 143 // |command_line|. Return true on success. |
152 bool AddCommandLineArguments(CommandLine* command_line) const; | 144 bool AddCommandLineArguments(CommandLine* command_line) const; |
153 | 145 |
154 // Document root of the test server. | 146 // Document root of the test server. |
155 FilePath document_root_; | 147 FilePath document_root_; |
156 | 148 |
(...skipping 19 matching lines...) Expand all Loading... |
176 | 168 |
177 #if defined(OS_POSIX) | 169 #if defined(OS_POSIX) |
178 // The file descriptor the child writes to when it starts. | 170 // The file descriptor the child writes to when it starts. |
179 int child_fd_; | 171 int child_fd_; |
180 file_util::ScopedFD child_fd_closer_; | 172 file_util::ScopedFD child_fd_closer_; |
181 #endif | 173 #endif |
182 | 174 |
183 // If |type_| is TYPE_HTTPS, the TLS settings to use for the test server. | 175 // If |type_| is TYPE_HTTPS, the TLS settings to use for the test server. |
184 HTTPSOptions https_options_; | 176 HTTPSOptions https_options_; |
185 | 177 |
186 #if defined(USE_NSS) | |
187 scoped_refptr<X509Certificate> cert_; | |
188 #endif | |
189 | |
190 Type type_; | 178 Type type_; |
191 | 179 |
192 DISALLOW_COPY_AND_ASSIGN(TestServer); | 180 DISALLOW_COPY_AND_ASSIGN(TestServer); |
193 }; | 181 }; |
194 | 182 |
195 } // namespace net | 183 } // namespace net |
196 | 184 |
197 #endif // NET_TEST_TEST_SERVER_H_ | 185 #endif // NET_TEST_TEST_SERVER_H_ |
OLD | NEW |