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 <stddef.h> | 10 #include <stddef.h> |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 const QuicPacketHeader& header, | 893 const QuicPacketHeader& header, |
894 QuicTime receipt_time)); | 894 QuicTime receipt_time)); |
895 MOCK_METHOD1(IsMissing, bool(QuicPacketNumber packet_number)); | 895 MOCK_METHOD1(IsMissing, bool(QuicPacketNumber packet_number)); |
896 MOCK_METHOD1(IsAwaitingPacket, bool(QuicPacketNumber packet_number)); | 896 MOCK_METHOD1(IsAwaitingPacket, bool(QuicPacketNumber packet_number)); |
897 MOCK_METHOD1(UpdatePacketInformationSentByPeer, | 897 MOCK_METHOD1(UpdatePacketInformationSentByPeer, |
898 void(const QuicStopWaitingFrame& stop_waiting)); | 898 void(const QuicStopWaitingFrame& stop_waiting)); |
899 MOCK_CONST_METHOD0(HasNewMissingPackets, bool(void)); | 899 MOCK_CONST_METHOD0(HasNewMissingPackets, bool(void)); |
900 MOCK_CONST_METHOD0(ack_frame_updated, bool(void)); | 900 MOCK_CONST_METHOD0(ack_frame_updated, bool(void)); |
901 }; | 901 }; |
902 | 902 |
| 903 class MockSentPacketManager : public QuicSentPacketManagerInterface { |
| 904 public: |
| 905 MockSentPacketManager(); |
| 906 ~MockSentPacketManager() override; |
| 907 |
| 908 MOCK_METHOD1(SetFromConfig, void(const QuicConfig&)); |
| 909 MOCK_METHOD2(ResumeConnectionState, |
| 910 void(const CachedNetworkParameters&, bool)); |
| 911 MOCK_METHOD1(SetNumOpenStreams, void(size_t)); |
| 912 MOCK_METHOD1(SetMaxPacingRate, void(QuicBandwidth)); |
| 913 MOCK_METHOD0(SetHandshakeConfirmed, void(void)); |
| 914 MOCK_METHOD2(OnIncomingAck, void(const QuicAckFrame&, QuicTime)); |
| 915 MOCK_CONST_METHOD2(IsUnacked, bool(QuicPathId, QuicPacketNumber)); |
| 916 MOCK_CONST_METHOD2(HasRetransmittableFrames, |
| 917 bool(QuicPathId, QuicPacketNumber)); |
| 918 MOCK_METHOD1(RetransmitUnackedPackets, void(TransmissionType)); |
| 919 MOCK_METHOD0(MaybeRetransmitTailLossProbe, bool(void)); |
| 920 MOCK_METHOD0(NeuterUnencryptedPackets, void(void)); |
| 921 MOCK_CONST_METHOD0(HasPendingRetransmissions, bool(void)); |
| 922 MOCK_METHOD0(NextPendingRetransmission, PendingRetransmission(void)); |
| 923 MOCK_CONST_METHOD0(HasUnackedPackets, bool(void)); |
| 924 MOCK_CONST_METHOD1(GetLeastUnacked, QuicPacketNumber(QuicPathId)); |
| 925 MOCK_METHOD6(OnPacketSent, |
| 926 bool(SerializedPacket*, |
| 927 QuicPathId, |
| 928 QuicPacketNumber, |
| 929 QuicTime, |
| 930 TransmissionType, |
| 931 HasRetransmittableData)); |
| 932 MOCK_METHOD0(OnRetransmissionTimeout, void(void)); |
| 933 MOCK_METHOD3(TimeUntilSend, |
| 934 QuicTime::Delta(QuicTime, HasRetransmittableData, QuicPathId*)); |
| 935 MOCK_CONST_METHOD0(GetRetransmissionTime, const QuicTime(void)); |
| 936 MOCK_CONST_METHOD0(GetRttStats, const RttStats*(void)); |
| 937 MOCK_CONST_METHOD0(BandwidthEstimate, QuicBandwidth(void)); |
| 938 MOCK_CONST_METHOD0(SustainedBandwidthRecorder, |
| 939 const QuicSustainedBandwidthRecorder*(void)); |
| 940 MOCK_CONST_METHOD0(GetCongestionWindowInTcpMss, QuicPacketCount(void)); |
| 941 MOCK_CONST_METHOD1(EstimateMaxPacketsInFlight, |
| 942 QuicPacketCount(QuicByteCount)); |
| 943 MOCK_CONST_METHOD0(GetCongestionWindowInBytes, QuicByteCount(void)); |
| 944 MOCK_CONST_METHOD0(GetSlowStartThresholdInTcpMss, QuicPacketCount(void)); |
| 945 MOCK_METHOD1(CancelRetransmissionsForStream, void(QuicStreamId)); |
| 946 MOCK_METHOD2(OnConnectionMigration, void(QuicPathId, PeerAddressChangeType)); |
| 947 MOCK_CONST_METHOD0(IsHandshakeConfirmed, bool(void)); |
| 948 MOCK_METHOD1(SetDebugDelegate, void(DebugDelegate*)); |
| 949 MOCK_CONST_METHOD1(GetLargestObserved, QuicPacketNumber(QuicPathId)); |
| 950 MOCK_CONST_METHOD1(GetLargestSentPacket, QuicPacketNumber(QuicPathId)); |
| 951 MOCK_CONST_METHOD1(GetLeastPacketAwaitedByPeer, QuicPacketNumber(QuicPathId)); |
| 952 MOCK_METHOD1(SetNetworkChangeVisitor, void(NetworkChangeVisitor*)); |
| 953 MOCK_CONST_METHOD0(InSlowStart, bool(void)); |
| 954 MOCK_CONST_METHOD0(GetConsecutiveRtoCount, size_t(void)); |
| 955 MOCK_CONST_METHOD0(GetConsecutiveTlpCount, size_t(void)); |
| 956 }; |
| 957 |
| 958 class MockConnectionCloseDelegate |
| 959 : public QuicConnectionCloseDelegateInterface { |
| 960 public: |
| 961 MockConnectionCloseDelegate(); |
| 962 ~MockConnectionCloseDelegate() override; |
| 963 |
| 964 MOCK_METHOD3(OnUnrecoverableError, |
| 965 void(QuicErrorCode, |
| 966 const std::string&, |
| 967 ConnectionCloseSource source)); |
| 968 }; |
| 969 |
903 // Creates a client session for testing. | 970 // Creates a client session for testing. |
904 // | 971 // |
905 // server_id: The server id associated with this stream. | 972 // server_id: The server id associated with this stream. |
906 // supports_stateless_rejects: Does this client support stateless rejects. | 973 // supports_stateless_rejects: Does this client support stateless rejects. |
907 // connection_start_time: The time to set for the connection clock. | 974 // connection_start_time: The time to set for the connection clock. |
908 // Needed for strike-register nonce verification. The client | 975 // Needed for strike-register nonce verification. The client |
909 // connection_start_time should be synchronized witht the server | 976 // connection_start_time should be synchronized witht the server |
910 // start time, otherwise nonce verification will fail. | 977 // start time, otherwise nonce verification will fail. |
911 // supported_versions: Set of QUIC versions this client supports. | 978 // supported_versions: Set of QUIC versions this client supports. |
912 // helper: Pointer to the MockQuicConnectionHelper to use for the session. | 979 // helper: Pointer to the MockQuicConnectionHelper to use for the session. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 TestQuicSpdyServerSession** server_session); | 1020 TestQuicSpdyServerSession** server_session); |
954 | 1021 |
955 // Helper to generate client side stream ids, generalizes | 1022 // Helper to generate client side stream ids, generalizes |
956 // kClientDataStreamId1 etc. above. | 1023 // kClientDataStreamId1 etc. above. |
957 QuicStreamId QuicClientDataStreamId(int i); | 1024 QuicStreamId QuicClientDataStreamId(int i); |
958 | 1025 |
959 } // namespace test | 1026 } // namespace test |
960 } // namespace net | 1027 } // namespace net |
961 | 1028 |
962 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 1029 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |