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> |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 return type == BaseTestServer::TYPE_HTTPS || | 255 return type == BaseTestServer::TYPE_HTTPS || |
256 type == BaseTestServer::TYPE_WSS; | 256 type == BaseTestServer::TYPE_WSS; |
257 } | 257 } |
258 | 258 |
259 // Enable HTTP basic authentication. Currently this only works for TYPE_WS and | 259 // Enable HTTP basic authentication. Currently this only works for TYPE_WS and |
260 // TYPE_WSS. | 260 // TYPE_WSS. |
261 void set_websocket_basic_auth(bool ws_basic_auth) { | 261 void set_websocket_basic_auth(bool ws_basic_auth) { |
262 ws_basic_auth_ = ws_basic_auth; | 262 ws_basic_auth_ = ws_basic_auth; |
263 } | 263 } |
264 | 264 |
| 265 // Marks the root certificate of an HTTPS test server as trusted for |
| 266 // the duration of tests. |
| 267 bool LoadTestRootCert() const WARN_UNUSED_RESULT; |
| 268 |
265 protected: | 269 protected: |
266 virtual ~BaseTestServer(); | 270 virtual ~BaseTestServer(); |
267 Type type() const { return type_; } | 271 Type type() const { return type_; } |
268 | 272 |
269 // Gets port currently assigned to host_port_pair_ without checking | 273 // Gets port currently assigned to host_port_pair_ without checking |
270 // whether it's available (server started) or not. | 274 // whether it's available (server started) or not. |
271 uint16 GetPort(); | 275 uint16 GetPort(); |
272 | 276 |
273 // Sets |port| as the actual port used by Python based test server. | 277 // Sets |port| as the actual port used by Python based test server. |
274 void SetPort(uint16 port); | 278 void SetPort(uint16 port); |
(...skipping 18 matching lines...) Expand all Loading... |
293 WARN_UNUSED_RESULT; | 297 WARN_UNUSED_RESULT; |
294 | 298 |
295 // Subclasses can override this to add arguments that are specific to their | 299 // Subclasses can override this to add arguments that are specific to their |
296 // own test servers. | 300 // own test servers. |
297 virtual bool GenerateAdditionalArguments( | 301 virtual bool GenerateAdditionalArguments( |
298 base::DictionaryValue* arguments) const WARN_UNUSED_RESULT; | 302 base::DictionaryValue* arguments) const WARN_UNUSED_RESULT; |
299 | 303 |
300 private: | 304 private: |
301 void Init(const std::string& host); | 305 void Init(const std::string& host); |
302 | 306 |
303 // Marks the root certificate of an HTTPS test server as trusted for | |
304 // the duration of tests. | |
305 bool LoadTestRootCert() const WARN_UNUSED_RESULT; | |
306 | |
307 // Document root of the test server. | 307 // Document root of the test server. |
308 base::FilePath document_root_; | 308 base::FilePath document_root_; |
309 | 309 |
310 // Directory that contains the SSL certificates. | 310 // Directory that contains the SSL certificates. |
311 base::FilePath certificates_dir_; | 311 base::FilePath certificates_dir_; |
312 | 312 |
313 // Address the test server listens on. | 313 // Address the test server listens on. |
314 HostPortPair host_port_pair_; | 314 HostPortPair host_port_pair_; |
315 | 315 |
316 // Holds the data sent from the server (e.g., port number). | 316 // Holds the data sent from the server (e.g., port number). |
(...skipping 15 matching lines...) Expand all Loading... |
332 bool ws_basic_auth_; | 332 bool ws_basic_auth_; |
333 | 333 |
334 scoped_ptr<ScopedPortException> allowed_port_; | 334 scoped_ptr<ScopedPortException> allowed_port_; |
335 | 335 |
336 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 336 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
337 }; | 337 }; |
338 | 338 |
339 } // namespace net | 339 } // namespace net |
340 | 340 |
341 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 341 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
OLD | NEW |