Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: net/test/test_server.h

Issue 9369029: Add '--host' option to testserver.py and expose it via a new TestServer constructor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Integrate the definition of kLocalhost to facilitate follow-up CLs. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/test/test_server.cc » ('j') | net/tools/testserver/testserver.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // HTTPS server, or BULK_CIPHER_ANY to indicate that all implemented 103 // HTTPS server, or BULK_CIPHER_ANY to indicate that all implemented
104 // ciphers are acceptable. 104 // ciphers are acceptable.
105 int bulk_ciphers; 105 int bulk_ciphers;
106 106
107 // If true, pass the --https-record-resume argument to testserver.py which 107 // If true, pass the --https-record-resume argument to testserver.py which
108 // causes it to log session cache actions and echo the log on 108 // causes it to log session cache actions and echo the log on
109 // /ssl-session-cache. 109 // /ssl-session-cache.
110 bool record_resume; 110 bool record_resume;
111 }; 111 };
112 112
113 // Pass as the 'host' parameter during construction to server on 127.0.0.1
114 static const char* kLocalhost;
eroman 2012/02/23 20:55:07 Technically this is ambiguous, since "localhost" m
115
116 // Initialize a TestServer listening on 127.0.0.1.
113 TestServer(Type type, const FilePath& document_root); 117 TestServer(Type type, const FilePath& document_root);
114 118
119 // Initialize a TestServer listening on a specific host (IP or hostname).
120 TestServer(Type type,
121 const std::string& host,
122 const FilePath& document_root);
123
115 // Initialize a HTTPS TestServer with a specific set of HTTPSOptions. 124 // Initialize a HTTPS TestServer with a specific set of HTTPSOptions.
116 TestServer(const HTTPSOptions& https_options, 125 TestServer(const HTTPSOptions& https_options,
117 const FilePath& document_root); 126 const FilePath& document_root);
118 127
119 ~TestServer(); 128 ~TestServer();
120 129
121 bool Start() WARN_UNUSED_RESULT; 130 bool Start() WARN_UNUSED_RESULT;
122 131
123 // Stop the server started by Start(). 132 // Stop the server started by Start().
124 bool Stop(); 133 bool Stop();
(...skipping 12 matching lines...) Expand all
137 GURL GetURLWithUserAndPassword(const std::string& path, 146 GURL GetURLWithUserAndPassword(const std::string& path,
138 const std::string& user, 147 const std::string& user,
139 const std::string& password) const; 148 const std::string& password) const;
140 149
141 static bool GetFilePathWithReplacements( 150 static bool GetFilePathWithReplacements(
142 const std::string& original_path, 151 const std::string& original_path,
143 const std::vector<StringPair>& text_to_replace, 152 const std::vector<StringPair>& text_to_replace,
144 std::string* replacement_path); 153 std::string* replacement_path);
145 154
146 private: 155 private:
147 void Init(const FilePath& document_root); 156 void Init(const std::string& host, const FilePath& document_root);
148 157
149 // Modify PYTHONPATH to contain libraries we need. 158 // Modify PYTHONPATH to contain libraries we need.
150 bool SetPythonPath() WARN_UNUSED_RESULT; 159 bool SetPythonPath() WARN_UNUSED_RESULT;
151 160
152 // Launches the Python test server. Returns true on success. 161 // Launches the Python test server. Returns true on success.
153 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; 162 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT;
154 163
155 // Waits for the server to start. Returns true on success. 164 // Waits for the server to start. Returns true on success.
156 bool WaitToStart() WARN_UNUSED_RESULT; 165 bool WaitToStart() WARN_UNUSED_RESULT;
157 166
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 222
214 // Enables logging of the server to the console. 223 // Enables logging of the server to the console.
215 bool log_to_console_; 224 bool log_to_console_;
216 225
217 DISALLOW_COPY_AND_ASSIGN(TestServer); 226 DISALLOW_COPY_AND_ASSIGN(TestServer);
218 }; 227 };
219 228
220 } // namespace net 229 } // namespace net
221 230
222 #endif // NET_TEST_TEST_SERVER_H_ 231 #endif // NET_TEST_TEST_SERVER_H_
OLDNEW
« no previous file with comments | « no previous file | net/test/test_server.cc » ('j') | net/tools/testserver/testserver.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698