| Index: net/cert/internal/trust_store_test_helpers.h
 | 
| diff --git a/net/cert/internal/trust_store_test_helpers.h b/net/cert/internal/trust_store_test_helpers.h
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..18b911d3568fe18fc0742f0681bfae46946b9456
 | 
| --- /dev/null
 | 
| +++ b/net/cert/internal/trust_store_test_helpers.h
 | 
| @@ -0,0 +1,71 @@
 | 
| +// Copyright 2016 The Chromium Authors. All rights reserved.
 | 
| +// Use of this source code is governed by a BSD-style license that can be
 | 
| +// found in the LICENSE file.
 | 
| +
 | 
| +#ifndef NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
 | 
| +#define NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
 | 
| +
 | 
| +#include "base/run_loop.h"
 | 
| +#include "net/cert/internal/trust_store_static.h"
 | 
| +
 | 
| +namespace net {
 | 
| +
 | 
| +class AsyncTrustStoreStatic : public TrustStore {
 | 
| + public:
 | 
| +  AsyncTrustStoreStatic() = default;
 | 
| +  ~AsyncTrustStoreStatic() override = default;
 | 
| +
 | 
| +  // Adds a trusted certificate to the store.
 | 
| +  void AddTrustedCertificate(scoped_refptr<ParsedCertificate> anchor) {
 | 
| +    trust_store_static_.AddTrustedCertificate(std::move(anchor));
 | 
| +  }
 | 
| +
 | 
| +  // TrustStore implementation:
 | 
| +  void IsTrustedCertificate(
 | 
| +      scoped_refptr<ParsedCertificate> cert,
 | 
| +      const TrustCallback& callback,
 | 
| +      bool* out_trusted,
 | 
| +      std::unique_ptr<TrustStore::Request>* out_req) const override;
 | 
| +
 | 
| +  // CertIssuerSource implementation:
 | 
| +  void SyncGetIssuersOf(const ParsedCertificate* cert,
 | 
| +                        ParsedCertificateList* issuers) override;
 | 
| +  void AsyncGetIssuersOf(
 | 
| +      scoped_refptr<ParsedCertificate> cert,
 | 
| +      const IssuerCallback& callback,
 | 
| +      std::unique_ptr<CertIssuerSource::Request>* out_req) override;
 | 
| +
 | 
| + private:
 | 
| +  TrustStoreStatic trust_store_static_;
 | 
| +};
 | 
| +
 | 
| +class TrustResultRecorder {
 | 
| + public:
 | 
| +  TrustResultRecorder();
 | 
| +  ~TrustResultRecorder();
 | 
| +
 | 
| +  void HandleResult(bool trust) {
 | 
| +    results_.push_back(trust);
 | 
| +    run_loop_.Quit();
 | 
| +  }
 | 
| +
 | 
| +  const std::vector<bool>& results() { return results_; }
 | 
| +
 | 
| +  void Run() { run_loop_.Run(); }
 | 
| +
 | 
| +  TrustStore::TrustCallback Callback();
 | 
| +
 | 
| + private:
 | 
| +  std::vector<bool> results_;
 | 
| +  base::RunLoop run_loop_;
 | 
| +};
 | 
| +
 | 
| +// Deletes the Request owned by |*req_owner|, then calls done_callback. Intended
 | 
| +// to be passed as the IssuerCallback to IsTrustedCertificate.
 | 
| +void TrustRequestDeleter(std::unique_ptr<TrustStore::Request>* req_owner,
 | 
| +                         base::Closure done_callback,
 | 
| +                         bool trusted);
 | 
| +
 | 
| +}  // namespace net
 | 
| +
 | 
| +#endif  // NET_CERT_INTERNAL_TRUST_STORE_TEST_HELPERS_H_
 | 
| 
 |