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

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

Issue 1290243007: Shift URLRequestContextStorage over to taking scoped_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Paul_BuilderGrab
Patch Set: Sync'd to p347022. 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/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/http/transport_security_state.h"
14 #include "net/quic/crypto/proof_source_chromium.h" 14 #include "net/quic/crypto/proof_source_chromium.h"
15 #include "net/quic/crypto/proof_verifier_chromium.h" 15 #include "net/quic/crypto/proof_verifier_chromium.h"
16 #include "net/test/cert_test_util.h" 16 #include "net/test/cert_test_util.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 namespace test { 20 namespace test {
21 21
22 namespace { 22 namespace {
23 23
24 class TestProofVerifierChromium : public ProofVerifierChromium { 24 class TestProofVerifierChromium : public ProofVerifierChromium {
25 public: 25 public:
26 TestProofVerifierChromium(CertVerifier* cert_verifier, 26 TestProofVerifierChromium(
27 TransportSecurityState* transport_security_state, 27 scoped_ptr<CertVerifier> cert_verifier,
28 const std::string& cert_file) 28 scoped_ptr<TransportSecurityState> transport_security_state,
29 : ProofVerifierChromium(cert_verifier, nullptr, transport_security_state), 29 const std::string& cert_file)
30 cert_verifier_(cert_verifier), 30 : ProofVerifierChromium(cert_verifier.get(),
31 transport_security_state_(transport_security_state) { 31 nullptr,
32 transport_security_state.get()),
33 cert_verifier_(cert_verifier.Pass()),
34 transport_security_state_(transport_security_state.Pass()) {
32 // Load and install the root for the validated chain. 35 // Load and install the root for the validated chain.
33 scoped_refptr<X509Certificate> root_cert = 36 scoped_refptr<X509Certificate> root_cert =
34 ImportCertFromFile(GetTestCertsDirectory(), cert_file); 37 ImportCertFromFile(GetTestCertsDirectory(), cert_file);
35 scoped_root_.Reset(root_cert.get()); 38 scoped_root_.Reset(root_cert.get());
36 } 39 }
37 ~TestProofVerifierChromium() override {} 40 ~TestProofVerifierChromium() override {}
38 41
39 private: 42 private:
40 ScopedTestRoot scoped_root_; 43 ScopedTestRoot scoped_root_;
41 scoped_ptr<CertVerifier> cert_verifier_; 44 scoped_ptr<CertVerifier> cert_verifier_;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } // namespace 110 } // namespace
108 111
109 // static 112 // static
110 ProofSource* CryptoTestUtils::ProofSourceForTesting() { 113 ProofSource* CryptoTestUtils::ProofSourceForTesting() {
111 return new ProofSourceChromium(); 114 return new ProofSourceChromium();
112 } 115 }
113 116
114 // static 117 // static
115 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() { 118 ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() {
116 TestProofVerifierChromium* proof_verifier = new TestProofVerifierChromium( 119 TestProofVerifierChromium* proof_verifier = new TestProofVerifierChromium(
117 CertVerifier::CreateDefault(), new TransportSecurityState, 120 CertVerifier::CreateDefault(),
118 "quic_root.crt"); 121 make_scoped_ptr(new TransportSecurityState), "quic_root.crt");
119 return proof_verifier; 122 return proof_verifier;
120 } 123 }
121 124
122 // static 125 // static
123 ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() { 126 ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() {
124 return new ProofVerifyContextChromium(/*cert_verify_flags=*/0, BoundNetLog()); 127 return new ProofVerifyContextChromium(/*cert_verify_flags=*/0, BoundNetLog());
125 } 128 }
126 129
127 // static 130 // static
128 ProofSource* CryptoTestUtils::FakeProofSourceForTesting() { 131 ProofSource* CryptoTestUtils::FakeProofSourceForTesting() {
129 return new FakeProofSource(); 132 return new FakeProofSource();
130 } 133 }
131 134
132 // static 135 // static
133 ProofVerifier* CryptoTestUtils::FakeProofVerifierForTesting() { 136 ProofVerifier* CryptoTestUtils::FakeProofVerifierForTesting() {
134 return new FakeProofVerifier(); 137 return new FakeProofVerifier();
135 } 138 }
136 139
137 // static 140 // static
138 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() { 141 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() {
139 return nullptr; 142 return nullptr;
140 } 143 }
141 144
142 } // namespace test 145 } // namespace test
143 146
144 } // namespace net 147 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698