| 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 #include "chrome/common/net/x509_certificate_model.h" | 5 #include "chrome/common/net/x509_certificate_model.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "net/base/test_data_directory.h" | 9 #include "net/base/test_data_directory.h" |
| 10 #include "net/cert/nss_cert_database.h" | 10 #include "net/cert/nss_cert_database.h" |
| 11 #include "net/test/cert_test_util.h" | 11 #include "net/test/cert_test_util.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 TEST(X509CertificateModelTest, GetTypeCA) { | 14 TEST(X509CertificateModelTest, GetTypeCA) { |
| 15 scoped_refptr<net::X509Certificate> cert( | 15 scoped_refptr<net::X509Certificate> cert( |
| 16 net::ImportCertFromFile(net::GetTestCertsDirectory(), | 16 net::ImportCertFromFile(net::GetTestCertsDirectory(), |
| 17 "root_ca_cert.crt")); | 17 "root_ca_cert.pem")); |
| 18 ASSERT_TRUE(cert.get()); | 18 ASSERT_TRUE(cert.get()); |
| 19 | 19 |
| 20 #if defined(USE_OPENSSL) | 20 #if defined(USE_OPENSSL) |
| 21 // Remove this when OpenSSL build implements the necessary functions. | 21 // Remove this when OpenSSL build implements the necessary functions. |
| 22 EXPECT_EQ(net::UNKNOWN_CERT, | 22 EXPECT_EQ(net::UNKNOWN_CERT, |
| 23 x509_certificate_model::GetType(cert->os_cert_handle())); | 23 x509_certificate_model::GetType(cert->os_cert_handle())); |
| 24 #else | 24 #else |
| 25 EXPECT_EQ(net::CA_CERT, | 25 EXPECT_EQ(net::CA_CERT, |
| 26 x509_certificate_model::GetType(cert->os_cert_handle())); | 26 x509_certificate_model::GetType(cert->os_cert_handle())); |
| 27 | 27 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // An X.509 v1 certificate with the version field omitted should get | 73 // An X.509 v1 certificate with the version field omitted should get |
| 74 // the default value v1. | 74 // the default value v1. |
| 75 TEST(X509CertificateModelTest, GetVersionOmitted) { | 75 TEST(X509CertificateModelTest, GetVersionOmitted) { |
| 76 scoped_refptr<net::X509Certificate> cert( | 76 scoped_refptr<net::X509Certificate> cert( |
| 77 net::ImportCertFromFile(net::GetTestCertsDirectory(), | 77 net::ImportCertFromFile(net::GetTestCertsDirectory(), |
| 78 "ndn.ca.crt")); | 78 "ndn.ca.crt")); |
| 79 ASSERT_TRUE(cert.get()); | 79 ASSERT_TRUE(cert.get()); |
| 80 | 80 |
| 81 EXPECT_EQ("1", x509_certificate_model::GetVersion(cert->os_cert_handle())); | 81 EXPECT_EQ("1", x509_certificate_model::GetVersion(cert->os_cert_handle())); |
| 82 } | 82 } |
| OLD | NEW |