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

Side by Side Diff: net/quic/test_tools/crypto_test_utils.h

Issue 2678973002: Replace va_arg version of crypto_test_utils::Message with a more modern vector argument version. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « net/quic/core/crypto/crypto_server_test.cc ('k') | net/quic/test_tools/crypto_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <cstdarg> 8 #include <cstdarg>
9 #include <cstddef> 9 #include <cstddef>
10 #include <cstdint> 10 #include <cstdint>
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Creates a minimal dummy reject message that will pass the client-config 168 // Creates a minimal dummy reject message that will pass the client-config
169 // validation tests. This will include a server config, but no certs, proof 169 // validation tests. This will include a server config, but no certs, proof
170 // source address token, or server nonce. 170 // source address token, or server nonce.
171 void FillInDummyReject(CryptoHandshakeMessage* rej, bool reject_is_stateless); 171 void FillInDummyReject(CryptoHandshakeMessage* rej, bool reject_is_stateless);
172 172
173 // ParseTag returns a QuicTag from parsing |tagstr|. |tagstr| may either be 173 // ParseTag returns a QuicTag from parsing |tagstr|. |tagstr| may either be
174 // in the format "EXMP" (i.e. ASCII format), or "#11223344" (an explicit hex 174 // in the format "EXMP" (i.e. ASCII format), or "#11223344" (an explicit hex
175 // format). It CHECK fails if there's a parse error. 175 // format). It CHECK fails if there's a parse error.
176 QuicTag ParseTag(const char* tagstr); 176 QuicTag ParseTag(const char* tagstr);
177 177
178 // Message constructs a handshake message from a variable number of 178 // Message constructs a CHLO message from a provided vector of tag/value pairs.
179 // arguments. |message_tag| is passed to |ParseTag| and used as the tag of 179 // The first of each pair is the tag of a tag/value and is given as an argument
180 // the resulting message. The arguments are taken in pairs and nullptr 180 // to |ParseTag|. The second is the value of the tag/value pair and is either a
181 // terminated. The first of each pair is the tag of a tag/value and is given 181 // hex dump, preceeded by a '#', or a raw value. If minimum_size_bytes is
182 // as an argument to |ParseTag|. The second is the value of the tag/value 182 // provided then the message will be padded to this minimum size.
183 // pair and is either a hex dump, preceeded by a '#', or a raw value.
184 // 183 //
185 // Message( 184 // CreateCHLO(
186 // "CHLO", 185 // {{"NOCE", "#11223344"},
187 // "NOCE", "#11223344", 186 // {"SNI", "www.example.com"}},
188 // "SNI", "www.example.com", 187 // optional_minimum_size_bytes);
189 // nullptr); 188 CryptoHandshakeMessage CreateCHLO(
190 CryptoHandshakeMessage Message(const char* message_tag, ...); 189 std::vector<std::pair<std::string, std::string>> tags_and_values);
190 CryptoHandshakeMessage CreateCHLO(
191 std::vector<std::pair<std::string, std::string>> tags_and_values,
192 int minimum_size_bytes);
191 193
192 // ChannelIDSourceForTesting returns a ChannelIDSource that generates keys 194 // ChannelIDSourceForTesting returns a ChannelIDSource that generates keys
193 // deterministically based on the hostname given in the GetChannelIDKey call. 195 // deterministically based on the hostname given in the GetChannelIDKey call.
194 // This ChannelIDSource works in synchronous mode, i.e., its GetChannelIDKey 196 // This ChannelIDSource works in synchronous mode, i.e., its GetChannelIDKey
195 // method never returns QUIC_PENDING. 197 // method never returns QUIC_PENDING.
196 ChannelIDSource* ChannelIDSourceForTesting(); 198 ChannelIDSource* ChannelIDSourceForTesting();
197 199
198 // MovePackets parses crypto handshake messages from packet number 200 // MovePackets parses crypto handshake messages from packet number
199 // |*inout_packet_index| through to the last packet (or until a packet fails 201 // |*inout_packet_index| through to the last packet (or until a packet fails
200 // to decrypt) and has |dest_stream| process them. |*inout_packet_index| is 202 // to decrypt) and has |dest_stream| process them. |*inout_packet_index| is
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Return a CHLO PUBS in hexadecimal. 236 // Return a CHLO PUBS in hexadecimal.
235 std::string GenerateClientPublicValuesHex(); 237 std::string GenerateClientPublicValuesHex();
236 238
237 } // namespace crypto_test_utils 239 } // namespace crypto_test_utils
238 240
239 } // namespace test 241 } // namespace test
240 242
241 } // namespace net 243 } // namespace net
242 244
243 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ 245 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/core/crypto/crypto_server_test.cc ('k') | net/quic/test_tools/crypto_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698