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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 // The auth token to be used for TYPE_GDATA server. | 113 // The auth token to be used for TYPE_GDATA server. |
114 static const char kGDataAuthToken[]; | 114 static const char kGDataAuthToken[]; |
115 | 115 |
116 // Initialize a TestServer listening on a specific host (IP or hostname). | 116 // Initialize a TestServer listening on a specific host (IP or hostname). |
117 BaseTestServer(Type type, const std::string& host); | 117 BaseTestServer(Type type, const std::string& host); |
118 | 118 |
119 // Initialize a HTTPS TestServer with a specific set of HTTPSOptions. | 119 // Initialize a HTTPS TestServer with a specific set of HTTPSOptions. |
120 explicit BaseTestServer(const HTTPSOptions& https_options); | 120 explicit BaseTestServer(const HTTPSOptions& https_options); |
121 | 121 |
122 ~BaseTestServer(); | |
123 | |
124 // Returns the host port pair used by current Python based test server only | 122 // Returns the host port pair used by current Python based test server only |
125 // if the server is started. | 123 // if the server is started. |
126 const HostPortPair& host_port_pair() const; | 124 const HostPortPair& host_port_pair() const; |
127 | 125 |
128 const FilePath& document_root() const { return document_root_; } | 126 const FilePath& document_root() const { return document_root_; } |
129 const base::DictionaryValue& server_data() const; | 127 const base::DictionaryValue& server_data() const; |
130 std::string GetScheme() const; | 128 std::string GetScheme() const; |
131 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; | 129 bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; |
132 | 130 |
133 GURL GetURL(const std::string& path) const; | 131 GURL GetURL(const std::string& path) const; |
134 | 132 |
135 GURL GetURLWithUser(const std::string& path, | 133 GURL GetURLWithUser(const std::string& path, |
136 const std::string& user) const; | 134 const std::string& user) const; |
137 | 135 |
138 GURL GetURLWithUserAndPassword(const std::string& path, | 136 GURL GetURLWithUserAndPassword(const std::string& path, |
139 const std::string& user, | 137 const std::string& user, |
140 const std::string& password) const; | 138 const std::string& password) const; |
141 | 139 |
142 static bool GetFilePathWithReplacements( | 140 static bool GetFilePathWithReplacements( |
143 const std::string& original_path, | 141 const std::string& original_path, |
144 const std::vector<StringPair>& text_to_replace, | 142 const std::vector<StringPair>& text_to_replace, |
145 std::string* replacement_path); | 143 std::string* replacement_path); |
146 | 144 |
147 protected: | 145 protected: |
| 146 virtual ~BaseTestServer(); |
148 Type type() const { return type_; } | 147 Type type() const { return type_; } |
149 | 148 |
150 // Gets port currently assigned to host_port_pair_ without checking | 149 // Gets port currently assigned to host_port_pair_ without checking |
151 // whether it's available (server started) or not. | 150 // whether it's available (server started) or not. |
152 uint16 GetPort(); | 151 uint16 GetPort(); |
153 | 152 |
154 // Sets |port| as the actual port used by Python based test server. | 153 // Sets |port| as the actual port used by Python based test server. |
155 void SetPort(uint16 port); | 154 void SetPort(uint16 port); |
156 | 155 |
157 // Set up internal status when the server is started. | 156 // Set up internal status when the server is started. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 203 |
205 scoped_ptr<ScopedPortException> allowed_port_; | 204 scoped_ptr<ScopedPortException> allowed_port_; |
206 | 205 |
207 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); | 206 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); |
208 }; | 207 }; |
209 | 208 |
210 } // namespace net | 209 } // namespace net |
211 | 210 |
212 #endif // NET_TEST_BASE_TEST_SERVER_H_ | 211 #endif // NET_TEST_BASE_TEST_SERVER_H_ |
213 | 212 |
OLD | NEW |