OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 #include "net/quic/test_tools/crypto_test_utils.h" |
| 6 |
| 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "net/base/test_data_directory.h" |
| 12 #include "net/cert/cert_verifier.h" |
| 13 #include "net/cert/test_root_certs.h" |
| 14 #include "net/cert/x509_certificate.h" |
| 15 #include "net/quic/crypto/proof_verifier_chromium.h" |
| 16 #include "net/test/cert_test_util.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 |
| 19 namespace net { |
| 20 |
| 21 namespace test { |
| 22 |
| 23 class TestProofVerifierChromium : public ProofVerifierChromium { |
| 24 public: |
| 25 explicit TestProofVerifierChromium(CertVerifier* cert_verifier, |
| 26 const std::string& cert_file) |
| 27 : ProofVerifierChromium(cert_verifier), |
| 28 cert_verifier_(cert_verifier) { |
| 29 // Load and install the root for the validated chain. |
| 30 scoped_refptr<X509Certificate> root_cert = |
| 31 ImportCertFromFile(GetTestCertsDirectory(), cert_file); |
| 32 scoped_root_.Reset(root_cert.get()); |
| 33 } |
| 34 virtual ~TestProofVerifierChromium() { } |
| 35 |
| 36 private: |
| 37 ScopedTestRoot scoped_root_; |
| 38 scoped_ptr<CertVerifier> cert_verifier_; |
| 39 }; |
| 40 |
| 41 // static |
| 42 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() { |
| 43 TestProofVerifierChromium* proof_verifier = new TestProofVerifierChromium( |
| 44 CertVerifier::CreateDefault(), "proof_verify.crt"); |
| 45 return proof_verifier; |
| 46 } |
| 47 |
| 48 } // namespace test |
| 49 |
| 50 } // namespace net |
OLD | NEW |