| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Testing convenience method to construct a QuicAckFrame with all packets | 86 // Testing convenience method to construct a QuicAckFrame with all packets |
| 87 // from least_unacked to largest_observed acked. | 87 // from least_unacked to largest_observed acked. |
| 88 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed, | 88 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed, |
| 89 QuicPacketSequenceNumber least_unacked); | 89 QuicPacketSequenceNumber least_unacked); |
| 90 | 90 |
| 91 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| | 91 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| |
| 92 // nack ranges of width 1 packet, starting from |least_unacked|. | 92 // nack ranges of width 1 packet, starting from |least_unacked|. |
| 93 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, | 93 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, |
| 94 QuicPacketSequenceNumber least_unacked); | 94 QuicPacketSequenceNumber least_unacked); |
| 95 | 95 |
| 96 // Returns a SerializedPacket whose |packet| member is owned by the caller, |
| 97 // and is populated with the fields in |header| and |frames|, or is NULL if |
| 98 // the packet could not be created. |
| 99 SerializedPacket BuildUnsizedDataPacket(QuicFramer* framer, |
| 100 const QuicPacketHeader& header, |
| 101 const QuicFrames& frames); |
| 102 |
| 96 template<typename SaveType> | 103 template<typename SaveType> |
| 97 class ValueRestore { | 104 class ValueRestore { |
| 98 public: | 105 public: |
| 99 ValueRestore(SaveType* name, SaveType value) | 106 ValueRestore(SaveType* name, SaveType value) |
| 100 : name_(name), | 107 : name_(name), |
| 101 value_(*name) { | 108 value_(*name) { |
| 102 *name_ = value; | 109 *name_ = value; |
| 103 } | 110 } |
| 104 ~ValueRestore() { | 111 ~ValueRestore() { |
| 105 *name_ = value_; | 112 *name_ = value_; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 virtual ~MockAckNotifierDelegate(); | 496 virtual ~MockAckNotifierDelegate(); |
| 490 | 497 |
| 491 private: | 498 private: |
| 492 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate); | 499 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate); |
| 493 }; | 500 }; |
| 494 | 501 |
| 495 } // namespace test | 502 } // namespace test |
| 496 } // namespace net | 503 } // namespace net |
| 497 | 504 |
| 498 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 505 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |