| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "net/quic/core/crypto/crypto_framer.h" | 10 #include "net/quic/core/crypto/crypto_framer.h" |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 QuicVersion QuicVersionMax() { | 547 QuicVersion QuicVersionMax() { |
| 548 return AllSupportedVersions().front(); | 548 return AllSupportedVersions().front(); |
| 549 } | 549 } |
| 550 | 550 |
| 551 QuicVersion QuicVersionMin() { | 551 QuicVersion QuicVersionMin() { |
| 552 return AllSupportedVersions().back(); | 552 return AllSupportedVersions().back(); |
| 553 } | 553 } |
| 554 | 554 |
| 555 QuicEncryptedPacket* ConstructEncryptedPacket(QuicConnectionId connection_id, | 555 QuicEncryptedPacket* ConstructEncryptedPacket(QuicConnectionId connection_id, |
| 556 bool version_flag, | 556 bool version_flag, |
| 557 bool multipath_flag, | |
| 558 bool reset_flag, | 557 bool reset_flag, |
| 559 QuicPacketNumber packet_number, | 558 QuicPacketNumber packet_number, |
| 560 const string& data) { | 559 const string& data) { |
| 561 return ConstructEncryptedPacket( | 560 return ConstructEncryptedPacket( |
| 562 connection_id, version_flag, multipath_flag, reset_flag, packet_number, | 561 connection_id, version_flag, reset_flag, packet_number, data, |
| 563 data, PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER); | 562 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER); |
| 564 } | 563 } |
| 565 | 564 |
| 566 QuicEncryptedPacket* ConstructEncryptedPacket( | 565 QuicEncryptedPacket* ConstructEncryptedPacket( |
| 567 QuicConnectionId connection_id, | 566 QuicConnectionId connection_id, |
| 568 bool version_flag, | 567 bool version_flag, |
| 569 bool multipath_flag, | |
| 570 bool reset_flag, | 568 bool reset_flag, |
| 571 QuicPacketNumber packet_number, | 569 QuicPacketNumber packet_number, |
| 572 const string& data, | 570 const string& data, |
| 573 QuicConnectionIdLength connection_id_length, | 571 QuicConnectionIdLength connection_id_length, |
| 574 QuicPacketNumberLength packet_number_length) { | 572 QuicPacketNumberLength packet_number_length) { |
| 575 return ConstructEncryptedPacket( | 573 return ConstructEncryptedPacket(connection_id, version_flag, reset_flag, |
| 576 connection_id, version_flag, multipath_flag, reset_flag, packet_number, | 574 packet_number, data, connection_id_length, |
| 577 data, connection_id_length, packet_number_length, nullptr); | 575 packet_number_length, nullptr); |
| 578 } | 576 } |
| 579 | 577 |
| 580 QuicEncryptedPacket* ConstructEncryptedPacket( | 578 QuicEncryptedPacket* ConstructEncryptedPacket( |
| 581 QuicConnectionId connection_id, | 579 QuicConnectionId connection_id, |
| 582 bool version_flag, | 580 bool version_flag, |
| 583 bool multipath_flag, | |
| 584 bool reset_flag, | 581 bool reset_flag, |
| 585 QuicPacketNumber packet_number, | 582 QuicPacketNumber packet_number, |
| 586 const string& data, | 583 const string& data, |
| 587 QuicConnectionIdLength connection_id_length, | 584 QuicConnectionIdLength connection_id_length, |
| 588 QuicPacketNumberLength packet_number_length, | 585 QuicPacketNumberLength packet_number_length, |
| 589 QuicVersionVector* versions) { | 586 QuicVersionVector* versions) { |
| 590 return ConstructEncryptedPacket(connection_id, version_flag, multipath_flag, | 587 return ConstructEncryptedPacket(connection_id, version_flag, reset_flag, |
| 591 reset_flag, packet_number, data, | 588 packet_number, data, connection_id_length, |
| 592 connection_id_length, packet_number_length, | 589 packet_number_length, versions, |
| 593 versions, Perspective::IS_CLIENT); | 590 Perspective::IS_CLIENT); |
| 594 } | 591 } |
| 595 QuicEncryptedPacket* ConstructEncryptedPacket( | 592 QuicEncryptedPacket* ConstructEncryptedPacket( |
| 596 QuicConnectionId connection_id, | 593 QuicConnectionId connection_id, |
| 597 bool version_flag, | 594 bool version_flag, |
| 598 bool multipath_flag, | |
| 599 bool reset_flag, | 595 bool reset_flag, |
| 600 QuicPacketNumber packet_number, | 596 QuicPacketNumber packet_number, |
| 601 const string& data, | 597 const string& data, |
| 602 QuicConnectionIdLength connection_id_length, | 598 QuicConnectionIdLength connection_id_length, |
| 603 QuicPacketNumberLength packet_number_length, | 599 QuicPacketNumberLength packet_number_length, |
| 604 QuicVersionVector* versions, | 600 QuicVersionVector* versions, |
| 605 Perspective perspective) { | 601 Perspective perspective) { |
| 606 QuicPacketHeader header; | 602 QuicPacketHeader header; |
| 607 header.public_header.connection_id = connection_id; | 603 header.public_header.connection_id = connection_id; |
| 608 header.public_header.connection_id_length = connection_id_length; | 604 header.public_header.connection_id_length = connection_id_length; |
| 609 header.public_header.version_flag = version_flag; | 605 header.public_header.version_flag = version_flag; |
| 610 header.public_header.multipath_flag = multipath_flag; | 606 header.public_header.multipath_flag = false; |
| 611 header.public_header.reset_flag = reset_flag; | 607 header.public_header.reset_flag = reset_flag; |
| 612 header.public_header.packet_number_length = packet_number_length; | 608 header.public_header.packet_number_length = packet_number_length; |
| 613 header.packet_number = packet_number; | 609 header.packet_number = packet_number; |
| 614 QuicStreamFrame stream_frame(1, false, 0, QuicStringPiece(data)); | 610 QuicStreamFrame stream_frame(1, false, 0, QuicStringPiece(data)); |
| 615 QuicFrame frame(&stream_frame); | 611 QuicFrame frame(&stream_frame); |
| 616 QuicFrames frames; | 612 QuicFrames frames; |
| 617 frames.push_back(frame); | 613 frames.push_back(frame); |
| 618 QuicFramer framer( | 614 QuicFramer framer( |
| 619 versions != nullptr ? *versions : CurrentSupportedVersions(), | 615 versions != nullptr ? *versions : CurrentSupportedVersions(), |
| 620 QuicTime::Zero(), perspective); | 616 QuicTime::Zero(), perspective); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 // strike register worries that we've just overflowed a uint32_t time. | 824 // strike register worries that we've just overflowed a uint32_t time. |
| 829 (*server_connection)->AdvanceTime(connection_start_time); | 825 (*server_connection)->AdvanceTime(connection_start_time); |
| 830 } | 826 } |
| 831 | 827 |
| 832 QuicStreamId QuicClientDataStreamId(int i) { | 828 QuicStreamId QuicClientDataStreamId(int i) { |
| 833 return kClientDataStreamId1 + 2 * i; | 829 return kClientDataStreamId1 + 2 * i; |
| 834 } | 830 } |
| 835 | 831 |
| 836 } // namespace test | 832 } // namespace test |
| 837 } // namespace net | 833 } // namespace net |
| OLD | NEW |