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_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "net/base/cert_database.h" | 10 #include "net/base/cert_database.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 EXPECT_EQ(net::SERVER_CERT, | 64 EXPECT_EQ(net::SERVER_CERT, |
65 x509_certificate_model::GetType(cert->os_cert_handle())); | 65 x509_certificate_model::GetType(cert->os_cert_handle())); |
66 | 66 |
67 EXPECT_TRUE(cert_db.SetCertTrust(cert, net::SERVER_CERT, | 67 EXPECT_TRUE(cert_db.SetCertTrust(cert, net::SERVER_CERT, |
68 net::CertDatabase::UNTRUSTED)); | 68 net::CertDatabase::UNTRUSTED)); |
69 | 69 |
70 EXPECT_EQ(net::SERVER_CERT, | 70 EXPECT_EQ(net::SERVER_CERT, |
71 x509_certificate_model::GetType(cert->os_cert_handle())); | 71 x509_certificate_model::GetType(cert->os_cert_handle())); |
72 #endif | 72 #endif |
73 } | 73 } |
| 74 |
| 75 // An X.509 v1 certificate with the version field omitted should get |
| 76 // the default value v1. |
| 77 TEST(X509CertificateModelTest, GetVersionOmitted) { |
| 78 scoped_refptr<net::X509Certificate> cert( |
| 79 net::ImportCertFromFile(net::GetTestCertsDirectory(), |
| 80 "ndn.ca.crt")); |
| 81 ASSERT_TRUE(cert.get()); |
| 82 |
| 83 EXPECT_EQ("1", x509_certificate_model::GetVersion(cert->os_cert_handle())); |
| 84 } |
OLD | NEW |