OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 11 #include <vector> |
11 | 12 |
12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
13 | 14 |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/file_path.h" | 16 #include "base/file_path.h" |
16 #include "base/file_util.h" | 17 #include "base/file_util.h" |
17 #include "base/process_util.h" | 18 #include "base/process_util.h" |
18 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
19 | 20 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 bool Start() WARN_UNUSED_RESULT; | 111 bool Start() WARN_UNUSED_RESULT; |
111 | 112 |
112 // Stop the server started by Start(). | 113 // Stop the server started by Start(). |
113 bool Stop(); | 114 bool Stop(); |
114 | 115 |
115 const FilePath& document_root() const { return document_root_; } | 116 const FilePath& document_root() const { return document_root_; } |
116 const HostPortPair& host_port_pair() const { return host_port_pair_; } | 117 const HostPortPair& host_port_pair() const { return host_port_pair_; } |
117 std::string GetScheme() const; | 118 std::string GetScheme() const; |
118 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; | 119 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; |
119 | 120 |
120 GURL GetURL(const std::string& path); | 121 GURL GetURL(const std::string& path) const; |
121 | 122 |
122 GURL GetURLWithUser(const std::string& path, | 123 GURL GetURLWithUser(const std::string& path, |
123 const std::string& user); | 124 const std::string& user) const; |
124 | 125 |
125 GURL GetURLWithUserAndPassword(const std::string& path, | 126 GURL GetURLWithUserAndPassword(const std::string& path, |
126 const std::string& user, | 127 const std::string& user, |
127 const std::string& password); | 128 const std::string& password) const; |
| 129 |
| 130 typedef std::pair<std::string, std::string> StringPair; |
| 131 static bool GetFilePathWithReplacements( |
| 132 const std::string& original_path, |
| 133 const std::vector<StringPair>& text_to_replace, |
| 134 std::string* replacement_path); |
128 | 135 |
129 private: | 136 private: |
130 void Init(const FilePath& document_root); | 137 void Init(const FilePath& document_root); |
131 | 138 |
132 // Modify PYTHONPATH to contain libraries we need. | 139 // Modify PYTHONPATH to contain libraries we need. |
133 bool SetPythonPath() WARN_UNUSED_RESULT; | 140 bool SetPythonPath() WARN_UNUSED_RESULT; |
134 | 141 |
135 // Launches the Python test server. Returns true on success. | 142 // Launches the Python test server. Returns true on success. |
136 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; | 143 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; |
137 | 144 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 #endif | 195 #endif |
189 | 196 |
190 Type type_; | 197 Type type_; |
191 | 198 |
192 DISALLOW_COPY_AND_ASSIGN(TestServer); | 199 DISALLOW_COPY_AND_ASSIGN(TestServer); |
193 }; | 200 }; |
194 | 201 |
195 } // namespace net | 202 } // namespace net |
196 | 203 |
197 #endif // NET_TEST_TEST_SERVER_H_ | 204 #endif // NET_TEST_TEST_SERVER_H_ |
OLD | NEW |