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 <string> | 10 #include <string> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Testing convenience method to construct a QuicAckFrame with entropy_hash set | 95 // Testing convenience method to construct a QuicAckFrame with entropy_hash set |
96 // to 0 and largest_observed from peer set to |largest_observed|. | 96 // to 0 and largest_observed from peer set to |largest_observed|. |
97 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed); | 97 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed); |
98 | 98 |
99 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| | 99 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| |
100 // nack ranges of width 1 packet, starting from |least_unacked|. | 100 // nack ranges of width 1 packet, starting from |least_unacked|. |
101 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, | 101 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, |
102 QuicPacketSequenceNumber least_unacked); | 102 QuicPacketSequenceNumber least_unacked); |
103 | 103 |
104 // Returns a SerializedPacket whose |packet| member is owned by the caller, and | 104 // Returns a SerializedPacket whose |packet| member is owned by the caller, and |
105 // is populated with the fields in |header| and |frames|, or is NULL if the | 105 // is populated with the fields in |header| and |frames|, or is nullptr if the |
106 // packet could not be created. | 106 // packet could not be created. |
107 SerializedPacket BuildUnsizedDataPacket(QuicFramer* framer, | 107 SerializedPacket BuildUnsizedDataPacket(QuicFramer* framer, |
108 const QuicPacketHeader& header, | 108 const QuicPacketHeader& header, |
109 const QuicFrames& frames); | 109 const QuicFrames& frames); |
110 | 110 |
111 template<typename SaveType> | 111 template<typename SaveType> |
112 class ValueRestore { | 112 class ValueRestore { |
113 public: | 113 public: |
114 ValueRestore(SaveType* name, SaveType value) | 114 ValueRestore(SaveType* name, SaveType value) |
115 : name_(name), | 115 : name_(name), |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // clears the pointer to it to prevent use-after-free. | 582 // clears the pointer to it to prevent use-after-free. |
583 void Unregister(PerConnectionPacketWriter* writer); | 583 void Unregister(PerConnectionPacketWriter* writer); |
584 | 584 |
585 PerConnectionPacketWriter* current_writer_; | 585 PerConnectionPacketWriter* current_writer_; |
586 }; | 586 }; |
587 | 587 |
588 } // namespace test | 588 } // namespace test |
589 } // namespace net | 589 } // namespace net |
590 | 590 |
591 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 591 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |