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

Unified Diff: net/cert/internal/test_helpers.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_unittest.cc ('k') | net/cert/internal/trust_store_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/test_helpers.cc
diff --git a/net/cert/internal/test_helpers.cc b/net/cert/internal/test_helpers.cc
index 28534bd822a3f05f3b09bf5038d319849a733e60..8413772d698c7437e47967436927dda07447c6ec 100644
--- a/net/cert/internal/test_helpers.cc
+++ b/net/cert/internal/test_helpers.cc
@@ -8,6 +8,7 @@
#include "base/base_paths.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
+#include "net/cert/internal/cert_errors.h"
#include "net/cert/pem_tokenizer.h"
#include "net/der/parser.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -141,19 +142,17 @@ void ReadVerifyCertChainTestFromFile(const std::string& file_name,
const std::string& block_data = pem_tokenizer.data();
if (block_type == kCertificateHeader) {
- ASSERT_TRUE(net::ParsedCertificate::CreateAndAddToVector(
- reinterpret_cast<const uint8_t*>(block_data.data()),
- block_data.size(), net::ParsedCertificate::DataSource::INTERNAL_COPY,
- {}, chain));
+ CertErrors errors;
+ ASSERT_TRUE(net::ParsedCertificate::CreateAndAddToVector(block_data, {},
+ chain, &errors))
+ << errors.ToDebugString();
} else if (block_type == kTrustAnchorUnconstrained ||
block_type == kTrustAnchorConstrained) {
ASSERT_FALSE(*trust_anchor) << "Duplicate trust anchor";
+ CertErrors errors;
scoped_refptr<ParsedCertificate> root =
- net::ParsedCertificate::CreateFromCertificateData(
- reinterpret_cast<const uint8_t*>(block_data.data()),
- block_data.size(),
- net::ParsedCertificate::DataSource::INTERNAL_COPY, {});
- ASSERT_TRUE(root);
+ net::ParsedCertificate::Create(block_data, {}, &errors);
+ ASSERT_TRUE(root) << errors.ToDebugString();
*trust_anchor =
block_type == kTrustAnchorUnconstrained
? TrustAnchor::CreateFromCertificateNoConstraints(std::move(root))
« no previous file with comments | « net/cert/internal/path_builder_unittest.cc ('k') | net/cert/internal/trust_store_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698