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

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

Issue 1923433002: Certificate path builder for new certificate verification library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes for review comment #20 Created 4 years, 6 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.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/path_builder_verify_certificate_chain_unittest.cc
diff --git a/net/cert/internal/path_builder_verify_certificate_chain_unittest.cc b/net/cert/internal/path_builder_verify_certificate_chain_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e08ea30895beff8e049380a3b49727176ff180d5
--- /dev/null
+++ b/net/cert/internal/path_builder_verify_certificate_chain_unittest.cc
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/cert/internal/path_builder.h"
+
+#include "net/cert/internal/cert_issuer_source_static.h"
+#include "net/cert/internal/signature_policy.h"
+#include "net/cert/internal/trust_store.h"
+#include "net/cert/internal/verify_certificate_chain_typed_unittest.h"
+
+namespace net {
+
+namespace {
+
+class PathBuilderDelegate {
+ public:
+ static void Verify(const ParsedCertificateList& chain,
+ const ParsedCertificateList& roots,
+ const der::GeneralizedTime& time,
+ bool expected_result) {
+ SimpleSignaturePolicy signature_policy(1024);
+ ASSERT_FALSE(chain.empty());
+
+ TrustStore trust_store;
+ for (const auto& root : roots)
+ trust_store.AddTrustedCertificate(root);
+
+ CertIssuerSourceStatic intermediate_cert_issuer_source;
+ for (size_t i = 1; i < chain.size(); ++i)
+ intermediate_cert_issuer_source.AddCert(chain[i]);
+
+ CertPathBuilder::Result result;
+ // First cert in the |chain| is the target.
+ CertPathBuilder path_builder(chain.front(), &trust_store, &signature_policy,
+ time, &result);
+ path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source);
+
+ CompletionStatus rv = path_builder.Run(base::Closure());
+ EXPECT_EQ(CompletionStatus::SYNC, rv);
+
+ EXPECT_EQ(expected_result, result.is_success());
+ }
+};
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P(PathBuilder,
+ VerifyCertificateChainSingleRootTest,
+ PathBuilderDelegate);
+
+INSTANTIATE_TYPED_TEST_CASE_P(PathBuilder,
+ VerifyCertificateChainNonSingleRootTest,
+ PathBuilderDelegate);
+
+} // namespace net
« no previous file with comments | « net/cert/internal/path_builder_unittest.cc ('k') | net/cert/internal/trust_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698