Chromium Code Reviews| 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 : ProofVerifierChromium(cert_verifier), | |
| 27 cert_verifier_(cert_verifier) { | |
| 28 } | |
| 29 virtual ~TestProofVerifierChromium() { } | |
| 30 | |
| 31 void InstallRootCertificate() { | |
|
wtc
2013/06/24 22:36:56
This method should just be inlined in the construc
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 32 // Load and install the root for the validated chain. | |
| 33 root_cert_ = ImportCertFromFile(GetTestCertsDirectory(), | |
| 34 "proof_verify.crt"); | |
|
wtc
2013/06/24 22:36:56
The root certificate file name should ideally be p
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 35 ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert_); | |
| 36 scoped_root_.Reset(root_cert_.get()); | |
| 37 } | |
| 38 | |
| 39 private: | |
| 40 scoped_refptr<X509Certificate> root_cert_; | |
|
wtc
2013/06/24 22:36:56
Remove the root_cert_ member. The scoped_root_ mem
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 41 ScopedTestRoot scoped_root_; | |
| 42 scoped_ptr<CertVerifier> cert_verifier_; | |
| 43 }; | |
| 44 | |
| 45 // static | |
| 46 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() { | |
| 47 TestProofVerifierChromium* proof_verifier = | |
| 48 new TestProofVerifierChromium(CertVerifier::CreateDefault()); | |
| 49 proof_verifier->InstallRootCertificate(); | |
| 50 return proof_verifier; | |
| 51 } | |
| 52 | |
| 53 } // namespace test | |
| 54 | |
| 55 } // namespace net | |
| OLD | NEW |