| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/spawned_test_server/base_test_server.h" | 5 #include "net/test/spawned_test_server/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 23 matching lines...) Expand all Loading... |
| 34 BaseTestServer::SSLOptions::CERT_MISMATCHED_NAME || | 34 BaseTestServer::SSLOptions::CERT_MISMATCHED_NAME || |
| 35 options.server_certificate == | 35 options.server_certificate == |
| 36 BaseTestServer::SSLOptions::CERT_COMMON_NAME_IS_DOMAIN) { | 36 BaseTestServer::SSLOptions::CERT_COMMON_NAME_IS_DOMAIN) { |
| 37 // For |CERT_MISMATCHED_NAME|, return a different hostname string | 37 // For |CERT_MISMATCHED_NAME|, return a different hostname string |
| 38 // that resolves to the same hostname. For | 38 // that resolves to the same hostname. For |
| 39 // |CERT_COMMON_NAME_IS_DOMAIN|, the certificate is issued for | 39 // |CERT_COMMON_NAME_IS_DOMAIN|, the certificate is issued for |
| 40 // "localhost" instead of "127.0.0.1". | 40 // "localhost" instead of "127.0.0.1". |
| 41 return "localhost"; | 41 return "localhost"; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | |
| 45 // Use the 127.0.0.1 as default. | 44 // Use the 127.0.0.1 as default. |
| 46 return BaseTestServer::kLocalhost; | 45 return BaseTestServer::kLocalhost; |
| 47 } | 46 } |
| 48 | 47 |
| 49 std::string GetClientCertType(SSLClientCertType type) { | 48 std::string GetClientCertType(SSLClientCertType type) { |
| 50 switch (type) { | 49 switch (type) { |
| 51 case CLIENT_CERT_RSA_SIGN: | 50 case CLIENT_CERT_RSA_SIGN: |
| 52 return "rsa_sign"; | 51 return "rsa_sign"; |
| 53 case CLIENT_CERT_ECDSA_SIGN: | 52 case CLIENT_CERT_ECDSA_SIGN: |
| 54 return "ecdsa_sign"; | 53 return "ecdsa_sign"; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 case CERT_COMMON_NAME_IS_DOMAIN: | 141 case CERT_COMMON_NAME_IS_DOMAIN: |
| 143 return base::FilePath(FILE_PATH_LITERAL("localhost_cert.pem")); | 142 return base::FilePath(FILE_PATH_LITERAL("localhost_cert.pem")); |
| 144 case CERT_EXPIRED: | 143 case CERT_EXPIRED: |
| 145 return base::FilePath(FILE_PATH_LITERAL("expired_cert.pem")); | 144 return base::FilePath(FILE_PATH_LITERAL("expired_cert.pem")); |
| 146 case CERT_CHAIN_WRONG_ROOT: | 145 case CERT_CHAIN_WRONG_ROOT: |
| 147 // This chain uses its own dedicated test root certificate to avoid | 146 // This chain uses its own dedicated test root certificate to avoid |
| 148 // side-effects that may affect testing. | 147 // side-effects that may affect testing. |
| 149 return base::FilePath(FILE_PATH_LITERAL("redundant-server-chain.pem")); | 148 return base::FilePath(FILE_PATH_LITERAL("redundant-server-chain.pem")); |
| 150 case CERT_AUTO: | 149 case CERT_AUTO: |
| 151 return base::FilePath(); | 150 return base::FilePath(); |
| 151 case CERT_EXAMPLE_DOMAIN: |
| 152 return base::FilePath(FILE_PATH_LITERAL("example_cert.pem")); |
| 153 case CERT_WWW_EXAMPLE_DOMAIN: |
| 154 return base::FilePath(FILE_PATH_LITERAL("www_example_cert.pem")); |
| 152 default: | 155 default: |
| 153 NOTREACHED(); | 156 NOTREACHED(); |
| 154 } | 157 } |
| 155 return base::FilePath(); | 158 return base::FilePath(); |
| 156 } | 159 } |
| 157 | 160 |
| 158 std::string BaseTestServer::SSLOptions::GetOCSPArgument() const { | 161 std::string BaseTestServer::SSLOptions::GetOCSPArgument() const { |
| 159 if (server_certificate != CERT_AUTO) | 162 if (server_certificate != CERT_AUTO) |
| 160 return std::string(); | 163 return std::string(); |
| 161 | 164 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 | 517 |
| 515 return GenerateAdditionalArguments(arguments); | 518 return GenerateAdditionalArguments(arguments); |
| 516 } | 519 } |
| 517 | 520 |
| 518 bool BaseTestServer::GenerateAdditionalArguments( | 521 bool BaseTestServer::GenerateAdditionalArguments( |
| 519 base::DictionaryValue* arguments) const { | 522 base::DictionaryValue* arguments) const { |
| 520 return true; | 523 return true; |
| 521 } | 524 } |
| 522 | 525 |
| 523 } // namespace net | 526 } // namespace net |
| OLD | NEW |