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

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

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 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/test_tools/crypto_test_utils.h ('k') | net/quic/test_tools/fake_proof_source.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 #include "net/quic/test_tools/crypto_test_utils.h" 5 #include "net/quic/test_tools/crypto_test_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "crypto/openssl_util.h" 9 #include "crypto/openssl_util.h"
10 #include "crypto/secure_hash.h" 10 #include "crypto/secure_hash.h"
11 #include "net/quic/core/crypto/channel_id.h" 11 #include "net/quic/core/crypto/channel_id.h"
12 #include "net/quic/core/crypto/common_cert_set.h" 12 #include "net/quic/core/crypto/common_cert_set.h"
13 #include "net/quic/core/crypto/crypto_handshake.h" 13 #include "net/quic/core/crypto/crypto_handshake.h"
14 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" 14 #include "net/quic/core/crypto/crypto_server_config_protobuf.h"
15 #include "net/quic/core/crypto/quic_crypto_server_config.h" 15 #include "net/quic/core/crypto/quic_crypto_server_config.h"
16 #include "net/quic/core/crypto/quic_decrypter.h" 16 #include "net/quic/core/crypto/quic_decrypter.h"
17 #include "net/quic/core/crypto/quic_encrypter.h" 17 #include "net/quic/core/crypto/quic_encrypter.h"
18 #include "net/quic/core/crypto/quic_random.h" 18 #include "net/quic/core/crypto/quic_random.h"
19 #include "net/quic/core/quic_crypto_client_stream.h" 19 #include "net/quic/core/quic_crypto_client_stream.h"
20 #include "net/quic/core/quic_crypto_server_stream.h" 20 #include "net/quic/core/quic_crypto_server_stream.h"
21 #include "net/quic/core/quic_crypto_stream.h" 21 #include "net/quic/core/quic_crypto_stream.h"
22 #include "net/quic/core/quic_server_id.h" 22 #include "net/quic/core/quic_server_id.h"
23 #include "net/quic/core/quic_utils.h" 23 #include "net/quic/core/quic_utils.h"
24 #include "net/quic/platform/api/quic_clock.h" 24 #include "net/quic/platform/api/quic_clock.h"
25 #include "net/quic/platform/api/quic_logging.h"
25 #include "net/quic/platform/api/quic_socket_address.h" 26 #include "net/quic/platform/api/quic_socket_address.h"
26 #include "net/quic/platform/api/quic_text_utils.h" 27 #include "net/quic/platform/api/quic_text_utils.h"
27 #include "net/quic/test_tools/quic_connection_peer.h" 28 #include "net/quic/test_tools/quic_connection_peer.h"
28 #include "net/quic/test_tools/quic_framer_peer.h" 29 #include "net/quic/test_tools/quic_framer_peer.h"
29 #include "net/quic/test_tools/quic_test_utils.h" 30 #include "net/quic/test_tools/quic_test_utils.h"
30 #include "net/quic/test_tools/simple_quic_framer.h" 31 #include "net/quic/test_tools/simple_quic_framer.h"
31 #include "third_party/boringssl/src/include/openssl/bn.h" 32 #include "third_party/boringssl/src/include/openssl/bn.h"
32 #include "third_party/boringssl/src/include/openssl/ec.h" 33 #include "third_party/boringssl/src/include/openssl/ec.h"
33 #include "third_party/boringssl/src/include/openssl/ecdsa.h" 34 #include "third_party/boringssl/src/include/openssl/ecdsa.h"
34 #include "third_party/boringssl/src/include/openssl/evp.h" 35 #include "third_party/boringssl/src/include/openssl/evp.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // static 507 // static
507 void CryptoTestUtils::CommunicateHandshakeMessagesAndRunCallbacks( 508 void CryptoTestUtils::CommunicateHandshakeMessagesAndRunCallbacks(
508 PacketSavingConnection* client_conn, 509 PacketSavingConnection* client_conn,
509 QuicCryptoStream* client, 510 QuicCryptoStream* client,
510 PacketSavingConnection* server_conn, 511 PacketSavingConnection* server_conn,
511 QuicCryptoStream* server, 512 QuicCryptoStream* server,
512 CallbackSource* callback_source) { 513 CallbackSource* callback_source) {
513 size_t client_i = 0, server_i = 0; 514 size_t client_i = 0, server_i = 0;
514 while (!client->handshake_confirmed()) { 515 while (!client->handshake_confirmed()) {
515 ASSERT_GT(client_conn->encrypted_packets_.size(), client_i); 516 ASSERT_GT(client_conn->encrypted_packets_.size(), client_i);
516 VLOG(1) << "Processing " 517 QUIC_LOG(INFO) << "Processing "
517 << client_conn->encrypted_packets_.size() - client_i 518 << client_conn->encrypted_packets_.size() - client_i
518 << " packets client->server"; 519 << " packets client->server";
519 MovePackets(client_conn, &client_i, server, server_conn, 520 MovePackets(client_conn, &client_i, server, server_conn,
520 Perspective::IS_SERVER); 521 Perspective::IS_SERVER);
521 if (callback_source) { 522 if (callback_source) {
522 callback_source->RunPendingCallbacks(); 523 callback_source->RunPendingCallbacks();
523 } 524 }
524 525
525 ASSERT_GT(server_conn->encrypted_packets_.size(), server_i); 526 ASSERT_GT(server_conn->encrypted_packets_.size(), server_i);
526 VLOG(1) << "Processing " 527 QUIC_LOG(INFO) << "Processing "
527 << server_conn->encrypted_packets_.size() - server_i 528 << server_conn->encrypted_packets_.size() - server_i
528 << " packets server->client"; 529 << " packets server->client";
529 MovePackets(server_conn, &server_i, client, client_conn, 530 MovePackets(server_conn, &server_i, client, client_conn,
530 Perspective::IS_CLIENT); 531 Perspective::IS_CLIENT);
531 if (callback_source) { 532 if (callback_source) {
532 callback_source->RunPendingCallbacks(); 533 callback_source->RunPendingCallbacks();
533 } 534 }
534 } 535 }
535 } 536 }
536 537
537 // static 538 // static
538 std::pair<size_t, size_t> CryptoTestUtils::AdvanceHandshake( 539 std::pair<size_t, size_t> CryptoTestUtils::AdvanceHandshake(
539 PacketSavingConnection* client_conn, 540 PacketSavingConnection* client_conn,
540 QuicCryptoStream* client, 541 QuicCryptoStream* client,
541 size_t client_i, 542 size_t client_i,
542 PacketSavingConnection* server_conn, 543 PacketSavingConnection* server_conn,
543 QuicCryptoStream* server, 544 QuicCryptoStream* server,
544 size_t server_i) { 545 size_t server_i) {
545 VLOG(1) << "Processing " << client_conn->encrypted_packets_.size() - client_i 546 QUIC_LOG(INFO) << "Processing "
546 << " packets client->server"; 547 << client_conn->encrypted_packets_.size() - client_i
548 << " packets client->server";
547 MovePackets(client_conn, &client_i, server, server_conn, 549 MovePackets(client_conn, &client_i, server, server_conn,
548 Perspective::IS_SERVER); 550 Perspective::IS_SERVER);
549 551
550 VLOG(1) << "Processing " << server_conn->encrypted_packets_.size() - server_i 552 QUIC_LOG(INFO) << "Processing "
551 << " packets server->client"; 553 << server_conn->encrypted_packets_.size() - server_i
554 << " packets server->client";
552 if (server_conn->encrypted_packets_.size() - server_i == 2) { 555 if (server_conn->encrypted_packets_.size() - server_i == 2) {
553 VLOG(1) << "here"; 556 QUIC_LOG(INFO) << "here";
554 } 557 }
555 MovePackets(server_conn, &server_i, client, client_conn, 558 MovePackets(server_conn, &server_i, client, client_conn,
556 Perspective::IS_CLIENT); 559 Perspective::IS_CLIENT);
557 560
558 return std::make_pair(client_i, server_i); 561 return std::make_pair(client_i, server_i);
559 } 562 }
560 563
561 // static 564 // static
562 string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message, 565 string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message,
563 QuicTag tag) { 566 QuicTag tag) {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 // Pass a inchoate CHLO. 1018 // Pass a inchoate CHLO.
1016 FullChloGenerator generator(crypto_config, server_addr, client_addr, clock, 1019 FullChloGenerator generator(crypto_config, server_addr, client_addr, clock,
1017 proof, compressed_certs_cache, out); 1020 proof, compressed_certs_cache, out);
1018 crypto_config->ValidateClientHello( 1021 crypto_config->ValidateClientHello(
1019 inchoate_chlo, client_addr.host(), server_addr, version, clock, proof, 1022 inchoate_chlo, client_addr.host(), server_addr, version, clock, proof,
1020 generator.GetValidateClientHelloCallback()); 1023 generator.GetValidateClientHelloCallback());
1021 } 1024 }
1022 1025
1023 } // namespace test 1026 } // namespace test
1024 } // namespace net 1027 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/crypto_test_utils.h ('k') | net/quic/test_tools/fake_proof_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698