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

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

Issue 15937012: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small bug fixes Created 7 years, 6 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 | Annotate | Revision Log
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 19 matching lines...) Expand all
30 const int actual_len, 30 const int actual_len,
31 const char* expected, 31 const char* expected,
32 const int expected_len); 32 const int expected_len);
33 33
34 void CompareQuicDataWithHexError(const std::string& description, 34 void CompareQuicDataWithHexError(const std::string& description,
35 QuicData* actual, 35 QuicData* actual,
36 QuicData* expected); 36 QuicData* expected);
37 37
38 // Returns the length of the QuicPacket that will be created if it contains 38 // Returns the length of the QuicPacket that will be created if it contains
39 // a stream frame that has |payload| bytes. 39 // a stream frame that has |payload| bytes.
40 size_t GetPacketLengthForOneStream(bool include_version, size_t payload); 40 size_t GetPacketLengthForOneStream(
41 bool include_version, InFecGroup is_in_fec_group, size_t payload);
41 42
42 string SerializeUncompressedHeaders(const SpdyHeaderBlock& headers); 43 string SerializeUncompressedHeaders(const SpdyHeaderBlock& headers);
43 44
45 // Returns QuicConfig set to default values.
46 QuicConfig DefaultQuicConfig();
47
44 class MockFramerVisitor : public QuicFramerVisitorInterface { 48 class MockFramerVisitor : public QuicFramerVisitorInterface {
45 public: 49 public:
46 MockFramerVisitor(); 50 MockFramerVisitor();
47 ~MockFramerVisitor(); 51 ~MockFramerVisitor();
48 52
49 MOCK_METHOD1(OnError, void(QuicFramer* framer)); 53 MOCK_METHOD1(OnError, void(QuicFramer* framer));
50 // The constructor sets this up to return false by default. 54 // The constructor sets this up to return false by default.
51 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicTag version)); 55 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicTag version));
52 MOCK_METHOD0(OnPacket, void()); 56 MOCK_METHOD0(OnPacket, void());
53 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header)); 57 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header));
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 private: 315 private:
312 QuicCryptoStream* crypto_stream_; 316 QuicCryptoStream* crypto_stream_;
313 DISALLOW_COPY_AND_ASSIGN(TestSession); 317 DISALLOW_COPY_AND_ASSIGN(TestSession);
314 }; 318 };
315 319
316 class MockSendAlgorithm : public SendAlgorithmInterface { 320 class MockSendAlgorithm : public SendAlgorithmInterface {
317 public: 321 public:
318 MockSendAlgorithm(); 322 MockSendAlgorithm();
319 virtual ~MockSendAlgorithm(); 323 virtual ~MockSendAlgorithm();
320 324
321 MOCK_METHOD4(OnIncomingQuicCongestionFeedbackFrame, 325 MOCK_METHOD3(OnIncomingQuicCongestionFeedbackFrame,
322 void(const QuicCongestionFeedbackFrame&, 326 void(const QuicCongestionFeedbackFrame&,
323 QuicTime feedback_receive_time, 327 QuicTime feedback_receive_time,
324 QuicBandwidth sent_bandwidth,
325 const SentPacketsMap&)); 328 const SentPacketsMap&));
326 MOCK_METHOD3(OnIncomingAck, 329 MOCK_METHOD3(OnIncomingAck,
327 void(QuicPacketSequenceNumber, QuicByteCount, QuicTime::Delta)); 330 void(QuicPacketSequenceNumber, QuicByteCount, QuicTime::Delta));
328 MOCK_METHOD1(OnIncomingLoss, void(QuicTime)); 331 MOCK_METHOD1(OnIncomingLoss, void(QuicTime));
329 MOCK_METHOD4(SentPacket, void(QuicTime sent_time, QuicPacketSequenceNumber, 332 MOCK_METHOD4(SentPacket, void(QuicTime sent_time, QuicPacketSequenceNumber,
330 QuicByteCount, Retransmission)); 333 QuicByteCount, Retransmission));
331 MOCK_METHOD2(AbandoningPacket, void(QuicPacketSequenceNumber sequence_number, 334 MOCK_METHOD2(AbandoningPacket, void(QuicPacketSequenceNumber sequence_number,
332 QuicByteCount abandoned_bytes)); 335 QuicByteCount abandoned_bytes));
333 MOCK_METHOD3(TimeUntilSend, QuicTime::Delta(QuicTime now, Retransmission, 336 MOCK_METHOD3(TimeUntilSend, QuicTime::Delta(QuicTime now, Retransmission,
334 HasRetransmittableData)); 337 HasRetransmittableData));
(...skipping 25 matching lines...) Expand all
360 363
361 private: 364 private:
362 string data_; 365 string data_;
363 bool error_; 366 bool error_;
364 }; 367 };
365 368
366 } // namespace test 369 } // namespace test
367 } // namespace net 370 } // namespace net
368 371
369 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 372 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698