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> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
22 #include "base/scoped_handle_win.h" | 22 #include "base/scoped_handle_win.h" |
23 #endif | 23 #endif |
24 | 24 |
25 #if defined(USE_NSS) | 25 #if defined(USE_NSS) |
26 #include "base/ref_counted.h" | 26 #include "base/ref_counted.h" |
27 #include "net/base/x509_certificate.h" | 27 #include "net/base/x509_certificate.h" |
28 #endif | 28 #endif |
29 | 29 |
30 class CommandLine; | 30 class CommandLine; |
| 31 class DictionaryValue; |
31 class GURL; | 32 class GURL; |
32 | 33 |
33 namespace net { | 34 namespace net { |
34 | 35 |
35 class AddressList; | 36 class AddressList; |
36 | 37 |
37 // This object bounds the lifetime of an external python-based HTTP/FTP server | 38 // This object bounds the lifetime of an external python-based HTTP/FTP server |
38 // that can provide various responses useful for testing. | 39 // that can provide various responses useful for testing. |
39 class TestServer { | 40 class TestServer { |
40 public: | 41 public: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 ~TestServer(); | 111 ~TestServer(); |
111 | 112 |
112 bool Start() WARN_UNUSED_RESULT; | 113 bool Start() WARN_UNUSED_RESULT; |
113 | 114 |
114 // Stop the server started by Start(). | 115 // Stop the server started by Start(). |
115 bool Stop(); | 116 bool Stop(); |
116 | 117 |
117 const FilePath& document_root() const { return document_root_; } | 118 const FilePath& document_root() const { return document_root_; } |
118 const HostPortPair& host_port_pair() const; | 119 const HostPortPair& host_port_pair() const; |
| 120 const DictionaryValue& server_data() const; |
119 std::string GetScheme() const; | 121 std::string GetScheme() const; |
120 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; | 122 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; |
121 | 123 |
122 GURL GetURL(const std::string& path) const; | 124 GURL GetURL(const std::string& path) const; |
123 | 125 |
124 GURL GetURLWithUser(const std::string& path, | 126 GURL GetURLWithUser(const std::string& path, |
125 const std::string& user) const; | 127 const std::string& user) const; |
126 | 128 |
127 GURL GetURLWithUserAndPassword(const std::string& path, | 129 GURL GetURLWithUserAndPassword(const std::string& path, |
128 const std::string& user, | 130 const std::string& user, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 167 |
166 // Document root of the test server. | 168 // Document root of the test server. |
167 FilePath document_root_; | 169 FilePath document_root_; |
168 | 170 |
169 // Directory that contains the SSL certificates. | 171 // Directory that contains the SSL certificates. |
170 FilePath certificates_dir_; | 172 FilePath certificates_dir_; |
171 | 173 |
172 // Address the test server listens on. | 174 // Address the test server listens on. |
173 HostPortPair host_port_pair_; | 175 HostPortPair host_port_pair_; |
174 | 176 |
| 177 // Holds the data sent from the server (e.g., port number). |
| 178 scoped_ptr<DictionaryValue> server_data_; |
| 179 |
175 // Handle of the Python process running the test server. | 180 // Handle of the Python process running the test server. |
176 base::ProcessHandle process_handle_; | 181 base::ProcessHandle process_handle_; |
177 | 182 |
178 #if defined(OS_WIN) | 183 #if defined(OS_WIN) |
179 // JobObject used to clean up orphaned child processes. | 184 // JobObject used to clean up orphaned child processes. |
180 ScopedHandle job_handle_; | 185 ScopedHandle job_handle_; |
181 | 186 |
182 // The pipe file handle we read from. | 187 // The pipe file handle we read from. |
183 ScopedHandle child_read_fd_; | 188 ScopedHandle child_read_fd_; |
184 | 189 |
(...skipping 18 matching lines...) Expand all Loading... |
203 | 208 |
204 // Has the server been started? | 209 // Has the server been started? |
205 bool started_; | 210 bool started_; |
206 | 211 |
207 DISALLOW_COPY_AND_ASSIGN(TestServer); | 212 DISALLOW_COPY_AND_ASSIGN(TestServer); |
208 }; | 213 }; |
209 | 214 |
210 } // namespace net | 215 } // namespace net |
211 | 216 |
212 #endif // NET_TEST_TEST_SERVER_H_ | 217 #endif // NET_TEST_TEST_SERVER_H_ |
OLD | NEW |