| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 MOCK_METHOD1(OnUnauthenticatedHeader, bool(const QuicPacketHeader& header)); | 101 MOCK_METHOD1(OnUnauthenticatedHeader, bool(const QuicPacketHeader& header)); |
| 102 // The constructor sets this up to return true by default. | 102 // The constructor sets this up to return true by default. |
| 103 MOCK_METHOD1(OnUnauthenticatedPublicHeader, bool( | 103 MOCK_METHOD1(OnUnauthenticatedPublicHeader, bool( |
| 104 const QuicPacketPublicHeader& header)); | 104 const QuicPacketPublicHeader& header)); |
| 105 MOCK_METHOD1(OnPacketHeader, bool(const QuicPacketHeader& header)); | 105 MOCK_METHOD1(OnPacketHeader, bool(const QuicPacketHeader& header)); |
| 106 MOCK_METHOD1(OnFecProtectedPayload, void(base::StringPiece payload)); | 106 MOCK_METHOD1(OnFecProtectedPayload, void(base::StringPiece payload)); |
| 107 MOCK_METHOD1(OnStreamFrame, bool(const QuicStreamFrame& frame)); | 107 MOCK_METHOD1(OnStreamFrame, bool(const QuicStreamFrame& frame)); |
| 108 MOCK_METHOD1(OnAckFrame, bool(const QuicAckFrame& frame)); | 108 MOCK_METHOD1(OnAckFrame, bool(const QuicAckFrame& frame)); |
| 109 MOCK_METHOD1(OnCongestionFeedbackFrame, | 109 MOCK_METHOD1(OnCongestionFeedbackFrame, |
| 110 bool(const QuicCongestionFeedbackFrame& frame)); | 110 bool(const QuicCongestionFeedbackFrame& frame)); |
| 111 MOCK_METHOD1(OnStopWaitingFrame, bool(const QuicStopWaitingFrame& frame)); |
| 111 MOCK_METHOD1(OnFecData, void(const QuicFecData& fec)); | 112 MOCK_METHOD1(OnFecData, void(const QuicFecData& fec)); |
| 112 MOCK_METHOD1(OnRstStreamFrame, bool(const QuicRstStreamFrame& frame)); | 113 MOCK_METHOD1(OnRstStreamFrame, bool(const QuicRstStreamFrame& frame)); |
| 113 MOCK_METHOD1(OnConnectionCloseFrame, | 114 MOCK_METHOD1(OnConnectionCloseFrame, |
| 114 bool(const QuicConnectionCloseFrame& frame)); | 115 bool(const QuicConnectionCloseFrame& frame)); |
| 115 MOCK_METHOD1(OnGoAwayFrame, bool(const QuicGoAwayFrame& frame)); | 116 MOCK_METHOD1(OnGoAwayFrame, bool(const QuicGoAwayFrame& frame)); |
| 116 MOCK_METHOD1(OnWindowUpdateFrame, bool(const QuicWindowUpdateFrame& frame)); | 117 MOCK_METHOD1(OnWindowUpdateFrame, bool(const QuicWindowUpdateFrame& frame)); |
| 117 MOCK_METHOD1(OnBlockedFrame, bool(const QuicBlockedFrame& frame)); | 118 MOCK_METHOD1(OnBlockedFrame, bool(const QuicBlockedFrame& frame)); |
| 118 MOCK_METHOD0(OnPacketComplete, void()); | 119 MOCK_METHOD0(OnPacketComplete, void()); |
| 119 | 120 |
| 120 private: | 121 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 135 virtual bool OnProtocolVersionMismatch(QuicVersion version) OVERRIDE; | 136 virtual bool OnProtocolVersionMismatch(QuicVersion version) OVERRIDE; |
| 136 virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) OVERRIDE; | 137 virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) OVERRIDE; |
| 137 virtual bool OnUnauthenticatedPublicHeader( | 138 virtual bool OnUnauthenticatedPublicHeader( |
| 138 const QuicPacketPublicHeader& header) OVERRIDE; | 139 const QuicPacketPublicHeader& header) OVERRIDE; |
| 139 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; | 140 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; |
| 140 virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE {} | 141 virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE {} |
| 141 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; | 142 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; |
| 142 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; | 143 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; |
| 143 virtual bool OnCongestionFeedbackFrame( | 144 virtual bool OnCongestionFeedbackFrame( |
| 144 const QuicCongestionFeedbackFrame& frame) OVERRIDE; | 145 const QuicCongestionFeedbackFrame& frame) OVERRIDE; |
| 146 virtual bool OnStopWaitingFrame( |
| 147 const QuicStopWaitingFrame& frame) OVERRIDE; |
| 145 virtual void OnFecData(const QuicFecData& fec) OVERRIDE {} | 148 virtual void OnFecData(const QuicFecData& fec) OVERRIDE {} |
| 146 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; | 149 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; |
| 147 virtual bool OnConnectionCloseFrame( | 150 virtual bool OnConnectionCloseFrame( |
| 148 const QuicConnectionCloseFrame& frame) OVERRIDE; | 151 const QuicConnectionCloseFrame& frame) OVERRIDE; |
| 149 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; | 152 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; |
| 150 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; | 153 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; |
| 151 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; | 154 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; |
| 152 virtual void OnPacketComplete() OVERRIDE {} | 155 virtual void OnPacketComplete() OVERRIDE {} |
| 153 | 156 |
| 154 private: | 157 private: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 180 void Reset(); | 183 void Reset(); |
| 181 | 184 |
| 182 // NoOpFramerVisitor | 185 // NoOpFramerVisitor |
| 183 virtual void OnVersionNegotiationPacket( | 186 virtual void OnVersionNegotiationPacket( |
| 184 const QuicVersionNegotiationPacket& packet) OVERRIDE; | 187 const QuicVersionNegotiationPacket& packet) OVERRIDE; |
| 185 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; | 188 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; |
| 186 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; | 189 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; |
| 187 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; | 190 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; |
| 188 virtual bool OnCongestionFeedbackFrame( | 191 virtual bool OnCongestionFeedbackFrame( |
| 189 const QuicCongestionFeedbackFrame& frame) OVERRIDE; | 192 const QuicCongestionFeedbackFrame& frame) OVERRIDE; |
| 193 virtual bool OnStopWaitingFrame( |
| 194 const QuicStopWaitingFrame& frame) OVERRIDE; |
| 190 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; | 195 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; |
| 191 virtual bool OnConnectionCloseFrame( | 196 virtual bool OnConnectionCloseFrame( |
| 192 const QuicConnectionCloseFrame& frame) OVERRIDE; | 197 const QuicConnectionCloseFrame& frame) OVERRIDE; |
| 193 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; | 198 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; |
| 194 | 199 |
| 195 size_t frame_count() const { return frame_count_; } | 200 size_t frame_count() const { return frame_count_; } |
| 196 QuicPacketHeader* header() { return &header_; } | 201 QuicPacketHeader* header() { return &header_; } |
| 197 const std::vector<QuicStreamFrame>* stream_frames() const { | 202 const std::vector<QuicStreamFrame>* stream_frames() const { |
| 198 return &stream_frames_; | 203 return &stream_frames_; |
| 199 } | 204 } |
| 200 const std::vector<string*>& stream_data() const { | 205 const std::vector<string*>& stream_data() const { |
| 201 return stream_data_; | 206 return stream_data_; |
| 202 } | 207 } |
| 203 QuicAckFrame* ack() { return ack_.get(); } | 208 QuicAckFrame* ack() { return ack_.get(); } |
| 204 QuicCongestionFeedbackFrame* feedback() { return feedback_.get(); } | 209 QuicCongestionFeedbackFrame* feedback() { return feedback_.get(); } |
| 210 QuicStopWaitingFrame* stop_waiting() { return stop_waiting_.get(); } |
| 205 QuicRstStreamFrame* rst() { return rst_.get(); } | 211 QuicRstStreamFrame* rst() { return rst_.get(); } |
| 206 QuicConnectionCloseFrame* close() { return close_.get(); } | 212 QuicConnectionCloseFrame* close() { return close_.get(); } |
| 207 QuicGoAwayFrame* goaway() { return goaway_.get(); } | 213 QuicGoAwayFrame* goaway() { return goaway_.get(); } |
| 208 QuicVersionNegotiationPacket* version_negotiation_packet() { | 214 QuicVersionNegotiationPacket* version_negotiation_packet() { |
| 209 return version_negotiation_packet_.get(); | 215 return version_negotiation_packet_.get(); |
| 210 } | 216 } |
| 211 | 217 |
| 212 private: | 218 private: |
| 213 size_t frame_count_; | 219 size_t frame_count_; |
| 214 QuicPacketHeader header_; | 220 QuicPacketHeader header_; |
| 215 std::vector<QuicStreamFrame> stream_frames_; | 221 std::vector<QuicStreamFrame> stream_frames_; |
| 216 std::vector<std::string*> stream_data_; | 222 std::vector<std::string*> stream_data_; |
| 217 scoped_ptr<QuicAckFrame> ack_; | 223 scoped_ptr<QuicAckFrame> ack_; |
| 218 scoped_ptr<QuicCongestionFeedbackFrame> feedback_; | 224 scoped_ptr<QuicCongestionFeedbackFrame> feedback_; |
| 225 scoped_ptr<QuicStopWaitingFrame> stop_waiting_; |
| 219 scoped_ptr<QuicRstStreamFrame> rst_; | 226 scoped_ptr<QuicRstStreamFrame> rst_; |
| 220 scoped_ptr<QuicConnectionCloseFrame> close_; | 227 scoped_ptr<QuicConnectionCloseFrame> close_; |
| 221 scoped_ptr<QuicGoAwayFrame> goaway_; | 228 scoped_ptr<QuicGoAwayFrame> goaway_; |
| 222 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; | 229 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; |
| 223 | 230 |
| 224 DISALLOW_COPY_AND_ASSIGN(FramerVisitorCapturingFrames); | 231 DISALLOW_COPY_AND_ASSIGN(FramerVisitorCapturingFrames); |
| 225 }; | 232 }; |
| 226 | 233 |
| 227 class MockConnectionVisitor : public QuicConnectionVisitorInterface { | 234 class MockConnectionVisitor : public QuicConnectionVisitorInterface { |
| 228 public: | 235 public: |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 | 479 |
| 473 protected: | 480 protected: |
| 474 // Object is ref counted. | 481 // Object is ref counted. |
| 475 virtual ~MockAckNotifierDelegate(); | 482 virtual ~MockAckNotifierDelegate(); |
| 476 }; | 483 }; |
| 477 | 484 |
| 478 } // namespace test | 485 } // namespace test |
| 479 } // namespace net | 486 } // namespace net |
| 480 | 487 |
| 481 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 488 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |