| 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_CERT_TEST_UTIL_H_ | 5 #ifndef NET_TEST_CERT_TEST_UTIL_H_ |
| 6 #define NET_TEST_CERT_TEST_UTIL_H_ | 6 #define NET_TEST_CERT_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "net/cert/x509_cert_types.h" | 11 #include "net/cert/x509_cert_types.h" |
| 12 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 #if defined(USE_NSS_CERTS) | 15 #if defined(USE_NSS_CERTS) |
| 15 // From <pk11pub.h> | 16 // From <pk11pub.h> |
| 16 typedef struct PK11SlotInfoStr PK11SlotInfo; | 17 typedef struct PK11SlotInfoStr PK11SlotInfo; |
| 17 #endif | 18 #endif |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class FilePath; | 21 class FilePath; |
| 21 } | 22 } |
| 22 | 23 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 const std::string& key_filename, | 42 const std::string& key_filename, |
| 42 PK11SlotInfo* slot); | 43 PK11SlotInfo* slot); |
| 43 #endif | 44 #endif |
| 44 | 45 |
| 45 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, into a | 46 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, into a |
| 46 // CertificateList. | 47 // CertificateList. |
| 47 CertificateList CreateCertificateListFromFile(const base::FilePath& certs_dir, | 48 CertificateList CreateCertificateListFromFile(const base::FilePath& certs_dir, |
| 48 const std::string& cert_file, | 49 const std::string& cert_file, |
| 49 int format); | 50 int format); |
| 50 | 51 |
| 52 // Imports all the certificates given a list of filenames, and assigns the |
| 53 // result to |*certs|. The filenames are relative to the test certificates |
| 54 // directory. |
| 55 ::testing::AssertionResult LoadCertificateFiles( |
| 56 const std::vector<std::string>& cert_filenames, |
| 57 CertificateList* certs); |
| 58 |
| 51 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, into | 59 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, into |
| 52 // a new X509Certificate. The first certificate in the chain will be used for | 60 // a new X509Certificate. The first certificate in the chain will be used for |
| 53 // the returned cert, with any additional certificates configured as | 61 // the returned cert, with any additional certificates configured as |
| 54 // intermediate certificates. | 62 // intermediate certificates. |
| 55 scoped_refptr<X509Certificate> CreateCertificateChainFromFile( | 63 scoped_refptr<X509Certificate> CreateCertificateChainFromFile( |
| 56 const base::FilePath& certs_dir, | 64 const base::FilePath& certs_dir, |
| 57 const std::string& cert_file, | 65 const std::string& cert_file, |
| 58 int format); | 66 int format); |
| 59 | 67 |
| 60 // Imports a single certificate from |cert_file|. | 68 // Imports a single certificate from |cert_file|. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 77 ~ScopedTestEVPolicy(); | 85 ~ScopedTestEVPolicy(); |
| 78 | 86 |
| 79 private: | 87 private: |
| 80 SHA1HashValue fingerprint_; | 88 SHA1HashValue fingerprint_; |
| 81 EVRootCAMetadata* const ev_root_ca_metadata_; | 89 EVRootCAMetadata* const ev_root_ca_metadata_; |
| 82 }; | 90 }; |
| 83 | 91 |
| 84 } // namespace net | 92 } // namespace net |
| 85 | 93 |
| 86 #endif // NET_TEST_CERT_TEST_UTIL_H_ | 94 #endif // NET_TEST_CERT_TEST_UTIL_H_ |
| OLD | NEW |