OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
6 #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 6 #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 // Returns the value for the tag |tag| in the tag value map of |message|. | 120 // Returns the value for the tag |tag| in the tag value map of |message|. |
121 static std::string GetValueForTag(const CryptoHandshakeMessage& message, | 121 static std::string GetValueForTag(const CryptoHandshakeMessage& message, |
122 QuicTag tag); | 122 QuicTag tag); |
123 | 123 |
124 // Returns a |ProofSource| that serves up test certificates. | 124 // Returns a |ProofSource| that serves up test certificates. |
125 static ProofSource* ProofSourceForTesting(); | 125 static ProofSource* ProofSourceForTesting(); |
126 | 126 |
127 // Returns a |ProofVerifier| that uses the QUIC testing root CA. | 127 // Returns a |ProofVerifier| that uses the QUIC testing root CA. |
128 static ProofVerifier* ProofVerifierForTesting(); | 128 static ProofVerifier* ProofVerifierForTesting(); |
129 | 129 |
130 // Returns a real ProofVerifier (not a fake proof verifier) for testing. | |
131 static ProofVerifier* ProofVerifierRealForTesting(); | |
Ryan Hamilton
2015/11/05 05:26:47
nit: How about RealProofVerifierForTesting()?
ramant (doing other things)
2015/11/05 17:36:43
Done.
| |
132 | |
130 // Returns a |ProofVerifyContext| that must be used with the verifier | 133 // Returns a |ProofVerifyContext| that must be used with the verifier |
131 // returned by |ProofVerifierForTesting|. | 134 // returned by |ProofVerifierForTesting|. |
132 static ProofVerifyContext* ProofVerifyContextForTesting(); | 135 static ProofVerifyContext* ProofVerifyContextForTesting(); |
133 | 136 |
134 // These functions return a fake |ProofSource|, |ProofVerifier|, or | |
135 // |ProofVerifyContext| that works with each other. These are suitable for | |
136 // unit tests that aren't concerned with |ProofSource| and |ProofVerifier|. | |
137 // TODO(wtc): delete these when Chromium has a working | |
138 // ProofSourceForTesting(). | |
139 static ProofSource* FakeProofSourceForTesting(); | |
140 static ProofVerifier* FakeProofVerifierForTesting(); | |
141 static ProofVerifyContext* FakeProofVerifyContextForTesting(); | |
142 | |
143 // MockCommonCertSets returns a CommonCertSets that contains a single set with | 137 // MockCommonCertSets returns a CommonCertSets that contains a single set with |
144 // hash |hash|, consisting of the certificate |cert| at index |index|. | 138 // hash |hash|, consisting of the certificate |cert| at index |index|. |
145 static CommonCertSets* MockCommonCertSets(base::StringPiece cert, | 139 static CommonCertSets* MockCommonCertSets(base::StringPiece cert, |
146 uint64 hash, | 140 uint64 hash, |
147 uint32 index); | 141 uint32 index); |
148 | 142 |
149 // ParseTag returns a QuicTag from parsing |tagstr|. |tagstr| may either be | 143 // ParseTag returns a QuicTag from parsing |tagstr|. |tagstr| may either be |
150 // in the format "EXMP" (i.e. ASCII format), or "#11223344" (an explicit hex | 144 // in the format "EXMP" (i.e. ASCII format), or "#11223344" (an explicit hex |
151 // format). It CHECK fails if there's a parse error. | 145 // format). It CHECK fails if there's a parse error. |
152 static QuicTag ParseTag(const char* tagstr); | 146 static QuicTag ParseTag(const char* tagstr); |
(...skipping 23 matching lines...) Expand all Loading... | |
176 QuicCryptoServerStream* server); | 170 QuicCryptoServerStream* server); |
177 | 171 |
178 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils); | 172 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils); |
179 }; | 173 }; |
180 | 174 |
181 } // namespace test | 175 } // namespace test |
182 | 176 |
183 } // namespace net | 177 } // namespace net |
184 | 178 |
185 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 179 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
OLD | NEW |