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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 return type == BaseTestServer::TYPE_HTTPS || | 250 return type == BaseTestServer::TYPE_HTTPS || |
251 type == BaseTestServer::TYPE_WSS; | 251 type == BaseTestServer::TYPE_WSS; |
252 } | 252 } |
253 | 253 |
254 // Enable HTTP basic authentication. Currently this only works for TYPE_WS and | 254 // Enable HTTP basic authentication. Currently this only works for TYPE_WS and |
255 // TYPE_WSS. | 255 // TYPE_WSS. |
256 void set_websocket_basic_auth(bool ws_basic_auth) { | 256 void set_websocket_basic_auth(bool ws_basic_auth) { |
257 ws_basic_auth_ = ws_basic_auth; | 257 ws_basic_auth_ = ws_basic_auth; |
258 } | 258 } |
259 | 259 |
260 // Marks the root certificate of an HTTPS test server as trusted for | |
261 // the duration of tests. | |
262 bool LoadTestRootCert() const WARN_UNUSED_RESULT; | |
Ryan Sleevi
2015/04/09 20:55:48
STYLE: Reorder the .cc if you reorder the .h
jww
2015/04/16 23:59:07
Done.
| |
263 | |
260 protected: | 264 protected: |
261 virtual ~BaseTestServer(); | 265 virtual ~BaseTestServer(); |
262 Type type() const { return type_; } | 266 Type type() const { return type_; } |
263 | 267 |
264 // Gets port currently assigned to host_port_pair_ without checking | 268 // Gets port currently assigned to host_port_pair_ without checking |
265 // whether it's available (server started) or not. | 269 // whether it's available (server started) or not. |
266 uint16 GetPort(); | 270 uint16 GetPort(); |
267 | 271 |
268 // Sets |port| as the actual port used by Python based test server. | 272 // Sets |port| as the actual port used by Python based test server. |
269 void SetPort(uint16 port); | 273 void SetPort(uint16 port); |
(...skipping 18 matching lines...) Expand all Loading... | |
288 WARN_UNUSED_RESULT; | 292 WARN_UNUSED_RESULT; |
289 | 293 |
290 // Subclasses can override this to add arguments that are specific to their | 294 // Subclasses can override this to add arguments that are specific to their |
291 // own test servers. | 295 // own test servers. |
292 virtual bool GenerateAdditionalArguments( | 296 virtual bool GenerateAdditionalArguments( |
293 base::DictionaryValue* arguments) const WARN_UNUSED_RESULT; | 297 base::DictionaryValue* arguments) const WARN_UNUSED_RESULT; |
294 | 298 |
295 private: | 299 private: |
296 void Init(const std::string& host); | 300 void Init(const std::string& host); |
297 | 301 |
298 // Marks the root certificate of an HTTPS test server as trusted for | |
299 // the duration of tests. | |
300 bool LoadTestRootCert() const WARN_UNUSED_RESULT; | |
301 | |
302 // Document root of the test server. | 302 // Document root of the test server. |
303 base::FilePath document_root_; | 303 base::FilePath document_root_; |
304 | 304 |
305 // Directory that contains the SSL certificates. | 305 // Directory that contains the SSL certificates. |
306 base::FilePath certificates_dir_; | 306 base::FilePath certificates_dir_; |
307 | 307 |
308 // Address the test server listens on. | 308 // Address the test server listens on. |
309 HostPortPair host_port_pair_; | 309 HostPortPair host_port_pair_; |
310 | 310 |
311 // Holds the data sent from the server (e.g., port number). | 311 // Holds the data sent from the server (e.g., port number). |
(...skipping 15 matching lines...) Expand all Loading... | |
327 bool ws_basic_auth_; | 327 bool ws_basic_auth_; |
328 | 328 |
329 scoped_ptr<ScopedPortException> allowed_port_; | 329 scoped_ptr<ScopedPortException> allowed_port_; |
330 | 330 |
331 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 331 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
332 }; | 332 }; |
333 | 333 |
334 } // namespace net | 334 } // namespace net |
335 | 335 |
336 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 336 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
OLD | NEW |