Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: net/quic/test_tools/quic_test_utils.h

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/test_tools/quic_test_packet_maker.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 // Testing convenience method to construct a QuicAckFrame with entropy_hash set 97 // Testing convenience method to construct a QuicAckFrame with entropy_hash set
98 // to 0 and largest_observed from peer set to |largest_observed|. 98 // to 0 and largest_observed from peer set to |largest_observed|.
99 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed); 99 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed);
100 100
101 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| 101 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges|
102 // nack ranges of width 1 packet, starting from |least_unacked|. 102 // nack ranges of width 1 packet, starting from |least_unacked|.
103 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, 103 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges,
104 QuicPacketSequenceNumber least_unacked); 104 QuicPacketSequenceNumber least_unacked);
105 105
106 // Returns a SerializedPacket whose |packet| member is owned by the caller, and 106 // Returns a QuicPacket that is owned by the caller, and
107 // is populated with the fields in |header| and |frames|, or is nullptr if the 107 // is populated with the fields in |header| and |frames|, or is nullptr if the
108 // packet could not be created. 108 // packet could not be created.
109 SerializedPacket BuildUnsizedDataPacket(QuicFramer* framer, 109 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer,
110 const QuicPacketHeader& header, 110 const QuicPacketHeader& header,
111 const QuicFrames& frames); 111 const QuicFrames& frames);
112 // Returns a QuicPacket that is owned by the caller, and of size |packet_size|.
113 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer,
114 const QuicPacketHeader& header,
115 const QuicFrames& frames,
116 size_t packet_size);
112 117
113 template<typename SaveType> 118 template<typename SaveType>
114 class ValueRestore { 119 class ValueRestore {
115 public: 120 public:
116 ValueRestore(SaveType* name, SaveType value) 121 ValueRestore(SaveType* name, SaveType value)
117 : name_(name), 122 : name_(name),
118 value_(*name) { 123 value_(*name) {
119 *name_ = value; 124 *name_ = value;
120 } 125 }
121 ~ValueRestore() { 126 ~ValueRestore() {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 public: 343 public:
339 explicit PacketSavingConnection(bool is_server); 344 explicit PacketSavingConnection(bool is_server);
340 345
341 PacketSavingConnection(bool is_server, 346 PacketSavingConnection(bool is_server,
342 const QuicVersionVector& supported_versions); 347 const QuicVersionVector& supported_versions);
343 348
344 ~PacketSavingConnection() override; 349 ~PacketSavingConnection() override;
345 350
346 void SendOrQueuePacket(QueuedPacket packet) override; 351 void SendOrQueuePacket(QueuedPacket packet) override;
347 352
348 std::vector<QuicPacket*> packets_;
349 std::vector<QuicEncryptedPacket*> encrypted_packets_; 353 std::vector<QuicEncryptedPacket*> encrypted_packets_;
350 354
351 private: 355 private:
352 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection); 356 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection);
353 }; 357 };
354 358
355 class MockSession : public QuicSession { 359 class MockSession : public QuicSession {
356 public: 360 public:
357 explicit MockSession(QuicConnection* connection); 361 explicit MockSession(QuicConnection* connection);
358 ~MockSession() override; 362 ~MockSession() override;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // clears the pointer to it to prevent use-after-free. 598 // clears the pointer to it to prevent use-after-free.
595 void Unregister(PerConnectionPacketWriter* writer); 599 void Unregister(PerConnectionPacketWriter* writer);
596 600
597 PerConnectionPacketWriter* current_writer_; 601 PerConnectionPacketWriter* current_writer_;
598 }; 602 };
599 603
600 } // namespace test 604 } // namespace test
601 } // namespace net 605 } // namespace net
602 606
603 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 607 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_packet_maker.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698