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

Side by Side Diff: net/quic/test_tools/crypto_test_utils_chromium.cc

Issue 436753002: Extend ProofVerifierChromium and ProofVerifyDetailsChromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove an unneeded member of ProofVerifierChromium Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #include "net/quic/test_tools/crypto_test_utils.h" 5 #include "net/quic/test_tools/crypto_test_utils.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/base/test_data_directory.h" 9 #include "net/base/test_data_directory.h"
10 #include "net/cert/cert_verifier.h" 10 #include "net/cert/cert_verifier.h"
11 #include "net/cert/test_root_certs.h" 11 #include "net/cert/test_root_certs.h"
12 #include "net/cert/x509_certificate.h" 12 #include "net/cert/x509_certificate.h"
13 #include "net/http/transport_security_state.h"
13 #include "net/quic/crypto/proof_source_chromium.h" 14 #include "net/quic/crypto/proof_source_chromium.h"
14 #include "net/quic/crypto/proof_verifier_chromium.h" 15 #include "net/quic/crypto/proof_verifier_chromium.h"
15 #include "net/test/cert_test_util.h" 16 #include "net/test/cert_test_util.h"
16 17
17 namespace net { 18 namespace net {
18 19
19 namespace test { 20 namespace test {
20 21
21 namespace { 22 namespace {
22 23
23 class TestProofVerifierChromium : public ProofVerifierChromium { 24 class TestProofVerifierChromium : public ProofVerifierChromium {
24 public: 25 public:
25 TestProofVerifierChromium(CertVerifier* cert_verifier, 26 TestProofVerifierChromium(CertVerifier* cert_verifier,
27 TransportSecurityState* transport_security_state,
26 const std::string& cert_file) 28 const std::string& cert_file)
27 : ProofVerifierChromium(cert_verifier), 29 : ProofVerifierChromium(cert_verifier, transport_security_state),
28 cert_verifier_(cert_verifier) { 30 cert_verifier_(cert_verifier),
31 transport_security_state_(transport_security_state) {
29 // Load and install the root for the validated chain. 32 // Load and install the root for the validated chain.
30 scoped_refptr<X509Certificate> root_cert = 33 scoped_refptr<X509Certificate> root_cert =
31 ImportCertFromFile(GetTestCertsDirectory(), cert_file); 34 ImportCertFromFile(GetTestCertsDirectory(), cert_file);
32 scoped_root_.Reset(root_cert.get()); 35 scoped_root_.Reset(root_cert.get());
33 } 36 }
34 virtual ~TestProofVerifierChromium() {} 37 virtual ~TestProofVerifierChromium() {}
35 38
36 private: 39 private:
37 ScopedTestRoot scoped_root_; 40 ScopedTestRoot scoped_root_;
38 scoped_ptr<CertVerifier> cert_verifier_; 41 scoped_ptr<CertVerifier> cert_verifier_;
42 scoped_ptr<TransportSecurityState> transport_security_state_;
39 }; 43 };
40 44
41 const char kLeafCert[] = "leaf"; 45 const char kLeafCert[] = "leaf";
42 const char kIntermediateCert[] = "intermediate"; 46 const char kIntermediateCert[] = "intermediate";
43 const char kSignature[] = "signature"; 47 const char kSignature[] = "signature";
44 48
45 class FakeProofSource : public ProofSource { 49 class FakeProofSource : public ProofSource {
46 public: 50 public:
47 FakeProofSource() : certs_(2) { 51 FakeProofSource() : certs_(2) {
48 certs_[0] = kLeafCert; 52 certs_[0] = kLeafCert;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 106
103 } // namespace 107 } // namespace
104 108
105 // static 109 // static
106 ProofSource* CryptoTestUtils::ProofSourceForTesting() { 110 ProofSource* CryptoTestUtils::ProofSourceForTesting() {
107 return new ProofSourceChromium(); 111 return new ProofSourceChromium();
108 } 112 }
109 113
110 // static 114 // static
111 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() { 115 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() {
112 TestProofVerifierChromium* proof_verifier = new TestProofVerifierChromium( 116 TestProofVerifierChromium* proof_verifier =
113 CertVerifier::CreateDefault(), "quic_root.crt"); 117 new TestProofVerifierChromium(CertVerifier::CreateDefault(),
118 new TransportSecurityState,
119 "quic_root.crt");
114 return proof_verifier; 120 return proof_verifier;
115 } 121 }
116 122
117 // static 123 // static
118 ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() { 124 ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() {
119 return new ProofVerifyContextChromium(BoundNetLog()); 125 return new ProofVerifyContextChromium(BoundNetLog());
120 } 126 }
121 127
122 // static 128 // static
123 ProofSource* CryptoTestUtils::FakeProofSourceForTesting() { 129 ProofSource* CryptoTestUtils::FakeProofSourceForTesting() {
124 return new FakeProofSource(); 130 return new FakeProofSource();
125 } 131 }
126 132
127 // static 133 // static
128 ProofVerifier* CryptoTestUtils::FakeProofVerifierForTesting() { 134 ProofVerifier* CryptoTestUtils::FakeProofVerifierForTesting() {
129 return new FakeProofVerifier(); 135 return new FakeProofVerifier();
130 } 136 }
131 137
132 // static 138 // static
133 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() { 139 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() {
134 return NULL; 140 return NULL;
135 } 141 }
136 142
137 } // namespace test 143 } // namespace test
138 144
139 } // namespace net 145 } // namespace net
OLDNEW
« net/quic/crypto/proof_verifier_chromium.cc ('K') | « net/quic/quic_stream_factory_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698