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/verify_certificate_chain_unittest.cc

Issue 2282183004: Add error information to VerifyCertificateChain(). (Closed)
Patch Set: Created 4 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
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 225dcabcade525cea223e9c38dbc955534600566..8c3d3d0ad9671e0f2a37987175786f28e07366cf 100644
--- a/net/cert/internal/verify_certificate_chain_unittest.cc
+++ b/net/cert/internal/verify_certificate_chain_unittest.cc
@@ -17,15 +17,27 @@ class VerifyCertificateChainDelegate {
static void Verify(const ParsedCertificateList& chain,
const scoped_refptr<TrustAnchor>& trust_anchor,
const der::GeneralizedTime& time,
- bool expected_result) {
+ bool expected_result,
+ const std::string& expected_errors) {
ASSERT_TRUE(trust_anchor);
SimpleSignaturePolicy signature_policy(1024);
+ CertErrors errors;
bool result = VerifyCertificateChain(chain, trust_anchor.get(),
- &signature_policy, time);
-
- ASSERT_EQ(expected_result, result);
+ &signature_policy, time, &errors);
+
+ // Check that the error types match (parameters and context is not
+ // considered for simplicity).
+ std::string actual_errors;
+ for (const auto& error : errors.errors()) {
+ if (!actual_errors.empty())
+ actual_errors += "\n";
+ actual_errors += error.type;
+ }
+ EXPECT_EQ(expected_errors, actual_errors);
+
+ EXPECT_EQ(expected_result, result);
}
};

Powered by Google App Engine
This is Rietveld 408576698