| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_TEST_SERVER_H_ | 5 #ifndef NET_TEST_BASE_TEST_SERVER_H_ |
| 6 #define NET_TEST_BASE_TEST_SERVER_H_ | 6 #define NET_TEST_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 12 matching lines...) Expand all Loading... |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class AddressList; | 25 class AddressList; |
| 26 class ScopedPortException; | 26 class ScopedPortException; |
| 27 | 27 |
| 28 // The base class of Test server implementation. | 28 // The base class of Test server implementation. |
| 29 class BaseTestServer { | 29 class BaseTestServer { |
| 30 public: | 30 public: |
| 31 typedef std::pair<std::string, std::string> StringPair; | 31 typedef std::pair<std::string, std::string> StringPair; |
| 32 | 32 |
| 33 // Following types represent protocol schemes. See also | |
| 34 // http://www.iana.org/assignments/uri-schemes.html | |
| 35 enum Type { | 33 enum Type { |
| 36 TYPE_BASIC_AUTH_PROXY, | 34 TYPE_BASIC_AUTH_PROXY, |
| 37 TYPE_FTP, | 35 TYPE_FTP, |
| 38 TYPE_GDATA, | 36 TYPE_GDATA, |
| 39 TYPE_HTTP, | 37 TYPE_HTTP, |
| 40 TYPE_HTTPS, | 38 TYPE_HTTPS, |
| 41 TYPE_WS, | 39 TYPE_WS, |
| 42 TYPE_WSS, | 40 TYPE_WSS, |
| 43 TYPE_SYNC, | 41 TYPE_SYNC, |
| 44 TYPE_TCP_ECHO, | 42 TYPE_TCP_ECHO, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 173 |
| 176 GURL GetURLWithUserAndPassword(const std::string& path, | 174 GURL GetURLWithUserAndPassword(const std::string& path, |
| 177 const std::string& user, | 175 const std::string& user, |
| 178 const std::string& password) const; | 176 const std::string& password) const; |
| 179 | 177 |
| 180 static bool GetFilePathWithReplacements( | 178 static bool GetFilePathWithReplacements( |
| 181 const std::string& original_path, | 179 const std::string& original_path, |
| 182 const std::vector<StringPair>& text_to_replace, | 180 const std::vector<StringPair>& text_to_replace, |
| 183 std::string* replacement_path); | 181 std::string* replacement_path); |
| 184 | 182 |
| 185 static bool UsingSSL(Type type) { | |
| 186 return type == BaseTestServer::TYPE_HTTPS || | |
| 187 type == BaseTestServer::TYPE_WSS; | |
| 188 } | |
| 189 | |
| 190 protected: | 183 protected: |
| 191 virtual ~BaseTestServer(); | 184 virtual ~BaseTestServer(); |
| 192 Type type() const { return type_; } | 185 Type type() const { return type_; } |
| 193 | 186 |
| 194 // Gets port currently assigned to host_port_pair_ without checking | 187 // Gets port currently assigned to host_port_pair_ without checking |
| 195 // whether it's available (server started) or not. | 188 // whether it's available (server started) or not. |
| 196 uint16 GetPort(); | 189 uint16 GetPort(); |
| 197 | 190 |
| 198 // Sets |port| as the actual port used by Python based test server. | 191 // Sets |port| as the actual port used by Python based test server. |
| 199 void SetPort(uint16 port); | 192 void SetPort(uint16 port); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 242 |
| 250 scoped_ptr<ScopedPortException> allowed_port_; | 243 scoped_ptr<ScopedPortException> allowed_port_; |
| 251 | 244 |
| 252 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 245 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
| 253 }; | 246 }; |
| 254 | 247 |
| 255 } // namespace net | 248 } // namespace net |
| 256 | 249 |
| 257 #endif // NET_TEST_BASE_TEST_SERVER_H_ | 250 #endif // NET_TEST_BASE_TEST_SERVER_H_ |
| 258 | 251 |
| OLD | NEW |