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

Side by Side Diff: net/test/base_test_server.cc

Issue 11085039: WebSocket test server migration on browser_tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser_tests done Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
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 #include "net/test/base_test_server.h" 5 #include "net/test/base_test_server.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 "/" + path); 203 "/" + path);
204 } 204 }
205 205
206 GURL BaseTestServer::GetURLWithUserAndPassword(const std::string& path, 206 GURL BaseTestServer::GetURLWithUserAndPassword(const std::string& path,
207 const std::string& user, 207 const std::string& user,
208 const std::string& password) const { 208 const std::string& password) const {
209 return GURL(GetScheme() + "://" + user + ":" + password + "@" + 209 return GURL(GetScheme() + "://" + user + ":" + password + "@" +
210 host_port_pair_.ToString() + "/" + path); 210 host_port_pair_.ToString() + "/" + path);
211 } 211 }
212 212
213 GURL BaseTestServer::GetAlternateURL(const std::string& path) const {
214 std::string scheme;
215 if (type_ == TYPE_WS)
216 scheme = "http";
217 else if (type_ == TYPE_WSS)
218 scheme = "https";
219 else
220 NOTREACHED();
221 return GURL(scheme + "://" + host_port_pair_.ToString() + "/" + path);
222 }
223
213 // static 224 // static
214 bool BaseTestServer::GetFilePathWithReplacements( 225 bool BaseTestServer::GetFilePathWithReplacements(
215 const std::string& original_file_path, 226 const std::string& original_file_path,
216 const std::vector<StringPair>& text_to_replace, 227 const std::vector<StringPair>& text_to_replace,
217 std::string* replacement_path) { 228 std::string* replacement_path) {
218 std::string new_file_path = original_file_path; 229 std::string new_file_path = original_file_path;
219 bool first_query_parameter = true; 230 bool first_query_parameter = true;
220 const std::vector<StringPair>::const_iterator end = text_to_replace.end(); 231 const std::vector<StringPair>::const_iterator end = text_to_replace.end();
221 for (std::vector<StringPair>::const_iterator it = text_to_replace.begin(); 232 for (std::vector<StringPair>::const_iterator it = text_to_replace.begin();
222 it != end; 233 it != end;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { 343 bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const {
333 DCHECK(arguments); 344 DCHECK(arguments);
334 345
335 arguments->SetString("host", host_port_pair_.host()); 346 arguments->SetString("host", host_port_pair_.host());
336 arguments->SetInteger("port", host_port_pair_.port()); 347 arguments->SetInteger("port", host_port_pair_.port());
337 arguments->SetString("data-dir", document_root_.value()); 348 arguments->SetString("data-dir", document_root_.value());
338 349
339 if (VLOG_IS_ON(1) || log_to_console_) 350 if (VLOG_IS_ON(1) || log_to_console_)
340 arguments->Set("log-to-console", base::Value::CreateNullValue()); 351 arguments->Set("log-to-console", base::Value::CreateNullValue());
341 352
342 if (type_ == TYPE_HTTPS) { 353 if (UsingSSL(type_)) {
343 arguments->Set("https", base::Value::CreateNullValue()); 354 if (type_ == TYPE_HTTPS)
355 arguments->Set("https", base::Value::CreateNullValue());
344 356
345 // Check the certificate arguments of the HTTPS server. 357 // Check the certificate arguments of the HTTPS server.
346 FilePath certificate_path(certificates_dir_); 358 FilePath certificate_path(certificates_dir_);
347 FilePath certificate_file(ssl_options_.GetCertificateFile()); 359 FilePath certificate_file(ssl_options_.GetCertificateFile());
348 if (!certificate_file.value().empty()) { 360 if (!certificate_file.value().empty()) {
349 certificate_path = certificate_path.Append(certificate_file); 361 certificate_path = certificate_path.Append(certificate_file);
350 if (certificate_path.IsAbsolute() && 362 if (certificate_path.IsAbsolute() &&
351 !file_util::PathExists(certificate_path)) { 363 !file_util::PathExists(certificate_path)) {
352 LOG(ERROR) << "Certificate path " << certificate_path.value() 364 LOG(ERROR) << "Certificate path " << certificate_path.value()
353 << " doesn't exist. Can't launch https server."; 365 << " doesn't exist. Can't launch https server.";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 arguments->Set("https-record-resume", base::Value::CreateNullValue()); 400 arguments->Set("https-record-resume", base::Value::CreateNullValue());
389 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { 401 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) {
390 arguments->Set("tls-intolerant", 402 arguments->Set("tls-intolerant",
391 base::Value::CreateIntegerValue(ssl_options_.tls_intolerant)); 403 base::Value::CreateIntegerValue(ssl_options_.tls_intolerant));
392 } 404 }
393 } 405 }
394 return true; 406 return true;
395 } 407 }
396 408
397 } // namespace net 409 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698