Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: chrome/common/net/x509_certificate_model_unittest.cc

Issue 10391197: If the version field is omitted from the certificate, the default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add unit test Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/net/x509_certificate_model_nss.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « chrome/common/net/x509_certificate_model_nss.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698