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

Unified Diff: net/base/x509_certificate_unittest.cc

Issue 3148034: Fix PEM parsing on Linux when using X509Certificate::FORMAT_AUTO (Closed)
Patch Set: Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/x509_certificate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_certificate_unittest.cc
diff --git a/net/base/x509_certificate_unittest.cc b/net/base/x509_certificate_unittest.cc
index ad0b5c6004f76192635720ddaf1633a0dcd20f08..e1319d731ba7091758c1dad66df1dc91fa60ae7d 100644
--- a/net/base/x509_certificate_unittest.cc
+++ b/net/base/x509_certificate_unittest.cc
@@ -703,8 +703,19 @@ TEST_P(X509CertificateParseTest, CanParseFormat) {
kGoogleParseValidFrom, kGoogleParseValidTo);
size_t i;
- for (i = 0; i < arraysize(test_data_.chain_fingerprints) &&
- i < certs.size() && test_data_.chain_fingerprints[i] != NULL; ++i) {
+ for (i = 0; i < arraysize(test_data_.chain_fingerprints); ++i) {
+ if (test_data_.chain_fingerprints[i] == NULL) {
+ // No more test certificates expected - make sure no more were
+ // returned before marking this test a success.
+ EXPECT_EQ(i, certs.size());
+ break;
+ }
+
+ // A cert is expected - make sure that one was parsed.
+ ASSERT_LT(i, certs.size());
+
+ // Compare the parsed certificate with the expected certificate, by
+ // comparing fingerprints.
const X509Certificate* cert = certs[i];
const SHA1Fingerprint& actual_fingerprint = cert->fingerprint();
unsigned char* expected_fingerprint = test_data_.chain_fingerprints[i];
« no previous file with comments | « net/base/x509_certificate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698