OLD | NEW |
1 // Copyright (c) 2006-2008 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_SOCKET_SSL_TEST_UTIL_H_ | 5 #ifndef NET_SOCKET_SSL_TEST_UTIL_H_ |
6 #define NET_SOCKET_SSL_TEST_UTIL_H_ | 6 #define NET_SOCKET_SSL_TEST_UTIL_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 |
| 15 #if defined(OS_WIN) |
| 16 #include "base/scoped_handle_win.h" |
| 17 #endif |
| 18 |
14 #if defined(USE_NSS) | 19 #if defined(USE_NSS) |
15 #include "base/ref_counted.h" | 20 #include "base/ref_counted.h" |
16 #include "net/base/x509_certificate.h" | 21 #include "net/base/x509_certificate.h" |
17 #endif | 22 #endif |
18 | 23 |
19 namespace net { | 24 namespace net { |
20 | 25 |
21 // This object bounds the lifetime of an external python-based HTTP/HTTPS/FTP | 26 // This object bounds the lifetime of an external python-based HTTP/HTTPS/FTP |
22 // server that can provide various responses useful for testing. | 27 // server that can provide various responses useful for testing. |
23 // A few basic convenience methods are provided, but no | 28 // A few basic convenience methods are provided, but no |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void InitCertPath(); | 109 void InitCertPath(); |
105 | 110 |
106 FilePath document_root_dir_; | 111 FilePath document_root_dir_; |
107 | 112 |
108 FilePath cert_dir_; | 113 FilePath cert_dir_; |
109 | 114 |
110 FilePath python_runtime_; | 115 FilePath python_runtime_; |
111 | 116 |
112 base::ProcessHandle process_handle_; | 117 base::ProcessHandle process_handle_; |
113 | 118 |
| 119 #if defined(OS_WIN) |
| 120 // JobObject used to clean up orphaned child processes. |
| 121 ScopedHandle job_handle_; |
| 122 #endif |
| 123 |
114 // True if the server should handle each request in a separate process. | 124 // True if the server should handle each request in a separate process. |
115 bool forking_; | 125 bool forking_; |
116 | 126 |
117 // Number of tries and timeout for each try used for WaitToStart. | 127 // Number of tries and timeout for each try used for WaitToStart. |
118 int connection_attempts_; | 128 int connection_attempts_; |
119 int connection_timeout_; | 129 int connection_timeout_; |
120 | 130 |
121 #if defined(USE_NSS) | 131 #if defined(USE_NSS) |
122 scoped_refptr<X509Certificate> cert_; | 132 scoped_refptr<X509Certificate> cert_; |
123 #endif | 133 #endif |
124 | 134 |
125 DISALLOW_COPY_AND_ASSIGN(TestServerLauncher); | 135 DISALLOW_COPY_AND_ASSIGN(TestServerLauncher); |
126 }; | 136 }; |
127 | 137 |
128 } | 138 #if defined(OS_WIN) |
| 139 // Launch test server as a job so that it is not orphaned if the test case is |
| 140 // abnormally terminated. |
| 141 bool LaunchTestServerAsJob(const std::wstring& cmdline, |
| 142 bool start_hidden, |
| 143 base::ProcessHandle* process_handle, |
| 144 ScopedHandle* job_handle); |
| 145 #endif |
| 146 |
| 147 } // namespace net |
129 | 148 |
130 #endif // NET_SOCKET_SSL_TEST_UTIL_H_ | 149 #endif // NET_SOCKET_SSL_TEST_UTIL_H_ |
OLD | NEW |