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

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

Issue 1309813003: Implement an openssl version of a QUIC ProofSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments Created 5 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 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/net_errors.h"
9 #include "net/base/test_data_directory.h" 10 #include "net/base/test_data_directory.h"
10 #include "net/cert/cert_verifier.h" 11 #include "net/cert/cert_verifier.h"
12 #include "net/cert/mock_cert_verifier.h"
11 #include "net/cert/test_root_certs.h" 13 #include "net/cert/test_root_certs.h"
12 #include "net/cert/x509_certificate.h" 14 #include "net/cert/x509_certificate.h"
13 #include "net/http/transport_security_state.h" 15 #include "net/http/transport_security_state.h"
14 #include "net/quic/crypto/proof_source_chromium.h" 16 #include "net/quic/crypto/proof_source_chromium.h"
15 #include "net/quic/crypto/proof_verifier_chromium.h" 17 #include "net/quic/crypto/proof_verifier_chromium.h"
16 #include "net/test/cert_test_util.h" 18 #include "net/test/cert_test_util.h"
17 19
18 namespace net { 20 namespace net {
19 21
20 namespace test { 22 namespace test {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 103 }
102 104
103 private: 105 private:
104 DISALLOW_COPY_AND_ASSIGN(FakeProofVerifier); 106 DISALLOW_COPY_AND_ASSIGN(FakeProofVerifier);
105 }; 107 };
106 108
107 } // namespace 109 } // namespace
108 110
109 // static 111 // static
110 ProofSource* CryptoTestUtils::ProofSourceForTesting() { 112 ProofSource* CryptoTestUtils::ProofSourceForTesting() {
111 return new ProofSourceChromium(); 113 ProofSourceChromium* source = new ProofSourceChromium();
114 base::FilePath certs_dir = GetTestCertsDirectory();
115 CHECK(
116 source->Initialize(certs_dir.Append("quic_test.example.com.crt"),
117 certs_dir.Append("quic_test.example.com.key.pkcs8")));
118 return source;
112 } 119 }
113 120
114 // static 121 // static
115 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() { 122 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() {
116 TestProofVerifierChromium* proof_verifier = new TestProofVerifierChromium( 123 // TODO(rch): use an actual CertVerifier here. Need to enable
117 CertVerifier::CreateDefault(), new TransportSecurityState, 124 // CryptoTestUtils::HandshakeWithFakeClient to wait for async
118 "quic_root.crt"); 125 // proof verification.
119 return proof_verifier; 126 MockCertVerifier* cert_verifier = new MockCertVerifier();
127 cert_verifier->set_default_result(OK);
128 return new TestProofVerifierChromium(
129 cert_verifier, new TransportSecurityState, "quic_root.crt");
davidben 2015/08/25 19:33:02 [Not for this CL, but TestProofVerifierChromium sh
Ryan Hamilton 2015/08/26 18:52:14 TODO added. Thanks.
120 } 130 }
121 131
122 // static 132 // static
123 ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() { 133 ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() {
124 return new ProofVerifyContextChromium(/*cert_verify_flags=*/0, BoundNetLog()); 134 return new ProofVerifyContextChromium(/*cert_verify_flags=*/0, BoundNetLog());
125 } 135 }
126 136
127 // static 137 // static
128 ProofSource* CryptoTestUtils::FakeProofSourceForTesting() { 138 ProofSource* CryptoTestUtils::FakeProofSourceForTesting() {
129 return new FakeProofSource(); 139 return new FakeProofSource();
130 } 140 }
131 141
132 // static 142 // static
133 ProofVerifier* CryptoTestUtils::FakeProofVerifierForTesting() { 143 ProofVerifier* CryptoTestUtils::FakeProofVerifierForTesting() {
134 return new FakeProofVerifier(); 144 return new FakeProofVerifier();
135 } 145 }
136 146
137 // static 147 // static
138 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() { 148 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() {
139 return nullptr; 149 return nullptr;
140 } 150 }
141 151
142 } // namespace test 152 } // namespace test
143 153
144 } // namespace net 154 } // namespace net
OLDNEW
« net/quic/crypto/proof_source_chromium_openssl.cc ('K') | « net/quic/test_tools/crypto_test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698