| 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 // Common utilities for Quic tests | 5 // Common utilities for Quic tests |
| 6 | 6 |
| 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 // Returns QuicConfig set to default values. | 183 // Returns QuicConfig set to default values. |
| 184 QuicConfig DefaultQuicConfig(); | 184 QuicConfig DefaultQuicConfig(); |
| 185 | 185 |
| 186 // Returns a QuicConfig set to default values that supports stateless rejects. | 186 // Returns a QuicConfig set to default values that supports stateless rejects. |
| 187 QuicConfig DefaultQuicConfigStatelessRejects(); | 187 QuicConfig DefaultQuicConfigStatelessRejects(); |
| 188 | 188 |
| 189 // Returns a version vector consisting of |version|. | 189 // Returns a version vector consisting of |version|. |
| 190 QuicVersionVector SupportedVersions(QuicVersion version); | 190 QuicVersionVector SupportedVersions(QuicVersion version); |
| 191 | 191 |
| 192 // Testing convenience method to construct a QuicAckFrame with entropy_hash set | 192 // Testing convenience method to construct a QuicAckFrame with largest_observed |
| 193 // to 0 and largest_observed from peer set to |largest_observed|. | 193 // from peer set to |largest_observed|. |
| 194 QuicAckFrame MakeAckFrame(QuicPacketNumber largest_observed); | 194 QuicAckFrame MakeAckFrame(QuicPacketNumber largest_observed); |
| 195 | 195 |
| 196 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| | |
| 197 // nack ranges of width 1 packet, starting from |least_unacked|. | |
| 198 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, | |
| 199 QuicPacketNumber least_unacked); | |
| 200 | |
| 201 // Testing convenience method to construct a QuicAckFrame with |num_ack_blocks| | 196 // Testing convenience method to construct a QuicAckFrame with |num_ack_blocks| |
| 202 // ack blocks of width 1 packet, starting from |least_unacked| + 2. | 197 // ack blocks of width 1 packet, starting from |least_unacked| + 2. |
| 203 QuicAckFrame MakeAckFrameWithAckBlocks(size_t num_ack_blocks, | 198 QuicAckFrame MakeAckFrameWithAckBlocks(size_t num_ack_blocks, |
| 204 QuicPacketNumber least_unacked); | 199 QuicPacketNumber least_unacked); |
| 205 | 200 |
| 206 // Returns a QuicPacket that is owned by the caller, and | 201 // Returns a QuicPacket that is owned by the caller, and |
| 207 // is populated with the fields in |header| and |frames|, or is nullptr if the | 202 // is populated with the fields in |header| and |frames|, or is nullptr if the |
| 208 // packet could not be created. | 203 // packet could not be created. |
| 209 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer, | 204 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer, |
| 210 const QuicPacketHeader& header, | 205 const QuicPacketHeader& header, |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 MOCK_METHOD4(SpuriousRetransmitDetected, | 799 MOCK_METHOD4(SpuriousRetransmitDetected, |
| 805 void(const QuicUnackedPacketMap&, | 800 void(const QuicUnackedPacketMap&, |
| 806 QuicTime, | 801 QuicTime, |
| 807 const RttStats&, | 802 const RttStats&, |
| 808 QuicPacketNumber)); | 803 QuicPacketNumber)); |
| 809 | 804 |
| 810 private: | 805 private: |
| 811 DISALLOW_COPY_AND_ASSIGN(MockLossAlgorithm); | 806 DISALLOW_COPY_AND_ASSIGN(MockLossAlgorithm); |
| 812 }; | 807 }; |
| 813 | 808 |
| 814 class TestEntropyCalculator | |
| 815 : public QuicReceivedEntropyHashCalculatorInterface { | |
| 816 public: | |
| 817 TestEntropyCalculator(); | |
| 818 ~TestEntropyCalculator() override; | |
| 819 | |
| 820 QuicPacketEntropyHash EntropyHash( | |
| 821 QuicPacketNumber packet_number) const override; | |
| 822 | |
| 823 private: | |
| 824 DISALLOW_COPY_AND_ASSIGN(TestEntropyCalculator); | |
| 825 }; | |
| 826 | |
| 827 class MockEntropyCalculator : public TestEntropyCalculator { | |
| 828 public: | |
| 829 MockEntropyCalculator(); | |
| 830 ~MockEntropyCalculator() override; | |
| 831 | |
| 832 MOCK_CONST_METHOD1(EntropyHash, | |
| 833 QuicPacketEntropyHash(QuicPacketNumber packet_number)); | |
| 834 | |
| 835 private: | |
| 836 DISALLOW_COPY_AND_ASSIGN(MockEntropyCalculator); | |
| 837 }; | |
| 838 | |
| 839 class MockAckListener : public QuicAckListenerInterface { | 809 class MockAckListener : public QuicAckListenerInterface { |
| 840 public: | 810 public: |
| 841 MockAckListener(); | 811 MockAckListener(); |
| 842 | 812 |
| 843 MOCK_METHOD2(OnPacketAcked, | 813 MOCK_METHOD2(OnPacketAcked, |
| 844 void(int acked_bytes, QuicTime::Delta ack_delay_time)); | 814 void(int acked_bytes, QuicTime::Delta ack_delay_time)); |
| 845 | 815 |
| 846 MOCK_METHOD1(OnPacketRetransmitted, void(int retransmitted_bytes)); | 816 MOCK_METHOD1(OnPacketRetransmitted, void(int retransmitted_bytes)); |
| 847 | 817 |
| 848 protected: | 818 protected: |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 l.OnHeader(p.first, p.second); | 1044 l.OnHeader(p.first, p.second); |
| 1075 } | 1045 } |
| 1076 l.OnHeaderBlockEnd(total_size); | 1046 l.OnHeaderBlockEnd(total_size); |
| 1077 return l; | 1047 return l; |
| 1078 } | 1048 } |
| 1079 | 1049 |
| 1080 } // namespace test | 1050 } // namespace test |
| 1081 } // namespace net | 1051 } // namespace net |
| 1082 | 1052 |
| 1083 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 1053 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |