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

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

Issue 2597003002: Re-enable the omitted tests in path_builder_unittest.cc. (Closed)
Patch Set: Created 4 years 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 | « no previous file | net/cert/internal/path_builder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/path_builder.cc
diff --git a/net/cert/internal/path_builder.cc b/net/cert/internal/path_builder.cc
index 266a2a13aed5c0057ac5a75dfc1b0cc3b73564ff..bb4283eeed6e242a005b1341f1b08cd470e3114c 100644
--- a/net/cert/internal/path_builder.cc
+++ b/net/cert/internal/path_builder.cc
@@ -82,6 +82,9 @@ class CertIssuersIter {
void AddIssuers(ParsedCertificateList issuers);
void DoAsyncIssuerQuery();
+ // Returns true if |issuers_| contains unconsumed certificates.
+ bool HasCurrentIssuer() const { return cur_issuer_ < issuers_.size(); }
+
scoped_refptr<ParsedCertificate> cert_;
CertIssuerSources* cert_issuer_sources_;
const TrustStore* trust_store_;
@@ -160,7 +163,7 @@ void CertIssuersIter::GetNextIssuer(CertificateOrTrustAnchor* out) {
}
// If there aren't any issuers left, block until async results are ready.
- if (cur_issuer_ >= issuers_.size()) {
+ if (!HasCurrentIssuer()) {
if (!did_async_issuer_query_) {
// Now issue request(s) for async ones (AIA, etc).
DoAsyncIssuerQuery();
@@ -168,22 +171,21 @@ void CertIssuersIter::GetNextIssuer(CertificateOrTrustAnchor* out) {
// TODO(eroman): Rather than blocking on the async requests in FIFO order,
// consume in the order they become ready.
- while (cur_async_request_ < pending_async_requests_.size()) {
+ while (!HasCurrentIssuer() &&
+ cur_async_request_ < pending_async_requests_.size()) {
ParsedCertificateList new_issuers;
pending_async_requests_[cur_async_request_]->GetNext(&new_issuers);
if (new_issuers.empty()) {
// Request is exhausted, no more results pending from that
// CertIssuerSource.
pending_async_requests_[cur_async_request_++].reset();
- continue;
+ } else {
+ AddIssuers(std::move(new_issuers));
}
-
- AddIssuers(std::move(new_issuers));
- break;
}
}
- if (cur_issuer_ < issuers_.size()) {
+ if (HasCurrentIssuer()) {
DVLOG(1) << "CertIssuersIter(" << CertDebugString(cert())
<< "): returning issuer " << cur_issuer_ << " of "
<< issuers_.size();
« no previous file with comments | « no previous file | net/cert/internal/path_builder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698