| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 private: | 81 private: |
| 82 SaveType* name_; | 82 SaveType* name_; |
| 83 SaveType value_; | 83 SaveType value_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(ValueRestore); | 85 DISALLOW_COPY_AND_ASSIGN(ValueRestore); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class MockFramerVisitor : public QuicFramerVisitorInterface { | 88 class MockFramerVisitor : public QuicFramerVisitorInterface { |
| 89 public: | 89 public: |
| 90 MockFramerVisitor(); | 90 MockFramerVisitor(); |
| 91 ~MockFramerVisitor(); | 91 virtual ~MockFramerVisitor() OVERRIDE; |
| 92 | 92 |
| 93 MOCK_METHOD1(OnError, void(QuicFramer* framer)); | 93 MOCK_METHOD1(OnError, void(QuicFramer* framer)); |
| 94 // The constructor sets this up to return false by default. | 94 // The constructor sets this up to return false by default. |
| 95 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicVersion version)); | 95 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicVersion version)); |
| 96 MOCK_METHOD0(OnPacket, void()); | 96 MOCK_METHOD0(OnPacket, void()); |
| 97 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header)); | 97 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header)); |
| 98 MOCK_METHOD1(OnVersionNegotiationPacket, | 98 MOCK_METHOD1(OnVersionNegotiationPacket, |
| 99 void(const QuicVersionNegotiationPacket& packet)); | 99 void(const QuicVersionNegotiationPacket& packet)); |
| 100 MOCK_METHOD0(OnRevivedPacket, void()); | 100 MOCK_METHOD0(OnRevivedPacket, void()); |
| 101 // The constructor sets this up to return true by default. | 101 // The constructor sets this up to return true by default. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; | 148 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; |
| 149 virtual void OnPacketComplete() OVERRIDE {} | 149 virtual void OnPacketComplete() OVERRIDE {} |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 DISALLOW_COPY_AND_ASSIGN(NoOpFramerVisitor); | 152 DISALLOW_COPY_AND_ASSIGN(NoOpFramerVisitor); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 class FramerVisitorCapturingPublicReset : public NoOpFramerVisitor { | 155 class FramerVisitorCapturingPublicReset : public NoOpFramerVisitor { |
| 156 public: | 156 public: |
| 157 FramerVisitorCapturingPublicReset(); | 157 FramerVisitorCapturingPublicReset(); |
| 158 virtual ~FramerVisitorCapturingPublicReset(); | 158 virtual ~FramerVisitorCapturingPublicReset() OVERRIDE; |
| 159 | 159 |
| 160 virtual void OnPublicResetPacket( | 160 virtual void OnPublicResetPacket( |
| 161 const QuicPublicResetPacket& packet) OVERRIDE; | 161 const QuicPublicResetPacket& packet) OVERRIDE; |
| 162 | 162 |
| 163 const QuicPublicResetPacket public_reset_packet() { | 163 const QuicPublicResetPacket public_reset_packet() { |
| 164 return public_reset_packet_; | 164 return public_reset_packet_; |
| 165 } | 165 } |
| 166 | 166 |
| 167 private: | 167 private: |
| 168 QuicPublicResetPacket public_reset_packet_; | 168 QuicPublicResetPacket public_reset_packet_; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 class FramerVisitorCapturingFrames : public NoOpFramerVisitor { | 171 class FramerVisitorCapturingFrames : public NoOpFramerVisitor { |
| 172 public: | 172 public: |
| 173 FramerVisitorCapturingFrames(); | 173 FramerVisitorCapturingFrames(); |
| 174 virtual ~FramerVisitorCapturingFrames(); | 174 virtual ~FramerVisitorCapturingFrames() OVERRIDE; |
| 175 | 175 |
| 176 // Reset the visitor to it's initial state. | 176 // Reset the visitor to it's initial state. |
| 177 void Reset(); | 177 void Reset(); |
| 178 | 178 |
| 179 // NoOpFramerVisitor | 179 // NoOpFramerVisitor |
| 180 virtual void OnVersionNegotiationPacket( | 180 virtual void OnVersionNegotiationPacket( |
| 181 const QuicVersionNegotiationPacket& packet) OVERRIDE; | 181 const QuicVersionNegotiationPacket& packet) OVERRIDE; |
| 182 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; | 182 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; |
| 183 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; | 183 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; |
| 184 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; | 184 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 scoped_ptr<QuicConnectionCloseFrame> close_; | 217 scoped_ptr<QuicConnectionCloseFrame> close_; |
| 218 scoped_ptr<QuicGoAwayFrame> goaway_; | 218 scoped_ptr<QuicGoAwayFrame> goaway_; |
| 219 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; | 219 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; |
| 220 | 220 |
| 221 DISALLOW_COPY_AND_ASSIGN(FramerVisitorCapturingFrames); | 221 DISALLOW_COPY_AND_ASSIGN(FramerVisitorCapturingFrames); |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 class MockConnectionVisitor : public QuicConnectionVisitorInterface { | 224 class MockConnectionVisitor : public QuicConnectionVisitorInterface { |
| 225 public: | 225 public: |
| 226 MockConnectionVisitor(); | 226 MockConnectionVisitor(); |
| 227 virtual ~MockConnectionVisitor(); | 227 virtual ~MockConnectionVisitor() OVERRIDE; |
| 228 | 228 |
| 229 MOCK_METHOD1(OnStreamFrames, bool(const std::vector<QuicStreamFrame>& frame)); | 229 MOCK_METHOD1(OnStreamFrames, bool(const std::vector<QuicStreamFrame>& frame)); |
| 230 MOCK_METHOD1(OnRstStream, void(const QuicRstStreamFrame& frame)); | 230 MOCK_METHOD1(OnRstStream, void(const QuicRstStreamFrame& frame)); |
| 231 MOCK_METHOD1(OnGoAway, void(const QuicGoAwayFrame& frame)); | 231 MOCK_METHOD1(OnGoAway, void(const QuicGoAwayFrame& frame)); |
| 232 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); | 232 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); |
| 233 MOCK_METHOD0(OnCanWrite, bool()); | 233 MOCK_METHOD0(OnCanWrite, bool()); |
| 234 MOCK_CONST_METHOD0(HasPendingHandshake, bool()); | 234 MOCK_CONST_METHOD0(HasPendingHandshake, bool()); |
| 235 MOCK_METHOD1(OnSuccessfulVersionNegotiation, | 235 MOCK_METHOD1(OnSuccessfulVersionNegotiation, |
| 236 void(const QuicVersion& version)); | 236 void(const QuicVersion& version)); |
| 237 MOCK_METHOD0(OnConfigNegotiated, void()); | 237 MOCK_METHOD0(OnConfigNegotiated, void()); |
| 238 | 238 |
| 239 private: | 239 private: |
| 240 DISALLOW_COPY_AND_ASSIGN(MockConnectionVisitor); | 240 DISALLOW_COPY_AND_ASSIGN(MockConnectionVisitor); |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 class MockHelper : public QuicConnectionHelperInterface { | 243 class MockHelper : public QuicConnectionHelperInterface { |
| 244 public: | 244 public: |
| 245 MockHelper(); | 245 MockHelper(); |
| 246 virtual ~MockHelper(); | 246 virtual ~MockHelper() OVERRIDE; |
| 247 | 247 |
| 248 MOCK_METHOD1(SetConnection, void(QuicConnection* connection)); | 248 MOCK_METHOD1(SetConnection, void(QuicConnection* connection)); |
| 249 const QuicClock* GetClock() const; | 249 const QuicClock* GetClock() const; |
| 250 QuicRandom* GetRandomGenerator(); | 250 QuicRandom* GetRandomGenerator(); |
| 251 void AdvanceTime(QuicTime::Delta delta); | 251 void AdvanceTime(QuicTime::Delta delta); |
| 252 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate); | 252 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate); |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 MockClock clock_; | 255 MockClock clock_; |
| 256 MockRandom random_generator_; | 256 MockRandom random_generator_; |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 class MockConnection : public QuicConnection { | 259 class MockConnection : public QuicConnection { |
| 260 public: | 260 public: |
| 261 // Uses a MockHelper, GUID of 42, and 127.0.0.1:123. | 261 // Uses a MockHelper, GUID of 42, and 127.0.0.1:123. |
| 262 explicit MockConnection(bool is_server); | 262 explicit MockConnection(bool is_server); |
| 263 | 263 |
| 264 // Uses a MockHelper, GUID of 42. | 264 // Uses a MockHelper, GUID of 42. |
| 265 MockConnection(IPEndPoint address, bool is_server); | 265 MockConnection(IPEndPoint address, bool is_server); |
| 266 | 266 |
| 267 // Uses a MockHelper, and 127.0.0.1:123 | 267 // Uses a MockHelper, and 127.0.0.1:123 |
| 268 MockConnection(QuicGuid guid, bool is_server); | 268 MockConnection(QuicGuid guid, bool is_server); |
| 269 | 269 |
| 270 // Uses a Mock helper, GUID of 42, and 127.0.0.1:123. | 270 // Uses a Mock helper, GUID of 42, and 127.0.0.1:123. |
| 271 MockConnection(bool is_server, const QuicVersionVector& supported_versions); | 271 MockConnection(bool is_server, const QuicVersionVector& supported_versions); |
| 272 | 272 |
| 273 virtual ~MockConnection(); | 273 virtual ~MockConnection() OVERRIDE; |
| 274 | 274 |
| 275 // If the constructor that uses a MockHelper has been used then this method | 275 // If the constructor that uses a MockHelper has been used then this method |
| 276 // will advance the time of the MockClock. | 276 // will advance the time of the MockClock. |
| 277 void AdvanceTime(QuicTime::Delta delta); | 277 void AdvanceTime(QuicTime::Delta delta); |
| 278 | 278 |
| 279 MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address, | 279 MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address, |
| 280 const IPEndPoint& peer_address, | 280 const IPEndPoint& peer_address, |
| 281 const QuicEncryptedPacket& packet)); | 281 const QuicEncryptedPacket& packet)); |
| 282 MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); | 282 MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); |
| 283 MOCK_METHOD2(SendConnectionCloseWithDetails, void(QuicErrorCode error, | 283 MOCK_METHOD2(SendConnectionCloseWithDetails, void(QuicErrorCode error, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 307 DISALLOW_COPY_AND_ASSIGN(MockConnection); | 307 DISALLOW_COPY_AND_ASSIGN(MockConnection); |
| 308 }; | 308 }; |
| 309 | 309 |
| 310 class PacketSavingConnection : public MockConnection { | 310 class PacketSavingConnection : public MockConnection { |
| 311 public: | 311 public: |
| 312 explicit PacketSavingConnection(bool is_server); | 312 explicit PacketSavingConnection(bool is_server); |
| 313 | 313 |
| 314 PacketSavingConnection(bool is_server, | 314 PacketSavingConnection(bool is_server, |
| 315 const QuicVersionVector& supported_versions); | 315 const QuicVersionVector& supported_versions); |
| 316 | 316 |
| 317 virtual ~PacketSavingConnection(); | 317 virtual ~PacketSavingConnection() OVERRIDE; |
| 318 | 318 |
| 319 virtual bool SendOrQueuePacket(EncryptionLevel level, | 319 virtual bool SendOrQueuePacket(EncryptionLevel level, |
| 320 const SerializedPacket& packet, | 320 const SerializedPacket& packet, |
| 321 TransmissionType transmission_type) OVERRIDE; | 321 TransmissionType transmission_type) OVERRIDE; |
| 322 | 322 |
| 323 std::vector<QuicPacket*> packets_; | 323 std::vector<QuicPacket*> packets_; |
| 324 std::vector<QuicEncryptedPacket*> encrypted_packets_; | 324 std::vector<QuicEncryptedPacket*> encrypted_packets_; |
| 325 | 325 |
| 326 private: | 326 private: |
| 327 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection); | 327 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection); |
| 328 }; | 328 }; |
| 329 | 329 |
| 330 class MockSession : public QuicSession { | 330 class MockSession : public QuicSession { |
| 331 public: | 331 public: |
| 332 explicit MockSession(QuicConnection* connection); | 332 explicit MockSession(QuicConnection* connection); |
| 333 virtual ~MockSession(); | 333 virtual ~MockSession() OVERRIDE; |
| 334 | 334 |
| 335 MOCK_METHOD4(OnPacket, bool(const IPEndPoint& self_address, | 335 MOCK_METHOD4(OnPacket, bool(const IPEndPoint& self_address, |
| 336 const IPEndPoint& peer_address, | 336 const IPEndPoint& peer_address, |
| 337 const QuicPacketHeader& header, | 337 const QuicPacketHeader& header, |
| 338 const std::vector<QuicStreamFrame>& frame)); | 338 const std::vector<QuicStreamFrame>& frame)); |
| 339 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); | 339 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); |
| 340 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); | 340 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
| 341 MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); | 341 MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); |
| 342 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); | 342 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
| 343 MOCK_METHOD6(WritevData, | 343 MOCK_METHOD6(WritevData, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 357 MOCK_METHOD0(IsHandshakeComplete, bool()); | 357 MOCK_METHOD0(IsHandshakeComplete, bool()); |
| 358 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool()); | 358 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool()); |
| 359 | 359 |
| 360 private: | 360 private: |
| 361 DISALLOW_COPY_AND_ASSIGN(MockSession); | 361 DISALLOW_COPY_AND_ASSIGN(MockSession); |
| 362 }; | 362 }; |
| 363 | 363 |
| 364 class TestSession : public QuicSession { | 364 class TestSession : public QuicSession { |
| 365 public: | 365 public: |
| 366 TestSession(QuicConnection* connection, const QuicConfig& config); | 366 TestSession(QuicConnection* connection, const QuicConfig& config); |
| 367 virtual ~TestSession(); | 367 virtual ~TestSession() OVERRIDE; |
| 368 | 368 |
| 369 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); | 369 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
| 370 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); | 370 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
| 371 | 371 |
| 372 void SetCryptoStream(QuicCryptoStream* stream); | 372 void SetCryptoStream(QuicCryptoStream* stream); |
| 373 | 373 |
| 374 virtual QuicCryptoStream* GetCryptoStream(); | 374 virtual QuicCryptoStream* GetCryptoStream(); |
| 375 | 375 |
| 376 private: | 376 private: |
| 377 QuicCryptoStream* crypto_stream_; | 377 QuicCryptoStream* crypto_stream_; |
| 378 DISALLOW_COPY_AND_ASSIGN(TestSession); | 378 DISALLOW_COPY_AND_ASSIGN(TestSession); |
| 379 }; | 379 }; |
| 380 | 380 |
| 381 class MockPacketWriter : public QuicPacketWriter { | 381 class MockPacketWriter : public QuicPacketWriter { |
| 382 public: | 382 public: |
| 383 MockPacketWriter(); | 383 MockPacketWriter(); |
| 384 virtual ~MockPacketWriter(); | 384 virtual ~MockPacketWriter() OVERRIDE; |
| 385 | 385 |
| 386 MOCK_METHOD5(WritePacket, | 386 MOCK_METHOD5(WritePacket, |
| 387 WriteResult(const char* buffer, | 387 WriteResult(const char* buffer, |
| 388 size_t buf_len, | 388 size_t buf_len, |
| 389 const IPAddressNumber& self_address, | 389 const IPAddressNumber& self_address, |
| 390 const IPEndPoint& peer_address, | 390 const IPEndPoint& peer_address, |
| 391 QuicBlockedWriterInterface* blocked_writer)); | 391 QuicBlockedWriterInterface* blocked_writer)); |
| 392 MOCK_CONST_METHOD0(IsWriteBlockedDataBuffered, bool()); | 392 MOCK_CONST_METHOD0(IsWriteBlockedDataBuffered, bool()); |
| 393 }; | 393 }; |
| 394 | 394 |
| 395 class MockSendAlgorithm : public SendAlgorithmInterface { | 395 class MockSendAlgorithm : public SendAlgorithmInterface { |
| 396 public: | 396 public: |
| 397 MockSendAlgorithm(); | 397 MockSendAlgorithm(); |
| 398 virtual ~MockSendAlgorithm(); | 398 virtual ~MockSendAlgorithm() OVERRIDE; |
| 399 | 399 |
| 400 MOCK_METHOD2(SetFromConfig, void(const QuicConfig& config, bool is_server)); | 400 MOCK_METHOD2(SetFromConfig, void(const QuicConfig& config, bool is_server)); |
| 401 MOCK_METHOD1(SetMaxPacketSize, void(QuicByteCount max_packet_size)); | 401 MOCK_METHOD1(SetMaxPacketSize, void(QuicByteCount max_packet_size)); |
| 402 MOCK_METHOD3(OnIncomingQuicCongestionFeedbackFrame, | 402 MOCK_METHOD3(OnIncomingQuicCongestionFeedbackFrame, |
| 403 void(const QuicCongestionFeedbackFrame&, | 403 void(const QuicCongestionFeedbackFrame&, |
| 404 QuicTime feedback_receive_time, | 404 QuicTime feedback_receive_time, |
| 405 const SentPacketsMap&)); | 405 const SentPacketsMap&)); |
| 406 MOCK_METHOD3(OnPacketAcked, | 406 MOCK_METHOD3(OnPacketAcked, |
| 407 void(QuicPacketSequenceNumber, QuicByteCount, QuicTime::Delta)); | 407 void(QuicPacketSequenceNumber, QuicByteCount, QuicTime::Delta)); |
| 408 MOCK_METHOD2(OnPacketLost, void(QuicPacketSequenceNumber, QuicTime)); | 408 MOCK_METHOD2(OnPacketLost, void(QuicPacketSequenceNumber, QuicTime)); |
| 409 MOCK_METHOD5(OnPacketSent, | 409 MOCK_METHOD5(OnPacketSent, |
| 410 bool(QuicTime sent_time, QuicPacketSequenceNumber, QuicByteCount, | 410 bool(QuicTime sent_time, QuicPacketSequenceNumber, QuicByteCount, |
| 411 TransmissionType, HasRetransmittableData)); | 411 TransmissionType, HasRetransmittableData)); |
| 412 MOCK_METHOD0(OnRetransmissionTimeout, void()); | 412 MOCK_METHOD1(OnRetransmissionTimeout, void(bool)); |
| 413 MOCK_METHOD2(OnPacketAbandoned, void(QuicPacketSequenceNumber sequence_number, | 413 MOCK_METHOD2(OnPacketAbandoned, void(QuicPacketSequenceNumber sequence_number, |
| 414 QuicByteCount abandoned_bytes)); | 414 QuicByteCount abandoned_bytes)); |
| 415 MOCK_METHOD4(TimeUntilSend, QuicTime::Delta(QuicTime now, TransmissionType, | 415 MOCK_METHOD4(TimeUntilSend, QuicTime::Delta(QuicTime now, TransmissionType, |
| 416 HasRetransmittableData, | 416 HasRetransmittableData, |
| 417 IsHandshake)); | 417 IsHandshake)); |
| 418 MOCK_CONST_METHOD0(BandwidthEstimate, QuicBandwidth(void)); | 418 MOCK_CONST_METHOD0(BandwidthEstimate, QuicBandwidth(void)); |
| 419 MOCK_CONST_METHOD0(SmoothedRtt, QuicTime::Delta(void)); | 419 MOCK_CONST_METHOD0(SmoothedRtt, QuicTime::Delta(void)); |
| 420 MOCK_CONST_METHOD0(RetransmissionDelay, QuicTime::Delta(void)); | 420 MOCK_CONST_METHOD0(RetransmissionDelay, QuicTime::Delta(void)); |
| 421 MOCK_CONST_METHOD0(GetCongestionWindow, QuicByteCount()); | 421 MOCK_CONST_METHOD0(GetCongestionWindow, QuicByteCount()); |
| 422 | 422 |
| 423 private: | 423 private: |
| 424 DISALLOW_COPY_AND_ASSIGN(MockSendAlgorithm); | 424 DISALLOW_COPY_AND_ASSIGN(MockSendAlgorithm); |
| 425 }; | 425 }; |
| 426 | 426 |
| 427 class TestEntropyCalculator : | 427 class TestEntropyCalculator : |
| 428 public QuicReceivedEntropyHashCalculatorInterface { | 428 public QuicReceivedEntropyHashCalculatorInterface { |
| 429 public: | 429 public: |
| 430 TestEntropyCalculator(); | 430 TestEntropyCalculator(); |
| 431 virtual ~TestEntropyCalculator(); | 431 virtual ~TestEntropyCalculator() OVERRIDE; |
| 432 | 432 |
| 433 virtual QuicPacketEntropyHash EntropyHash( | 433 virtual QuicPacketEntropyHash EntropyHash( |
| 434 QuicPacketSequenceNumber sequence_number) const OVERRIDE; | 434 QuicPacketSequenceNumber sequence_number) const OVERRIDE; |
| 435 }; | 435 }; |
| 436 | 436 |
| 437 class MockEntropyCalculator : public TestEntropyCalculator { | 437 class MockEntropyCalculator : public TestEntropyCalculator { |
| 438 public: | 438 public: |
| 439 MockEntropyCalculator(); | 439 MockEntropyCalculator(); |
| 440 virtual ~MockEntropyCalculator(); | 440 virtual ~MockEntropyCalculator() OVERRIDE; |
| 441 | 441 |
| 442 MOCK_CONST_METHOD1( | 442 MOCK_CONST_METHOD1( |
| 443 EntropyHash, | 443 EntropyHash, |
| 444 QuicPacketEntropyHash(QuicPacketSequenceNumber sequence_number)); | 444 QuicPacketEntropyHash(QuicPacketSequenceNumber sequence_number)); |
| 445 }; | 445 }; |
| 446 | 446 |
| 447 class TestDecompressorVisitor : public QuicSpdyDecompressor::Visitor { | 447 class TestDecompressorVisitor : public QuicSpdyDecompressor::Visitor { |
| 448 public: | 448 public: |
| 449 virtual ~TestDecompressorVisitor() {} | 449 virtual ~TestDecompressorVisitor() OVERRIDE {} |
| 450 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; | 450 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; |
| 451 virtual void OnDecompressionError() OVERRIDE; | 451 virtual void OnDecompressionError() OVERRIDE; |
| 452 | 452 |
| 453 string data() { return data_; } | 453 string data() { return data_; } |
| 454 bool error() { return error_; } | 454 bool error() { return error_; } |
| 455 | 455 |
| 456 private: | 456 private: |
| 457 string data_; | 457 string data_; |
| 458 bool error_; | 458 bool error_; |
| 459 }; | 459 }; |
| 460 | 460 |
| 461 class MockAckNotifierDelegate : public QuicAckNotifier::DelegateInterface { | 461 class MockAckNotifierDelegate : public QuicAckNotifier::DelegateInterface { |
| 462 public: | 462 public: |
| 463 MockAckNotifierDelegate(); | 463 MockAckNotifierDelegate(); |
| 464 virtual ~MockAckNotifierDelegate(); | 464 virtual ~MockAckNotifierDelegate() OVERRIDE; |
| 465 | 465 |
| 466 MOCK_METHOD0(OnAckNotification, void()); | 466 MOCK_METHOD0(OnAckNotification, void()); |
| 467 }; | 467 }; |
| 468 | 468 |
| 469 } // namespace test | 469 } // namespace test |
| 470 } // namespace net | 470 } // namespace net |
| 471 | 471 |
| 472 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 472 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |