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 |
245 protected: | 251 protected: |
246 virtual ~BaseTestServer(); | 252 virtual ~BaseTestServer(); |
247 Type type() const { return type_; } | 253 Type type() const { return type_; } |
248 | 254 |
249 // Gets port currently assigned to host_port_pair_ without checking | 255 // Gets port currently assigned to host_port_pair_ without checking |
250 // whether it's available (server started) or not. | 256 // whether it's available (server started) or not. |
251 uint16 GetPort(); | 257 uint16 GetPort(); |
252 | 258 |
253 // Sets |port| as the actual port used by Python based test server. | 259 // Sets |port| as the actual port used by Python based test server. |
254 void SetPort(uint16 port); | 260 void SetPort(uint16 port); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 SSLOptions ssl_options_; | 307 SSLOptions ssl_options_; |
302 | 308 |
303 Type type_; | 309 Type type_; |
304 | 310 |
305 // Has the server been started? | 311 // Has the server been started? |
306 bool started_; | 312 bool started_; |
307 | 313 |
308 // Enables logging of the server to the console. | 314 // Enables logging of the server to the console. |
309 bool log_to_console_; | 315 bool log_to_console_; |
310 | 316 |
| 317 // Is WebSocket basic HTTP authentication enabled? |
| 318 bool ws_basic_auth_; |
| 319 |
311 scoped_ptr<ScopedPortException> allowed_port_; | 320 scoped_ptr<ScopedPortException> allowed_port_; |
312 | 321 |
313 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 322 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
314 }; | 323 }; |
315 | 324 |
316 } // namespace net | 325 } // namespace net |
317 | 326 |
318 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 327 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
OLD | NEW |