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

Unified Diff: net/cert/mock_cert_verifier.cc

Issue 2753123002: Add --ignore-certificate-errors-spki-list switch and UMA histogram. (Closed)
Patch Set: Really add IgnoreErrorsCertVerifier. Created 3 years, 8 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/mock_cert_verifier.cc
diff --git a/net/cert/mock_cert_verifier.cc b/net/cert/mock_cert_verifier.cc
index 9cbbafd3cfe91e331348d3247d7457c055d28934..f9e5258db3a1d6ff31f05d2d258b97fa910984f4 100644
--- a/net/cert/mock_cert_verifier.cc
+++ b/net/cert/mock_cert_verifier.cc
@@ -36,7 +36,8 @@ struct MockCertVerifier::Rule {
int rv;
};
-MockCertVerifier::MockCertVerifier() : default_result_(ERR_CERT_INVALID) {}
+MockCertVerifier::MockCertVerifier()
+ : default_result_(ERR_CERT_INVALID), async_(false) {}
MockCertVerifier::~MockCertVerifier() {}
@@ -46,6 +47,7 @@ int MockCertVerifier::Verify(const RequestParams& params,
const CompletionCallback& callback,
std::unique_ptr<Request>* out_req,
const NetLogWithSource& net_log) {
+ int result;
RuleList::const_iterator it;
for (it = rules_.begin(); it != rules_.end(); ++it) {
// Check just the server cert. Intermediates will be ignored.
@@ -54,13 +56,21 @@ int MockCertVerifier::Verify(const RequestParams& params,
if (!base::MatchPattern(params.hostname(), it->hostname))
continue;
*verify_result = it->result;
- return it->rv;
+ result = it->rv;
+ goto exit;
Ryan Sleevi 2017/04/07 16:08:05 We don't use goto in Chromium code
martinkr 2017/04/07 21:40:57 Done.
}
// Fall through to the default.
verify_result->verified_cert = params.certificate();
verify_result->cert_status = MapNetErrorToCertStatus(default_result_);
- return default_result_;
+ result = default_result_;
+
+exit:
+ if (async_) {
+ callback.Run(result);
+ return ERR_IO_PENDING;
+ }
+ return result;
}
void MockCertVerifier::AddResultForCert(scoped_refptr<X509Certificate> cert,

Powered by Google App Engine
This is Rietveld 408576698