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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
14 #include "net/quic/congestion_control/send_algorithm_interface.h" | 14 #include "net/quic/congestion_control/send_algorithm_interface.h" |
15 #include "net/quic/quic_connection.h" | 15 #include "net/quic/quic_connection.h" |
16 #include "net/quic/quic_framer.h" | 16 #include "net/quic/quic_framer.h" |
17 #include "net/quic/quic_session.h" | 17 #include "net/quic/quic_session.h" |
18 #include "net/quic/quic_spdy_decompressor.h" | 18 #include "net/quic/quic_spdy_decompressor.h" |
19 #include "net/quic/test_tools/mock_clock.h" | 19 #include "net/quic/test_tools/mock_clock.h" |
20 #include "net/quic/test_tools/mock_random.h" | 20 #include "net/quic/test_tools/mock_random.h" |
21 #include "net/spdy/spdy_framer.h" | 21 #include "net/spdy/spdy_framer.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 namespace test { | 26 namespace test { |
27 | 27 |
| 28 // Upper limit on versions we support. |
| 29 QuicVersion QuicVersionMax(); |
| 30 |
| 31 // Lower limit on versions we support. |
| 32 QuicVersion QuicVersionMin(); |
| 33 |
28 void CompareCharArraysWithHexError(const std::string& description, | 34 void CompareCharArraysWithHexError(const std::string& description, |
29 const char* actual, | 35 const char* actual, |
30 const int actual_len, | 36 const int actual_len, |
31 const char* expected, | 37 const char* expected, |
32 const int expected_len); | 38 const int expected_len); |
33 | 39 |
34 // Returns the length of a QuicPacket that is capable of holding either a | 40 // Returns the length of a QuicPacket that is capable of holding either a |
35 // stream frame or a minimal ack frame. Sets |*payload_length| to the number | 41 // stream frame or a minimal ack frame. Sets |*payload_length| to the number |
36 // of bytes of stream data that will fit in such a packet. | 42 // of bytes of stream data that will fit in such a packet. |
37 size_t GetPacketLengthForOneStream( | 43 size_t GetPacketLengthForOneStream( |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 bool(QuicTime sent_time, QuicPacketSequenceNumber, QuicByteCount, | 359 bool(QuicTime sent_time, QuicPacketSequenceNumber, QuicByteCount, |
354 TransmissionType, HasRetransmittableData)); | 360 TransmissionType, HasRetransmittableData)); |
355 MOCK_METHOD2(OnPacketAbandoned, void(QuicPacketSequenceNumber sequence_number, | 361 MOCK_METHOD2(OnPacketAbandoned, void(QuicPacketSequenceNumber sequence_number, |
356 QuicByteCount abandoned_bytes)); | 362 QuicByteCount abandoned_bytes)); |
357 MOCK_METHOD4(TimeUntilSend, QuicTime::Delta(QuicTime now, TransmissionType, | 363 MOCK_METHOD4(TimeUntilSend, QuicTime::Delta(QuicTime now, TransmissionType, |
358 HasRetransmittableData, | 364 HasRetransmittableData, |
359 IsHandshake)); | 365 IsHandshake)); |
360 MOCK_METHOD0(BandwidthEstimate, QuicBandwidth(void)); | 366 MOCK_METHOD0(BandwidthEstimate, QuicBandwidth(void)); |
361 MOCK_METHOD0(SmoothedRtt, QuicTime::Delta(void)); | 367 MOCK_METHOD0(SmoothedRtt, QuicTime::Delta(void)); |
362 MOCK_METHOD0(RetransmissionDelay, QuicTime::Delta(void)); | 368 MOCK_METHOD0(RetransmissionDelay, QuicTime::Delta(void)); |
| 369 MOCK_METHOD0(GetCongestionWindow, QuicByteCount()); |
| 370 MOCK_METHOD1(SetCongestionWindow, void(QuicByteCount)); |
363 | 371 |
364 private: | 372 private: |
365 DISALLOW_COPY_AND_ASSIGN(MockSendAlgorithm); | 373 DISALLOW_COPY_AND_ASSIGN(MockSendAlgorithm); |
366 }; | 374 }; |
367 | 375 |
368 class TestEntropyCalculator : | 376 class TestEntropyCalculator : |
369 public QuicReceivedEntropyHashCalculatorInterface { | 377 public QuicReceivedEntropyHashCalculatorInterface { |
370 public: | 378 public: |
371 TestEntropyCalculator() { } | 379 TestEntropyCalculator() { } |
372 virtual ~TestEntropyCalculator() { } | 380 virtual ~TestEntropyCalculator() { } |
(...skipping 21 matching lines...) Expand all Loading... |
394 MockAckNotifierDelegate(); | 402 MockAckNotifierDelegate(); |
395 virtual ~MockAckNotifierDelegate(); | 403 virtual ~MockAckNotifierDelegate(); |
396 | 404 |
397 MOCK_METHOD0(OnAckNotification, void()); | 405 MOCK_METHOD0(OnAckNotification, void()); |
398 }; | 406 }; |
399 | 407 |
400 } // namespace test | 408 } // namespace test |
401 } // namespace net | 409 } // namespace net |
402 | 410 |
403 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 411 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |