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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Returns a |ProofSource| that serves up test certificates. | 93 // Returns a |ProofSource| that serves up test certificates. |
94 static ProofSource* ProofSourceForTesting(); | 94 static ProofSource* ProofSourceForTesting(); |
95 | 95 |
96 // Returns a |ProofVerifier| that uses the QUIC testing root CA. | 96 // Returns a |ProofVerifier| that uses the QUIC testing root CA. |
97 static ProofVerifier* ProofVerifierForTesting(); | 97 static ProofVerifier* ProofVerifierForTesting(); |
98 | 98 |
99 // Returns a |ProofVerifyContext| that must be used with the verifier | 99 // Returns a |ProofVerifyContext| that must be used with the verifier |
100 // returned by |ProofVerifierForTesting|. | 100 // returned by |ProofVerifierForTesting|. |
101 static ProofVerifyContext* ProofVerifyContextForTesting(); | 101 static ProofVerifyContext* ProofVerifyContextForTesting(); |
102 | 102 |
| 103 // These functions return a fake |ProofSource|, |ProofVerifier|, or |
| 104 // |ProofVerifyContext| that works with each other. These are suitable for |
| 105 // unit tests that aren't concerned with |ProofSource| and |ProofVerifier|. |
| 106 // TODO(wtc): delete these when Chromium has a working |
| 107 // ProofSourceForTesting(). |
| 108 static ProofSource* FakeProofSourceForTesting(); |
| 109 static ProofVerifier* FakeProofVerifierForTesting(); |
| 110 static ProofVerifyContext* FakeProofVerifyContextForTesting(); |
| 111 |
103 // MockCommonCertSets returns a CommonCertSets that contains a single set with | 112 // MockCommonCertSets returns a CommonCertSets that contains a single set with |
104 // hash |hash|, consisting of the certificate |cert| at index |index|. | 113 // hash |hash|, consisting of the certificate |cert| at index |index|. |
105 static CommonCertSets* MockCommonCertSets(base::StringPiece cert, | 114 static CommonCertSets* MockCommonCertSets(base::StringPiece cert, |
106 uint64 hash, | 115 uint64 hash, |
107 uint32 index); | 116 uint32 index); |
108 | 117 |
109 // ParseTag returns a QuicTag from parsing |tagstr|. |tagstr| may either be | 118 // ParseTag returns a QuicTag from parsing |tagstr|. |tagstr| may either be |
110 // in the format "EXMP" (i.e. ASCII format), or "#11223344" (an explicit hex | 119 // in the format "EXMP" (i.e. ASCII format), or "#11223344" (an explicit hex |
111 // format). It CHECK fails if there's a parse error. | 120 // format). It CHECK fails if there's a parse error. |
112 static QuicTag ParseTag(const char* tagstr); | 121 static QuicTag ParseTag(const char* tagstr); |
(...skipping 30 matching lines...) Expand all Loading... |
143 QuicCryptoServerStream* server); | 152 QuicCryptoServerStream* server); |
144 | 153 |
145 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils); | 154 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils); |
146 }; | 155 }; |
147 | 156 |
148 } // namespace test | 157 } // namespace test |
149 | 158 |
150 } // namespace net | 159 } // namespace net |
151 | 160 |
152 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 161 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
OLD | NEW |