| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 static bool GetFilePathWithReplacements( | 235 static bool GetFilePathWithReplacements( |
| 236 const std::string& original_path, | 236 const std::string& original_path, |
| 237 const std::vector<StringPair>& text_to_replace, | 237 const std::vector<StringPair>& text_to_replace, |
| 238 std::string* replacement_path); | 238 std::string* replacement_path); |
| 239 | 239 |
| 240 static bool UsingSSL(Type type) { | 240 static bool UsingSSL(Type type) { |
| 241 return type == BaseTestServer::TYPE_HTTPS || | 241 return type == BaseTestServer::TYPE_HTTPS || |
| 242 type == BaseTestServer::TYPE_WSS; | 242 type == BaseTestServer::TYPE_WSS; |
| 243 } | 243 } |
| 244 | 244 |
| 245 // Enable HTTP basic authentication. Currently this only works for TYPE_WS and | |
| 246 // TYPE_WSS. | |
| 247 void set_websocket_basic_auth(bool ws_basic_auth) { | |
| 248 ws_basic_auth_ = ws_basic_auth; | |
| 249 } | |
| 250 | |
| 251 protected: | 245 protected: |
| 252 virtual ~BaseTestServer(); | 246 virtual ~BaseTestServer(); |
| 253 Type type() const { return type_; } | 247 Type type() const { return type_; } |
| 254 | 248 |
| 255 // Gets port currently assigned to host_port_pair_ without checking | 249 // Gets port currently assigned to host_port_pair_ without checking |
| 256 // whether it's available (server started) or not. | 250 // whether it's available (server started) or not. |
| 257 uint16 GetPort(); | 251 uint16 GetPort(); |
| 258 | 252 |
| 259 // Sets |port| as the actual port used by Python based test server. | 253 // Sets |port| as the actual port used by Python based test server. |
| 260 void SetPort(uint16 port); | 254 void SetPort(uint16 port); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 SSLOptions ssl_options_; | 301 SSLOptions ssl_options_; |
| 308 | 302 |
| 309 Type type_; | 303 Type type_; |
| 310 | 304 |
| 311 // Has the server been started? | 305 // Has the server been started? |
| 312 bool started_; | 306 bool started_; |
| 313 | 307 |
| 314 // Enables logging of the server to the console. | 308 // Enables logging of the server to the console. |
| 315 bool log_to_console_; | 309 bool log_to_console_; |
| 316 | 310 |
| 317 // Is WebSocket basic HTTP authentication enabled? | |
| 318 bool ws_basic_auth_; | |
| 319 | |
| 320 scoped_ptr<ScopedPortException> allowed_port_; | 311 scoped_ptr<ScopedPortException> allowed_port_; |
| 321 | 312 |
| 322 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 313 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
| 323 }; | 314 }; |
| 324 | 315 |
| 325 } // namespace net | 316 } // namespace net |
| 326 | 317 |
| 327 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 318 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
| OLD | NEW |