Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 | 160 |
| 161 GURL GetURLWithUserAndPassword(const std::string& path, | 161 GURL GetURLWithUserAndPassword(const std::string& path, |
| 162 const std::string& user, | 162 const std::string& user, |
| 163 const std::string& password) const; | 163 const std::string& password) const; |
| 164 | 164 |
| 165 static bool GetFilePathWithReplacements( | 165 static bool GetFilePathWithReplacements( |
| 166 const std::string& original_path, | 166 const std::string& original_path, |
| 167 const std::vector<StringPair>& text_to_replace, | 167 const std::vector<StringPair>& text_to_replace, |
| 168 std::string* replacement_path); | 168 std::string* replacement_path); |
| 169 | 169 |
| 170 // Sets |port| as the actual port used by Python based test server. | |
| 171 void SetPort(uint16 port); | |
| 172 | |
| 173 // Sets |xmpp_port| as the actual xmpp_port used by Python based test server. | |
| 174 void SetXmppPort(uint16 xmpp_port); | |
|
Paweł Hajdan Jr.
2012/05/21 08:36:46
Please stop this. I asked you people to extract th
Raghu Simha
2012/05/23 02:25:11
Your language here puzzles me. Whom do you mean by
| |
| 175 | |
| 170 protected: | 176 protected: |
| 171 virtual ~BaseTestServer(); | 177 virtual ~BaseTestServer(); |
| 172 Type type() const { return type_; } | 178 Type type() const { return type_; } |
| 173 | 179 |
| 174 // Gets port currently assigned to host_port_pair_ without checking | 180 // Gets port currently assigned to host_port_pair_ without checking |
| 175 // whether it's available (server started) or not. | 181 // whether it's available (server started) or not. |
| 176 uint16 GetPort(); | 182 uint16 GetPort() const; |
| 177 | 183 |
| 178 // Sets |port| as the actual port used by Python based test server. | 184 // Gets port currently assigned to xmpp_port_ without checking |
| 179 void SetPort(uint16 port); | 185 // whether it's available (server started) or not. |
| 186 uint16 GetXmppPort() const; | |
| 180 | 187 |
| 181 // Set up internal status when the server is started. | 188 // Set up internal status when the server is started. |
| 182 bool SetupWhenServerStarted() WARN_UNUSED_RESULT; | 189 bool SetupWhenServerStarted() WARN_UNUSED_RESULT; |
| 183 | 190 |
| 184 // Clean up internal status when starting to stop server. | 191 // Clean up internal status when starting to stop server. |
| 185 void CleanUpWhenStoppingServer(); | 192 void CleanUpWhenStoppingServer(); |
| 186 | 193 |
| 187 // Set path of test resources. | 194 // Set path of test resources. |
| 188 void SetResourcePath(const FilePath& document_root, | 195 void SetResourcePath(const FilePath& document_root, |
| 189 const FilePath& certificates_dir); | 196 const FilePath& certificates_dir); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 205 | 212 |
| 206 // Document root of the test server. | 213 // Document root of the test server. |
| 207 FilePath document_root_; | 214 FilePath document_root_; |
| 208 | 215 |
| 209 // Directory that contains the SSL certificates. | 216 // Directory that contains the SSL certificates. |
| 210 FilePath certificates_dir_; | 217 FilePath certificates_dir_; |
| 211 | 218 |
| 212 // Address the test server listens on. | 219 // Address the test server listens on. |
| 213 HostPortPair host_port_pair_; | 220 HostPortPair host_port_pair_; |
| 214 | 221 |
| 222 // Port on which the Sync XMPP server listens. | |
| 223 uint16 xmpp_port_; | |
| 224 | |
| 215 // Holds the data sent from the server (e.g., port number). | 225 // Holds the data sent from the server (e.g., port number). |
| 216 scoped_ptr<base::DictionaryValue> server_data_; | 226 scoped_ptr<base::DictionaryValue> server_data_; |
| 217 | 227 |
| 218 // If |type_| is TYPE_HTTPS, the TLS settings to use for the test server. | 228 // If |type_| is TYPE_HTTPS, the TLS settings to use for the test server. |
| 219 HTTPSOptions https_options_; | 229 HTTPSOptions https_options_; |
| 220 | 230 |
| 221 Type type_; | 231 Type type_; |
| 222 | 232 |
| 223 // Has the server been started? | 233 // Has the server been started? |
| 224 bool started_; | 234 bool started_; |
| 225 | 235 |
| 226 // Enables logging of the server to the console. | 236 // Enables logging of the server to the console. |
| 227 bool log_to_console_; | 237 bool log_to_console_; |
| 228 | 238 |
| 229 scoped_ptr<ScopedPortException> allowed_port_; | 239 scoped_ptr<ScopedPortException> allowed_port_; |
| 230 | 240 |
| 231 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 241 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
| 232 }; | 242 }; |
| 233 | 243 |
| 234 } // namespace net | 244 } // namespace net |
| 235 | 245 |
| 236 #endif // NET_TEST_BASE_TEST_SERVER_H_ | 246 #endif // NET_TEST_BASE_TEST_SERVER_H_ |
| 237 | 247 |
| OLD | NEW |