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

Unified Diff: net/test/test_server.cc

Issue 9663017: net: add OCSP tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/test/test_server.cc
diff --git a/net/test/test_server.cc b/net/test/test_server.cc
index 397b0bc975a0c348647fa3cde430dd2b6d57fc9a..99fe06a8d583c52d1947a6d1f823dd51ecb98ef0 100644
--- a/net/test/test_server.cc
+++ b/net/test/test_server.cc
@@ -69,6 +69,19 @@ FilePath TestServer::HTTPSOptions::GetCertificateFile() const {
return FilePath();
}
+std::string TestServer::HTTPSOptions::GetSpecialCertificateString() const {
+ switch (server_certificate) {
+ case OCSP_OK:
+ return "__ocsp_ok__";
+ case OCSP_REVOKED:
+ return "__ocsp_revoked__";
+ case OCSP_INVALID:
+ return "__ocsp_invalid__";
+ default:
+ return "";
+ }
Ryan Sleevi 2012/03/09 22:07:53 Can you rework this not to require these sorts of
agl 2012/03/13 22:24:29 I had to split the certificate and key filename fr
+}
+
const char TestServer::kLocalhost[] = "127.0.0.1";
const char TestServer::kGDataAuthToken[] = "testtoken";
@@ -383,16 +396,21 @@ bool TestServer::AddCommandLineArguments(CommandLine* command_line) const {
// --auth-token will be used in tests for chrome/browser/chromeos/gdata.
command_line->AppendArg(std::string("--auth-token=") + kGDataAuthToken);
} else if (type_ == TYPE_HTTPS) {
- FilePath certificate_path(certificates_dir_);
- certificate_path = certificate_path.Append(
- https_options_.GetCertificateFile());
- if (!file_util::PathExists(certificate_path)) {
- LOG(ERROR) << "Certificate path " << certificate_path.value()
- << " doesn't exist. Can't launch https server.";
- return false;
+ std::string cert_option = https_options_.GetSpecialCertificateString();
+ if (!cert_option.empty()) {
+ command_line->AppendArg("--https=" + cert_option);
+ } else {
+ FilePath certificate_path(certificates_dir_);
+ certificate_path = certificate_path.Append(
+ https_options_.GetCertificateFile());
+ if (!file_util::PathExists(certificate_path)) {
+ LOG(ERROR) << "Certificate path " << certificate_path.value()
+ << " doesn't exist. Can't launch https server.";
+ return false;
+ }
+ command_line->AppendArgNative(FILE_PATH_LITERAL("--https=") +
+ certificate_path.value());
}
- command_line->AppendArgNative(FILE_PATH_LITERAL("--https=") +
- certificate_path.value());
if (https_options_.request_client_certificate)
command_line->AppendArg("--ssl-client-auth");

Powered by Google App Engine
This is Rietveld 408576698