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