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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 static bool GetFilePathWithReplacements( | 223 static bool GetFilePathWithReplacements( |
224 const std::string& original_path, | 224 const std::string& original_path, |
225 const std::vector<StringPair>& text_to_replace, | 225 const std::vector<StringPair>& text_to_replace, |
226 std::string* replacement_path); | 226 std::string* replacement_path); |
227 | 227 |
228 static bool UsingSSL(Type type) { | 228 static bool UsingSSL(Type type) { |
229 return type == BaseTestServer::TYPE_HTTPS || | 229 return type == BaseTestServer::TYPE_HTTPS || |
230 type == BaseTestServer::TYPE_WSS; | 230 type == BaseTestServer::TYPE_WSS; |
231 } | 231 } |
232 | 232 |
| 233 // Enable HTTP basic authentication. Currently this only works for TYPE_WS and |
| 234 // TYPE_WSS. |
| 235 void set_websocket_basic_auth(bool ws_basic_auth) { |
| 236 ws_basic_auth_ = ws_basic_auth; |
| 237 } |
| 238 |
233 protected: | 239 protected: |
234 virtual ~BaseTestServer(); | 240 virtual ~BaseTestServer(); |
235 Type type() const { return type_; } | 241 Type type() const { return type_; } |
236 | 242 |
237 // Gets port currently assigned to host_port_pair_ without checking | 243 // Gets port currently assigned to host_port_pair_ without checking |
238 // whether it's available (server started) or not. | 244 // whether it's available (server started) or not. |
239 uint16 GetPort(); | 245 uint16 GetPort(); |
240 | 246 |
241 // Sets |port| as the actual port used by Python based test server. | 247 // Sets |port| as the actual port used by Python based test server. |
242 void SetPort(uint16 port); | 248 void SetPort(uint16 port); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 SSLOptions ssl_options_; | 295 SSLOptions ssl_options_; |
290 | 296 |
291 Type type_; | 297 Type type_; |
292 | 298 |
293 // Has the server been started? | 299 // Has the server been started? |
294 bool started_; | 300 bool started_; |
295 | 301 |
296 // Enables logging of the server to the console. | 302 // Enables logging of the server to the console. |
297 bool log_to_console_; | 303 bool log_to_console_; |
298 | 304 |
| 305 // Is WebSocket basic HTTP authentication enabled? |
| 306 bool ws_basic_auth_; |
| 307 |
299 scoped_ptr<ScopedPortException> allowed_port_; | 308 scoped_ptr<ScopedPortException> allowed_port_; |
300 | 309 |
301 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 310 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
302 }; | 311 }; |
303 | 312 |
304 } // namespace net | 313 } // namespace net |
305 | 314 |
306 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ | 315 #endif // NET_TEST_SPAWNED_TEST_SERVER_BASE_TEST_SERVER_H_ |
OLD | NEW |