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 #include "net/quic/test_tools/crypto_test_utils.h" | 5 #include "net/quic/test_tools/crypto_test_utils.h" |
6 | 6 |
7 #include "net/quic/crypto/channel_id.h" | 7 #include "net/quic/crypto/channel_id.h" |
8 #include "net/quic/crypto/common_cert_set.h" | 8 #include "net/quic/crypto/common_cert_set.h" |
9 #include "net/quic/crypto/crypto_handshake.h" | 9 #include "net/quic/crypto/crypto_handshake.h" |
10 #include "net/quic/crypto/quic_crypto_server_config.h" | 10 #include "net/quic/crypto/quic_crypto_server_config.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 // static | 220 // static |
221 void CryptoTestUtils::CommunicateHandshakeMessages( | 221 void CryptoTestUtils::CommunicateHandshakeMessages( |
222 PacketSavingConnection* a_conn, | 222 PacketSavingConnection* a_conn, |
223 QuicCryptoStream* a, | 223 QuicCryptoStream* a, |
224 PacketSavingConnection* b_conn, | 224 PacketSavingConnection* b_conn, |
225 QuicCryptoStream* b) { | 225 QuicCryptoStream* b) { |
226 size_t a_i = 0, b_i = 0; | 226 size_t a_i = 0, b_i = 0; |
227 while (!a->handshake_confirmed()) { | 227 while (!a->handshake_confirmed()) { |
228 ASSERT_GT(a_conn->packets_.size(), a_i); | 228 ASSERT_GT(a_conn->packets_.size(), a_i); |
229 LOG(INFO) << "Processing " << a_conn->packets_.size() - a_i | 229 VLOG(0) << "Processing " << a_conn->packets_.size() - a_i |
230 << " packets a->b"; | 230 << " packets a->b"; |
231 MovePackets(a_conn, &a_i, b, b_conn); | 231 MovePackets(a_conn, &a_i, b, b_conn); |
232 | 232 |
233 ASSERT_GT(b_conn->packets_.size(), b_i); | 233 ASSERT_GT(b_conn->packets_.size(), b_i); |
234 LOG(INFO) << "Processing " << b_conn->packets_.size() - b_i | 234 VLOG(0) << "Processing " << b_conn->packets_.size() - b_i |
235 << " packets b->a"; | 235 << " packets b->a"; |
236 if (b_conn->packets_.size() - b_i == 2) { | 236 if (b_conn->packets_.size() - b_i == 2) { |
237 LOG(INFO) << "here"; | 237 VLOG(0) << "here"; |
238 } | 238 } |
239 MovePackets(b_conn, &b_i, a, a_conn); | 239 MovePackets(b_conn, &b_i, a, a_conn); |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 pair<size_t, size_t> CryptoTestUtils::AdvanceHandshake( | 243 pair<size_t, size_t> CryptoTestUtils::AdvanceHandshake( |
244 PacketSavingConnection* a_conn, | 244 PacketSavingConnection* a_conn, |
245 QuicCryptoStream* a, | 245 QuicCryptoStream* a, |
246 size_t a_i, | 246 size_t a_i, |
247 PacketSavingConnection* b_conn, | 247 PacketSavingConnection* b_conn, |
248 QuicCryptoStream* b, | 248 QuicCryptoStream* b, |
249 size_t b_i) { | 249 size_t b_i) { |
250 LOG(INFO) << "Processing " << a_conn->packets_.size() - a_i | 250 VLOG(0) << "Processing " << a_conn->packets_.size() - a_i |
251 << " packets a->b"; | 251 << " packets a->b"; |
252 MovePackets(a_conn, &a_i, b, b_conn); | 252 MovePackets(a_conn, &a_i, b, b_conn); |
253 | 253 |
254 LOG(INFO) << "Processing " << b_conn->packets_.size() - b_i | 254 VLOG(0) << "Processing " << b_conn->packets_.size() - b_i |
255 << " packets b->a"; | 255 << " packets b->a"; |
256 if (b_conn->packets_.size() - b_i == 2) { | 256 if (b_conn->packets_.size() - b_i == 2) { |
257 LOG(INFO) << "here"; | 257 VLOG(0) << "here"; |
258 } | 258 } |
259 MovePackets(b_conn, &b_i, a, a_conn); | 259 MovePackets(b_conn, &b_i, a, a_conn); |
260 | 260 |
261 return make_pair(a_i, b_i); | 261 return make_pair(a_i, b_i); |
262 } | 262 } |
263 | 263 |
264 // static | 264 // static |
265 string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message, | 265 string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message, |
266 QuicTag tag) { | 266 QuicTag tag) { |
267 QuicTagValueMap::const_iterator it = message.tag_value_map().find(tag); | 267 QuicTagValueMap::const_iterator it = message.tag_value_map().find(tag); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); | 520 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); |
521 scoped_ptr<CryptoHandshakeMessage> parsed( | 521 scoped_ptr<CryptoHandshakeMessage> parsed( |
522 CryptoFramer::ParseMessage(bytes->AsStringPiece())); | 522 CryptoFramer::ParseMessage(bytes->AsStringPiece())); |
523 CHECK(parsed.get()); | 523 CHECK(parsed.get()); |
524 | 524 |
525 return *parsed; | 525 return *parsed; |
526 } | 526 } |
527 | 527 |
528 } // namespace test | 528 } // namespace test |
529 } // namespace net | 529 } // namespace net |
OLD | NEW |