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

Side by Side Diff: net/cert/internal/trust_store_test_helpers.h

Issue 2126803004: WIP: NSS trust store integration for path builder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-command-line-path-builder-add_certpathbuilder
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 unified diff | Download patch
« no previous file with comments | « net/cert/internal/trust_store_static.cc ('k') | net/cert/internal/trust_store_test_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
6 #define NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
7
8 #include "base/run_loop.h"
9 #include "net/cert/internal/trust_store_static.h"
10
11 namespace net {
12
13 class AsyncTrustStoreStatic : public TrustStore {
14 public:
15 AsyncTrustStoreStatic() = default;
16 ~AsyncTrustStoreStatic() override = default;
17
18 // Adds a trusted certificate to the store.
19 void AddTrustedCertificate(scoped_refptr<ParsedCertificate> anchor) {
20 trust_store_static_.AddTrustedCertificate(std::move(anchor));
21 }
22
23 // TrustStore implementation:
24 void IsTrustedCertificate(
25 scoped_refptr<ParsedCertificate> cert,
26 const TrustCallback& callback,
27 bool* out_trusted,
28 std::unique_ptr<TrustStore::Request>* out_req) const override;
29
30 // CertIssuerSource implementation:
31 void SyncGetIssuersOf(const ParsedCertificate* cert,
32 ParsedCertificateList* issuers) override;
33 void AsyncGetIssuersOf(
34 scoped_refptr<ParsedCertificate> cert,
35 const IssuerCallback& callback,
36 std::unique_ptr<CertIssuerSource::Request>* out_req) override;
37
38 private:
39 TrustStoreStatic trust_store_static_;
40 };
41
42 class TrustResultRecorder {
43 public:
44 TrustResultRecorder();
45 ~TrustResultRecorder();
46
47 void HandleResult(bool trust) {
48 results_.push_back(trust);
49 run_loop_.Quit();
50 }
51
52 const std::vector<bool>& results() { return results_; }
53
54 void Run() { run_loop_.Run(); }
55
56 TrustStore::TrustCallback Callback();
57
58 private:
59 std::vector<bool> results_;
60 base::RunLoop run_loop_;
61 };
62
63 // Deletes the Request owned by |*req_owner|, then calls done_callback. Intended
64 // to be passed as the IssuerCallback to IsTrustedCertificate.
65 void TrustRequestDeleter(std::unique_ptr<TrustStore::Request>* req_owner,
66 base::Closure done_callback,
67 bool trusted);
68
69 } // namespace net
70
71 #endif // NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
OLDNEW
« no previous file with comments | « net/cert/internal/trust_store_static.cc ('k') | net/cert/internal/trust_store_test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698