| 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/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "net/quic/core/crypto/crypto_framer.h" | 10 #include "net/quic/core/crypto/crypto_framer.h" |
| 11 #include "net/quic/core/crypto/crypto_handshake.h" | 11 #include "net/quic/core/crypto/crypto_handshake.h" |
| 12 #include "net/quic/core/crypto/crypto_utils.h" | 12 #include "net/quic/core/crypto/crypto_utils.h" |
| 13 #include "net/quic/core/crypto/null_encrypter.h" | 13 #include "net/quic/core/crypto/null_encrypter.h" |
| 14 #include "net/quic/core/crypto/quic_decrypter.h" | 14 #include "net/quic/core/crypto/quic_decrypter.h" |
| 15 #include "net/quic/core/crypto/quic_encrypter.h" | 15 #include "net/quic/core/crypto/quic_encrypter.h" |
| 16 #include "net/quic/core/quic_data_writer.h" | 16 #include "net/quic/core/quic_data_writer.h" |
| 17 #include "net/quic/core/quic_framer.h" | 17 #include "net/quic/core/quic_framer.h" |
| 18 #include "net/quic/core/quic_packet_creator.h" | 18 #include "net/quic/core/quic_packet_creator.h" |
| 19 #include "net/quic/core/quic_utils.h" | 19 #include "net/quic/core/quic_utils.h" |
| 20 #include "net/quic/platform/api/quic_logging.h" |
| 20 #include "net/quic/test_tools/crypto_test_utils.h" | 21 #include "net/quic/test_tools/crypto_test_utils.h" |
| 21 #include "net/quic/test_tools/quic_connection_peer.h" | 22 #include "net/quic/test_tools/quic_connection_peer.h" |
| 22 #include "net/spdy/spdy_frame_builder.h" | 23 #include "net/spdy/spdy_frame_builder.h" |
| 23 #include "net/tools/quic/quic_per_connection_packet_writer.h" | 24 #include "net/tools/quic/quic_per_connection_packet_writer.h" |
| 24 #include "third_party/boringssl/src/include/openssl/sha.h" | 25 #include "third_party/boringssl/src/include/openssl/sha.h" |
| 25 | 26 |
| 26 using base::StringPiece; | 27 using base::StringPiece; |
| 27 using std::string; | 28 using std::string; |
| 28 using testing::Invoke; | 29 using testing::Invoke; |
| 29 using testing::_; | 30 using testing::_; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 QuicServerSessionBase::GetCryptoStream()); | 438 QuicServerSessionBase::GetCryptoStream()); |
| 438 } | 439 } |
| 439 | 440 |
| 440 TestPushPromiseDelegate::TestPushPromiseDelegate(bool match) | 441 TestPushPromiseDelegate::TestPushPromiseDelegate(bool match) |
| 441 : match_(match), rendezvous_fired_(false), rendezvous_stream_(nullptr) {} | 442 : match_(match), rendezvous_fired_(false), rendezvous_stream_(nullptr) {} |
| 442 | 443 |
| 443 bool TestPushPromiseDelegate::CheckVary( | 444 bool TestPushPromiseDelegate::CheckVary( |
| 444 const SpdyHeaderBlock& client_request, | 445 const SpdyHeaderBlock& client_request, |
| 445 const SpdyHeaderBlock& promise_request, | 446 const SpdyHeaderBlock& promise_request, |
| 446 const SpdyHeaderBlock& promise_response) { | 447 const SpdyHeaderBlock& promise_response) { |
| 447 DVLOG(1) << "match " << match_; | 448 QUIC_DVLOG(1) << "match " << match_; |
| 448 return match_; | 449 return match_; |
| 449 } | 450 } |
| 450 | 451 |
| 451 void TestPushPromiseDelegate::OnRendezvousResult(QuicSpdyStream* stream) { | 452 void TestPushPromiseDelegate::OnRendezvousResult(QuicSpdyStream* stream) { |
| 452 rendezvous_fired_ = true; | 453 rendezvous_fired_ = true; |
| 453 rendezvous_stream_ = stream; | 454 rendezvous_stream_ = stream; |
| 454 } | 455 } |
| 455 | 456 |
| 456 TestQuicSpdyClientSession::TestQuicSpdyClientSession( | 457 TestQuicSpdyClientSession::TestQuicSpdyClientSession( |
| 457 QuicConnection* connection, | 458 QuicConnection* connection, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 503 |
| 503 string HexDumpWithMarks(const char* data, | 504 string HexDumpWithMarks(const char* data, |
| 504 int length, | 505 int length, |
| 505 const bool* marks, | 506 const bool* marks, |
| 506 int mark_length) { | 507 int mark_length) { |
| 507 static const char kHexChars[] = "0123456789abcdef"; | 508 static const char kHexChars[] = "0123456789abcdef"; |
| 508 static const int kColumns = 4; | 509 static const int kColumns = 4; |
| 509 | 510 |
| 510 const int kSizeLimit = 1024; | 511 const int kSizeLimit = 1024; |
| 511 if (length > kSizeLimit || mark_length > kSizeLimit) { | 512 if (length > kSizeLimit || mark_length > kSizeLimit) { |
| 512 LOG(ERROR) << "Only dumping first " << kSizeLimit << " bytes."; | 513 QUIC_LOG(ERROR) << "Only dumping first " << kSizeLimit << " bytes."; |
| 513 length = std::min(length, kSizeLimit); | 514 length = std::min(length, kSizeLimit); |
| 514 mark_length = std::min(mark_length, kSizeLimit); | 515 mark_length = std::min(mark_length, kSizeLimit); |
| 515 } | 516 } |
| 516 | 517 |
| 517 string hex; | 518 string hex; |
| 518 for (const char *row = data; length > 0; | 519 for (const char *row = data; length > 0; |
| 519 row += kColumns, length -= kColumns) { | 520 row += kColumns, length -= kColumns) { |
| 520 for (const char* p = row; p < row + 4; ++p) { | 521 for (const char* p = row; p < row + 4; ++p) { |
| 521 if (p < row + length) { | 522 if (p < row + length) { |
| 522 const bool mark = | 523 const bool mark = |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 // strike register worries that we've just overflowed a uint32_t time. | 891 // strike register worries that we've just overflowed a uint32_t time. |
| 891 (*server_connection)->AdvanceTime(connection_start_time); | 892 (*server_connection)->AdvanceTime(connection_start_time); |
| 892 } | 893 } |
| 893 | 894 |
| 894 QuicStreamId QuicClientDataStreamId(int i) { | 895 QuicStreamId QuicClientDataStreamId(int i) { |
| 895 return kClientDataStreamId1 + 2 * i; | 896 return kClientDataStreamId1 + 2 * i; |
| 896 } | 897 } |
| 897 | 898 |
| 898 } // namespace test | 899 } // namespace test |
| 899 } // namespace net | 900 } // namespace net |
| OLD | NEW |