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

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

Issue 2078653002: Add an out parameter to VerifyCertificateChain for retrieving the trusted chain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit 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/verify_certificate_chain_pkits_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/verify_certificate_chain_unittest.cc
diff --git a/net/cert/internal/verify_certificate_chain_unittest.cc b/net/cert/internal/verify_certificate_chain_unittest.cc
index 11323f8bc75035078fa0f18810c310ef942b5e02..4cd03c08901b63e33dd8add3a3ef8cef90cf6932 100644
--- a/net/cert/internal/verify_certificate_chain_unittest.cc
+++ b/net/cert/internal/verify_certificate_chain_unittest.cc
@@ -114,8 +114,17 @@ void RunTest(const char* file_name) {
SimpleSignaturePolicy signature_policy(1024);
- bool result =
- VerifyCertificateChain(input_chain, trust_store, &signature_policy, time);
+ std::vector<scoped_refptr<ParsedCertificate>> trusted_chain;
+ bool result = VerifyCertificateChain(input_chain, trust_store,
+ &signature_policy, time, &trusted_chain);
+ if (result) {
+ ASSERT_EQ(trusted_chain.size(), input_chain.size() + 1);
+ ASSERT_TRUE(std::equal(input_chain.begin(), input_chain.end(),
+ trusted_chain.begin()));
+ ASSERT_TRUE(trust_store.IsTrustedCertificate(trusted_chain.back().get()));
+ } else {
+ ASSERT_EQ(trusted_chain.size(), 0u);
+ }
ASSERT_EQ(expected_result, result);
}
@@ -235,8 +244,8 @@ TEST(VerifyCertificateChainTest, EmptyChainIsInvalid) {
std::vector<scoped_refptr<ParsedCertificate>> chain;
SimpleSignaturePolicy signature_policy(2048);
- ASSERT_FALSE(
- VerifyCertificateChain(chain, trust_store, &signature_policy, time));
+ ASSERT_FALSE(VerifyCertificateChain(chain, trust_store, &signature_policy,
+ time, nullptr));
}
// TODO(eroman): Add test that invalidate validity dates where the day or month
« no previous file with comments | « net/cert/internal/verify_certificate_chain_pkits_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698