OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TEST_SERVER_H_ | 5 #ifndef NET_TEST_TEST_SERVER_H_ |
6 #define NET_TEST_TEST_SERVER_H_ | 6 #define NET_TEST_TEST_SERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 17 matching lines...) Expand all Loading... |
28 class GURL; | 28 class GURL; |
29 | 29 |
30 namespace net { | 30 namespace net { |
31 | 31 |
32 class AddressList; | 32 class AddressList; |
33 | 33 |
34 // This object bounds the lifetime of an external python-based HTTP/FTP server | 34 // This object bounds the lifetime of an external python-based HTTP/FTP server |
35 // that can provide various responses useful for testing. | 35 // that can provide various responses useful for testing. |
36 class TestServer { | 36 class TestServer { |
37 public: | 37 public: |
| 38 typedef std::pair<std::string, std::string> StringPair; |
| 39 |
38 enum Type { | 40 enum Type { |
39 TYPE_FTP, | 41 TYPE_FTP, |
40 TYPE_HTTP, | 42 TYPE_HTTP, |
41 TYPE_HTTPS, | 43 TYPE_HTTPS, |
42 TYPE_SYNC, | 44 TYPE_SYNC, |
43 }; | 45 }; |
44 | 46 |
45 // Container for various options to control how the HTTPS server is | 47 // Container for various options to control how the HTTPS server is |
46 // initialized. | 48 // initialized. |
47 struct HTTPSOptions { | 49 struct HTTPSOptions { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 121 |
120 GURL GetURL(const std::string& path) const; | 122 GURL GetURL(const std::string& path) const; |
121 | 123 |
122 GURL GetURLWithUser(const std::string& path, | 124 GURL GetURLWithUser(const std::string& path, |
123 const std::string& user) const; | 125 const std::string& user) const; |
124 | 126 |
125 GURL GetURLWithUserAndPassword(const std::string& path, | 127 GURL GetURLWithUserAndPassword(const std::string& path, |
126 const std::string& user, | 128 const std::string& user, |
127 const std::string& password) const; | 129 const std::string& password) const; |
128 | 130 |
129 typedef std::pair<std::string, std::string> StringPair; | |
130 static bool GetFilePathWithReplacements( | 131 static bool GetFilePathWithReplacements( |
131 const std::string& original_path, | 132 const std::string& original_path, |
132 const std::vector<StringPair>& text_to_replace, | 133 const std::vector<StringPair>& text_to_replace, |
133 std::string* replacement_path); | 134 std::string* replacement_path); |
134 | 135 |
135 private: | 136 private: |
136 void Init(const FilePath& document_root); | 137 void Init(const FilePath& document_root); |
137 | 138 |
138 // Modify PYTHONPATH to contain libraries we need. | 139 // Modify PYTHONPATH to contain libraries we need. |
139 bool SetPythonPath() WARN_UNUSED_RESULT; | 140 bool SetPythonPath() WARN_UNUSED_RESULT; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 200 |
200 // Has the server been started? | 201 // Has the server been started? |
201 bool started_; | 202 bool started_; |
202 | 203 |
203 DISALLOW_COPY_AND_ASSIGN(TestServer); | 204 DISALLOW_COPY_AND_ASSIGN(TestServer); |
204 }; | 205 }; |
205 | 206 |
206 } // namespace net | 207 } // namespace net |
207 | 208 |
208 #endif // NET_TEST_TEST_SERVER_H_ | 209 #endif // NET_TEST_TEST_SERVER_H_ |
OLD | NEW |