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

Unified Diff: net/cert/internal/path_builder_unittest.cc

Issue 2327973002: Add CertErrors* parameter to the main Certificate parsing functions. (Closed)
Patch Set: StringPiece is kind of dangerous... Created 4 years, 3 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/cert/internal/path_builder_pkits_unittest.cc ('k') | net/cert/internal/test_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/path_builder_unittest.cc
diff --git a/net/cert/internal/path_builder_unittest.cc b/net/cert/internal/path_builder_unittest.cc
index 338178a9121d3490cdce411c1e9be7a2aebee0d6..3e6391706a015e1e4184b4a65e316576c7986b27 100644
--- a/net/cert/internal/path_builder_unittest.cc
+++ b/net/cert/internal/path_builder_unittest.cc
@@ -121,9 +121,13 @@ class AsyncCertIssuerSourceStatic : public CertIssuerSource {
"net/data/ssl/certificates/" + file_name, "CERTIFICATE", &der);
if (!r)
return r;
- *result = ParsedCertificate::CreateFromCertificateCopy(der, {});
- if (!*result)
- return ::testing::AssertionFailure() << "CreateFromCertificateCopy failed";
+ CertErrors errors;
+ *result = ParsedCertificate::Create(der, {}, &errors);
+ if (!*result) {
+ return ::testing::AssertionFailure()
+ << "ParseCertificate::Create() failed:\n"
+ << errors.ToDebugString();
+ }
return ::testing::AssertionSuccess();
}
@@ -941,8 +945,8 @@ TEST_F(PathBuilderKeyRolloverTest,
TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediates) {
// Create a separate copy of oldintermediate.
scoped_refptr<ParsedCertificate> oldintermediate_dupe(
- ParsedCertificate::CreateFromCertificateCopy(
- oldintermediate_->der_cert().AsStringPiece(), {}));
+ ParsedCertificate::Create(oldintermediate_->der_cert().AsStringPiece(),
+ {}, nullptr));
// Only newroot is a trusted root.
TrustStoreInMemory trust_store;
@@ -1002,9 +1006,8 @@ TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediates) {
// SPKI as a TrustAnchor.
TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediateAndRoot) {
// Create a separate copy of newroot.
- scoped_refptr<ParsedCertificate> newroot_dupe(
- ParsedCertificate::CreateFromCertificateCopy(
- newroot_->der_cert().AsStringPiece(), {}));
+ scoped_refptr<ParsedCertificate> newroot_dupe(ParsedCertificate::Create(
+ newroot_->der_cert().AsStringPiece(), {}, nullptr));
// Only newroot is a trusted root.
TrustStoreInMemory trust_store;
@@ -1233,8 +1236,8 @@ TEST_F(PathBuilderKeyRolloverTest, TestDuplicateAsyncIntermediates) {
// Second async batch: return a different copy of oldintermediate_ again.
scoped_refptr<ParsedCertificate> oldintermediate_dupe(
- ParsedCertificate::CreateFromCertificateCopy(
- oldintermediate_->der_cert().AsStringPiece(), {}));
+ ParsedCertificate::Create(oldintermediate_->der_cert().AsStringPiece(),
+ {}, nullptr));
EXPECT_CALL(*target_issuers_req, GetNext(_))
.WillOnce(DoAll(SetArgPointee<0>(oldintermediate_dupe),
Return(CompletionStatus::SYNC)))
« no previous file with comments | « net/cert/internal/path_builder_pkits_unittest.cc ('k') | net/cert/internal/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698