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

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

Issue 2272493002: Add TrustStoreNSS and TrustStoreCollection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-trust-store-interface3-nss
Patch Set: rebase Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_ 5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
6 #define NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_ 6 #define NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "net/cert/internal/trust_store.h" 10 #include "net/cert/internal/trust_store.h"
11 #include "net/cert/internal/trust_store_in_memory.h" 11 #include "net/cert/internal/trust_store_in_memory.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 // Deletes the Request owned by |*req_owner|, then calls done_callback. Intended 15 // Deletes the Request owned by |*req_owner|, then calls done_callback. Intended
16 // to be passed as the TrustAnchorsCallback to FindTrustAnchorsForCert to test 16 // to be passed as the TrustAnchorsCallback to FindTrustAnchorsForCert to test
17 // deleting the Request during the request callback. 17 // deleting the Request during the request callback.
18 void TrustStoreRequestDeleter(std::unique_ptr<TrustStore::Request>* req_owner, 18 void TrustStoreRequestDeleter(std::unique_ptr<TrustStore::Request>* req_owner,
19 const base::Closure& done_callback, 19 const base::Closure& done_callback,
20 std::unique_ptr<TrustAnchors> anchors); 20 TrustAnchors anchors);
21 21
22 // Helper to record async results from a FindTrustAnchorsForCert call. 22 // Helper to record async results from a FindTrustAnchorsForCert call.
23 class TrustAnchorResultRecorder { 23 class TrustAnchorResultRecorder {
24 public: 24 public:
25 TrustAnchorResultRecorder(); 25 TrustAnchorResultRecorder();
26 ~TrustAnchorResultRecorder(); 26 ~TrustAnchorResultRecorder();
27 27
28 TrustStore::TrustAnchorsCallback Callback(); 28 TrustStore::TrustAnchorsCallback Callback();
29 29
30 void Run() { run_loop_.Run(); } 30 void Run() { run_loop_.Run(); }
(...skipping 15 matching lines...) Expand all
46 ~TrustStoreInMemoryAsync() override; 46 ~TrustStoreInMemoryAsync() override;
47 47
48 // Adds |anchor| to the set of results that will be returned synchronously. 48 // Adds |anchor| to the set of results that will be returned synchronously.
49 void AddSyncTrustAnchor(scoped_refptr<TrustAnchor> anchor); 49 void AddSyncTrustAnchor(scoped_refptr<TrustAnchor> anchor);
50 50
51 // Adds |anchor| to the set of results that will be returned asynchronously. 51 // Adds |anchor| to the set of results that will be returned asynchronously.
52 void AddAsyncTrustAnchor(scoped_refptr<TrustAnchor> anchor); 52 void AddAsyncTrustAnchor(scoped_refptr<TrustAnchor> anchor);
53 53
54 // TrustStore implementation: 54 // TrustStore implementation:
55 void FindTrustAnchorsForCert( 55 void FindTrustAnchorsForCert(
56 const ParsedCertificate* cert, 56 const scoped_refptr<ParsedCertificate>& cert,
57 const TrustAnchorsCallback& callback, 57 const TrustAnchorsCallback& callback,
58 TrustAnchors* synchronous_matches, 58 TrustAnchors* synchronous_matches,
59 std::unique_ptr<Request>* out_req) const override; 59 std::unique_ptr<Request>* out_req) const override;
60 60
61 private: 61 private:
62 TrustStoreInMemory sync_store_; 62 TrustStoreInMemory sync_store_;
63 TrustStoreInMemory async_store_; 63 TrustStoreInMemory async_store_;
64 }; 64 };
65 65
66 } // namespace net 66 } // namespace net
67 67
68 #endif // NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_ 68 #endif // NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
OLDNEW
« no previous file with comments | « net/cert/internal/trust_store_nss_unittest.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