| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 private: | 144 private: |
| 145 uint64 seed_; | 145 uint64 seed_; |
| 146 | 146 |
| 147 DISALLOW_COPY_AND_ASSIGN(SimpleRandom); | 147 DISALLOW_COPY_AND_ASSIGN(SimpleRandom); |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 class MockFramerVisitor : public QuicFramerVisitorInterface { | 150 class MockFramerVisitor : public QuicFramerVisitorInterface { |
| 151 public: | 151 public: |
| 152 MockFramerVisitor(); | 152 MockFramerVisitor(); |
| 153 virtual ~MockFramerVisitor(); | 153 ~MockFramerVisitor() override; |
| 154 | 154 |
| 155 MOCK_METHOD1(OnError, void(QuicFramer* framer)); | 155 MOCK_METHOD1(OnError, void(QuicFramer* framer)); |
| 156 // The constructor sets this up to return false by default. | 156 // The constructor sets this up to return false by default. |
| 157 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicVersion version)); | 157 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicVersion version)); |
| 158 MOCK_METHOD0(OnPacket, void()); | 158 MOCK_METHOD0(OnPacket, void()); |
| 159 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header)); | 159 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header)); |
| 160 MOCK_METHOD1(OnVersionNegotiationPacket, | 160 MOCK_METHOD1(OnVersionNegotiationPacket, |
| 161 void(const QuicVersionNegotiationPacket& packet)); | 161 void(const QuicVersionNegotiationPacket& packet)); |
| 162 MOCK_METHOD0(OnRevivedPacket, void()); | 162 MOCK_METHOD0(OnRevivedPacket, void()); |
| 163 // The constructor sets this up to return true by default. | 163 // The constructor sets this up to return true by default. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 bool OnBlockedFrame(const QuicBlockedFrame& frame) override; | 218 bool OnBlockedFrame(const QuicBlockedFrame& frame) override; |
| 219 void OnPacketComplete() override {} | 219 void OnPacketComplete() override {} |
| 220 | 220 |
| 221 private: | 221 private: |
| 222 DISALLOW_COPY_AND_ASSIGN(NoOpFramerVisitor); | 222 DISALLOW_COPY_AND_ASSIGN(NoOpFramerVisitor); |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 class MockConnectionVisitor : public QuicConnectionVisitorInterface { | 225 class MockConnectionVisitor : public QuicConnectionVisitorInterface { |
| 226 public: | 226 public: |
| 227 MockConnectionVisitor(); | 227 MockConnectionVisitor(); |
| 228 virtual ~MockConnectionVisitor(); | 228 ~MockConnectionVisitor() override; |
| 229 | 229 |
| 230 MOCK_METHOD1(OnStreamFrames, void(const std::vector<QuicStreamFrame>& frame)); | 230 MOCK_METHOD1(OnStreamFrames, void(const std::vector<QuicStreamFrame>& frame)); |
| 231 MOCK_METHOD1(OnWindowUpdateFrames, | 231 MOCK_METHOD1(OnWindowUpdateFrames, |
| 232 void(const std::vector<QuicWindowUpdateFrame>& frame)); | 232 void(const std::vector<QuicWindowUpdateFrame>& frame)); |
| 233 MOCK_METHOD1(OnBlockedFrames, | 233 MOCK_METHOD1(OnBlockedFrames, |
| 234 void(const std::vector<QuicBlockedFrame>& frame)); | 234 void(const std::vector<QuicBlockedFrame>& frame)); |
| 235 MOCK_METHOD1(OnRstStream, void(const QuicRstStreamFrame& frame)); | 235 MOCK_METHOD1(OnRstStream, void(const QuicRstStreamFrame& frame)); |
| 236 MOCK_METHOD1(OnGoAway, void(const QuicGoAwayFrame& frame)); | 236 MOCK_METHOD1(OnGoAway, void(const QuicGoAwayFrame& frame)); |
| 237 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); | 237 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); |
| 238 MOCK_METHOD0(OnWriteBlocked, void()); | 238 MOCK_METHOD0(OnWriteBlocked, void()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 // Uses a MockHelper, ConnectionId of 42. | 287 // Uses a MockHelper, ConnectionId of 42. |
| 288 MockConnection(IPEndPoint address, bool is_server); | 288 MockConnection(IPEndPoint address, bool is_server); |
| 289 | 289 |
| 290 // Uses a MockHelper, and 127.0.0.1:123 | 290 // Uses a MockHelper, and 127.0.0.1:123 |
| 291 MockConnection(QuicConnectionId connection_id, bool is_server); | 291 MockConnection(QuicConnectionId connection_id, bool is_server); |
| 292 | 292 |
| 293 // Uses a Mock helper, ConnectionId of 42, and 127.0.0.1:123. | 293 // Uses a Mock helper, ConnectionId of 42, and 127.0.0.1:123. |
| 294 MockConnection(bool is_server, const QuicVersionVector& supported_versions); | 294 MockConnection(bool is_server, const QuicVersionVector& supported_versions); |
| 295 | 295 |
| 296 virtual ~MockConnection(); | 296 ~MockConnection() override; |
| 297 | 297 |
| 298 // If the constructor that uses a MockHelper has been used then this method | 298 // If the constructor that uses a MockHelper has been used then this method |
| 299 // will advance the time of the MockClock. | 299 // will advance the time of the MockClock. |
| 300 void AdvanceTime(QuicTime::Delta delta); | 300 void AdvanceTime(QuicTime::Delta delta); |
| 301 | 301 |
| 302 MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address, | 302 MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address, |
| 303 const IPEndPoint& peer_address, | 303 const IPEndPoint& peer_address, |
| 304 const QuicEncryptedPacket& packet)); | 304 const QuicEncryptedPacket& packet)); |
| 305 MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); | 305 MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); |
| 306 MOCK_METHOD2(SendConnectionCloseWithDetails, void(QuicErrorCode error, | 306 MOCK_METHOD2(SendConnectionCloseWithDetails, void(QuicErrorCode error, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 317 MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id, | 317 MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id, |
| 318 QuicStreamOffset byte_offset)); | 318 QuicStreamOffset byte_offset)); |
| 319 MOCK_METHOD0(OnCanWrite, void()); | 319 MOCK_METHOD0(OnCanWrite, void()); |
| 320 | 320 |
| 321 void ProcessUdpPacketInternal(const IPEndPoint& self_address, | 321 void ProcessUdpPacketInternal(const IPEndPoint& self_address, |
| 322 const IPEndPoint& peer_address, | 322 const IPEndPoint& peer_address, |
| 323 const QuicEncryptedPacket& packet) { | 323 const QuicEncryptedPacket& packet) { |
| 324 QuicConnection::ProcessUdpPacket(self_address, peer_address, packet); | 324 QuicConnection::ProcessUdpPacket(self_address, peer_address, packet); |
| 325 } | 325 } |
| 326 | 326 |
| 327 virtual bool OnProtocolVersionMismatch(QuicVersion version) override { | 327 bool OnProtocolVersionMismatch(QuicVersion version) override { |
| 328 return false; | 328 return false; |
| 329 } | 329 } |
| 330 | 330 |
| 331 private: | 331 private: |
| 332 scoped_ptr<QuicConnectionHelperInterface> helper_; | 332 scoped_ptr<QuicConnectionHelperInterface> helper_; |
| 333 | 333 |
| 334 DISALLOW_COPY_AND_ASSIGN(MockConnection); | 334 DISALLOW_COPY_AND_ASSIGN(MockConnection); |
| 335 }; | 335 }; |
| 336 | 336 |
| 337 class PacketSavingConnection : public MockConnection { | 337 class PacketSavingConnection : public MockConnection { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 348 std::vector<QuicPacket*> packets_; | 348 std::vector<QuicPacket*> packets_; |
| 349 std::vector<QuicEncryptedPacket*> encrypted_packets_; | 349 std::vector<QuicEncryptedPacket*> encrypted_packets_; |
| 350 | 350 |
| 351 private: | 351 private: |
| 352 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection); | 352 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection); |
| 353 }; | 353 }; |
| 354 | 354 |
| 355 class MockSession : public QuicSession { | 355 class MockSession : public QuicSession { |
| 356 public: | 356 public: |
| 357 explicit MockSession(QuicConnection* connection); | 357 explicit MockSession(QuicConnection* connection); |
| 358 virtual ~MockSession(); | 358 ~MockSession() override; |
| 359 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); | 359 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); |
| 360 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); | 360 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
| 361 MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); | 361 MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); |
| 362 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); | 362 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
| 363 MOCK_METHOD6(WritevData, | 363 MOCK_METHOD6(WritevData, |
| 364 QuicConsumedData(QuicStreamId id, | 364 QuicConsumedData(QuicStreamId id, |
| 365 const IOVector& data, | 365 const IOVector& data, |
| 366 QuicStreamOffset offset, | 366 QuicStreamOffset offset, |
| 367 bool fin, | 367 bool fin, |
| 368 FecProtection fec_protection, | 368 FecProtection fec_protection, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 381 | 381 |
| 382 using QuicSession::ActivateStream; | 382 using QuicSession::ActivateStream; |
| 383 | 383 |
| 384 private: | 384 private: |
| 385 DISALLOW_COPY_AND_ASSIGN(MockSession); | 385 DISALLOW_COPY_AND_ASSIGN(MockSession); |
| 386 }; | 386 }; |
| 387 | 387 |
| 388 class TestSession : public QuicSession { | 388 class TestSession : public QuicSession { |
| 389 public: | 389 public: |
| 390 TestSession(QuicConnection* connection, const QuicConfig& config); | 390 TestSession(QuicConnection* connection, const QuicConfig& config); |
| 391 virtual ~TestSession(); | 391 ~TestSession() override; |
| 392 | 392 |
| 393 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); | 393 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
| 394 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); | 394 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
| 395 | 395 |
| 396 void SetCryptoStream(QuicCryptoStream* stream); | 396 void SetCryptoStream(QuicCryptoStream* stream); |
| 397 | 397 |
| 398 virtual QuicCryptoStream* GetCryptoStream() override; | 398 QuicCryptoStream* GetCryptoStream() override; |
| 399 | 399 |
| 400 private: | 400 private: |
| 401 QuicCryptoStream* crypto_stream_; | 401 QuicCryptoStream* crypto_stream_; |
| 402 | 402 |
| 403 DISALLOW_COPY_AND_ASSIGN(TestSession); | 403 DISALLOW_COPY_AND_ASSIGN(TestSession); |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 class TestClientSession : public QuicClientSessionBase { | 406 class TestClientSession : public QuicClientSessionBase { |
| 407 public: | 407 public: |
| 408 TestClientSession(QuicConnection* connection, const QuicConfig& config); | 408 TestClientSession(QuicConnection* connection, const QuicConfig& config); |
| 409 virtual ~TestClientSession(); | 409 ~TestClientSession() override; |
| 410 | 410 |
| 411 // QuicClientSessionBase | 411 // QuicClientSessionBase |
| 412 MOCK_METHOD1(OnProofValid, | 412 MOCK_METHOD1(OnProofValid, |
| 413 void(const QuicCryptoClientConfig::CachedState& cached)); | 413 void(const QuicCryptoClientConfig::CachedState& cached)); |
| 414 MOCK_METHOD1(OnProofVerifyDetailsAvailable, | 414 MOCK_METHOD1(OnProofVerifyDetailsAvailable, |
| 415 void(const ProofVerifyDetails& verify_details)); | 415 void(const ProofVerifyDetails& verify_details)); |
| 416 | 416 |
| 417 // TestClientSession | 417 // TestClientSession |
| 418 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); | 418 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
| 419 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); | 419 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
| 420 | 420 |
| 421 void SetCryptoStream(QuicCryptoStream* stream); | 421 void SetCryptoStream(QuicCryptoStream* stream); |
| 422 | 422 |
| 423 virtual QuicCryptoStream* GetCryptoStream() override; | 423 QuicCryptoStream* GetCryptoStream() override; |
| 424 | 424 |
| 425 private: | 425 private: |
| 426 QuicCryptoStream* crypto_stream_; | 426 QuicCryptoStream* crypto_stream_; |
| 427 | 427 |
| 428 DISALLOW_COPY_AND_ASSIGN(TestClientSession); | 428 DISALLOW_COPY_AND_ASSIGN(TestClientSession); |
| 429 }; | 429 }; |
| 430 | 430 |
| 431 class MockPacketWriter : public QuicPacketWriter { | 431 class MockPacketWriter : public QuicPacketWriter { |
| 432 public: | 432 public: |
| 433 MockPacketWriter(); | 433 MockPacketWriter(); |
| 434 virtual ~MockPacketWriter(); | 434 ~MockPacketWriter() override; |
| 435 | 435 |
| 436 MOCK_METHOD4(WritePacket, | 436 MOCK_METHOD4(WritePacket, |
| 437 WriteResult(const char* buffer, | 437 WriteResult(const char* buffer, |
| 438 size_t buf_len, | 438 size_t buf_len, |
| 439 const IPAddressNumber& self_address, | 439 const IPAddressNumber& self_address, |
| 440 const IPEndPoint& peer_address)); | 440 const IPEndPoint& peer_address)); |
| 441 MOCK_CONST_METHOD0(IsWriteBlockedDataBuffered, bool()); | 441 MOCK_CONST_METHOD0(IsWriteBlockedDataBuffered, bool()); |
| 442 MOCK_CONST_METHOD0(IsWriteBlocked, bool()); | 442 MOCK_CONST_METHOD0(IsWriteBlocked, bool()); |
| 443 MOCK_METHOD0(SetWritable, void()); | 443 MOCK_METHOD0(SetWritable, void()); |
| 444 | 444 |
| 445 private: | 445 private: |
| 446 DISALLOW_COPY_AND_ASSIGN(MockPacketWriter); | 446 DISALLOW_COPY_AND_ASSIGN(MockPacketWriter); |
| 447 }; | 447 }; |
| 448 | 448 |
| 449 class MockSendAlgorithm : public SendAlgorithmInterface { | 449 class MockSendAlgorithm : public SendAlgorithmInterface { |
| 450 public: | 450 public: |
| 451 MockSendAlgorithm(); | 451 MockSendAlgorithm(); |
| 452 virtual ~MockSendAlgorithm(); | 452 ~MockSendAlgorithm() override; |
| 453 | 453 |
| 454 MOCK_METHOD3(SetFromConfig, void(const QuicConfig& config, | 454 MOCK_METHOD3(SetFromConfig, void(const QuicConfig& config, |
| 455 bool is_server, | 455 bool is_server, |
| 456 bool using_pacing)); | 456 bool using_pacing)); |
| 457 MOCK_METHOD1(SetNumEmulatedConnections, void(int num_connections)); | 457 MOCK_METHOD1(SetNumEmulatedConnections, void(int num_connections)); |
| 458 MOCK_METHOD1(SetMaxPacketSize, void(QuicByteCount max_packet_size)); | 458 MOCK_METHOD1(SetMaxPacketSize, void(QuicByteCount max_packet_size)); |
| 459 MOCK_METHOD2(OnIncomingQuicCongestionFeedbackFrame, | 459 MOCK_METHOD2(OnIncomingQuicCongestionFeedbackFrame, |
| 460 void(const QuicCongestionFeedbackFrame&, | 460 void(const QuicCongestionFeedbackFrame&, |
| 461 QuicTime feedback_receive_time)); | 461 QuicTime feedback_receive_time)); |
| 462 MOCK_METHOD4(OnCongestionEvent, void(bool rtt_updated, | 462 MOCK_METHOD4(OnCongestionEvent, void(bool rtt_updated, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 475 MOCK_CONST_METHOD0(PacingRate, QuicBandwidth(void)); | 475 MOCK_CONST_METHOD0(PacingRate, QuicBandwidth(void)); |
| 476 MOCK_CONST_METHOD0(BandwidthEstimate, QuicBandwidth(void)); | 476 MOCK_CONST_METHOD0(BandwidthEstimate, QuicBandwidth(void)); |
| 477 MOCK_CONST_METHOD0(HasReliableBandwidthEstimate, bool()); | 477 MOCK_CONST_METHOD0(HasReliableBandwidthEstimate, bool()); |
| 478 MOCK_METHOD1(OnRttUpdated, void(QuicPacketSequenceNumber)); | 478 MOCK_METHOD1(OnRttUpdated, void(QuicPacketSequenceNumber)); |
| 479 MOCK_CONST_METHOD0(RetransmissionDelay, QuicTime::Delta(void)); | 479 MOCK_CONST_METHOD0(RetransmissionDelay, QuicTime::Delta(void)); |
| 480 MOCK_CONST_METHOD0(GetCongestionWindow, QuicByteCount()); | 480 MOCK_CONST_METHOD0(GetCongestionWindow, QuicByteCount()); |
| 481 MOCK_CONST_METHOD0(InSlowStart, bool()); | 481 MOCK_CONST_METHOD0(InSlowStart, bool()); |
| 482 MOCK_CONST_METHOD0(InRecovery, bool()); | 482 MOCK_CONST_METHOD0(InRecovery, bool()); |
| 483 MOCK_CONST_METHOD0(GetSlowStartThreshold, QuicByteCount()); | 483 MOCK_CONST_METHOD0(GetSlowStartThreshold, QuicByteCount()); |
| 484 MOCK_CONST_METHOD0(GetCongestionControlType, CongestionControlType()); | 484 MOCK_CONST_METHOD0(GetCongestionControlType, CongestionControlType()); |
| 485 MOCK_METHOD1(ResumeConnectionState, void(const CachedNetworkParameters&)); |
| 485 | 486 |
| 486 private: | 487 private: |
| 487 DISALLOW_COPY_AND_ASSIGN(MockSendAlgorithm); | 488 DISALLOW_COPY_AND_ASSIGN(MockSendAlgorithm); |
| 488 }; | 489 }; |
| 489 | 490 |
| 490 class MockLossAlgorithm : public LossDetectionInterface { | 491 class MockLossAlgorithm : public LossDetectionInterface { |
| 491 public: | 492 public: |
| 492 MockLossAlgorithm(); | 493 MockLossAlgorithm(); |
| 493 virtual ~MockLossAlgorithm(); | 494 ~MockLossAlgorithm() override; |
| 494 | 495 |
| 495 MOCK_CONST_METHOD0(GetLossDetectionType, LossDetectionType()); | 496 MOCK_CONST_METHOD0(GetLossDetectionType, LossDetectionType()); |
| 496 MOCK_METHOD4(DetectLostPackets, | 497 MOCK_METHOD4(DetectLostPackets, |
| 497 SequenceNumberSet(const QuicUnackedPacketMap& unacked_packets, | 498 SequenceNumberSet(const QuicUnackedPacketMap& unacked_packets, |
| 498 const QuicTime& time, | 499 const QuicTime& time, |
| 499 QuicPacketSequenceNumber largest_observed, | 500 QuicPacketSequenceNumber largest_observed, |
| 500 const RttStats& rtt_stats)); | 501 const RttStats& rtt_stats)); |
| 501 MOCK_CONST_METHOD0(GetLossTimeout, QuicTime()); | 502 MOCK_CONST_METHOD0(GetLossTimeout, QuicTime()); |
| 502 | 503 |
| 503 private: | 504 private: |
| 504 DISALLOW_COPY_AND_ASSIGN(MockLossAlgorithm); | 505 DISALLOW_COPY_AND_ASSIGN(MockLossAlgorithm); |
| 505 }; | 506 }; |
| 506 | 507 |
| 507 class TestEntropyCalculator : | 508 class TestEntropyCalculator : |
| 508 public QuicReceivedEntropyHashCalculatorInterface { | 509 public QuicReceivedEntropyHashCalculatorInterface { |
| 509 public: | 510 public: |
| 510 TestEntropyCalculator(); | 511 TestEntropyCalculator(); |
| 511 ~TestEntropyCalculator() override; | 512 ~TestEntropyCalculator() override; |
| 512 | 513 |
| 513 QuicPacketEntropyHash EntropyHash( | 514 QuicPacketEntropyHash EntropyHash( |
| 514 QuicPacketSequenceNumber sequence_number) const override; | 515 QuicPacketSequenceNumber sequence_number) const override; |
| 515 | 516 |
| 516 private: | 517 private: |
| 517 DISALLOW_COPY_AND_ASSIGN(TestEntropyCalculator); | 518 DISALLOW_COPY_AND_ASSIGN(TestEntropyCalculator); |
| 518 }; | 519 }; |
| 519 | 520 |
| 520 class MockEntropyCalculator : public TestEntropyCalculator { | 521 class MockEntropyCalculator : public TestEntropyCalculator { |
| 521 public: | 522 public: |
| 522 MockEntropyCalculator(); | 523 MockEntropyCalculator(); |
| 523 virtual ~MockEntropyCalculator(); | 524 ~MockEntropyCalculator() override; |
| 524 | 525 |
| 525 MOCK_CONST_METHOD1( | 526 MOCK_CONST_METHOD1( |
| 526 EntropyHash, | 527 EntropyHash, |
| 527 QuicPacketEntropyHash(QuicPacketSequenceNumber sequence_number)); | 528 QuicPacketEntropyHash(QuicPacketSequenceNumber sequence_number)); |
| 528 | 529 |
| 529 private: | 530 private: |
| 530 DISALLOW_COPY_AND_ASSIGN(MockEntropyCalculator); | 531 DISALLOW_COPY_AND_ASSIGN(MockEntropyCalculator); |
| 531 }; | 532 }; |
| 532 | 533 |
| 533 class MockAckNotifierDelegate : public QuicAckNotifier::DelegateInterface { | 534 class MockAckNotifierDelegate : public QuicAckNotifier::DelegateInterface { |
| 534 public: | 535 public: |
| 535 MockAckNotifierDelegate(); | 536 MockAckNotifierDelegate(); |
| 536 | 537 |
| 537 MOCK_METHOD5(OnAckNotification, void(int num_original_packets, | 538 MOCK_METHOD5(OnAckNotification, void(int num_original_packets, |
| 538 int num_original_bytes, | 539 int num_original_bytes, |
| 539 int num_retransmitted_packets, | 540 int num_retransmitted_packets, |
| 540 int num_retransmitted_bytes, | 541 int num_retransmitted_bytes, |
| 541 QuicTime::Delta delta_largest_observed)); | 542 QuicTime::Delta delta_largest_observed)); |
| 542 | 543 |
| 543 protected: | 544 protected: |
| 544 // Object is ref counted. | 545 // Object is ref counted. |
| 545 virtual ~MockAckNotifierDelegate(); | 546 ~MockAckNotifierDelegate() override; |
| 546 | 547 |
| 547 private: | 548 private: |
| 548 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate); | 549 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate); |
| 549 }; | 550 }; |
| 550 | 551 |
| 551 class MockNetworkChangeVisitor : | 552 class MockNetworkChangeVisitor : |
| 552 public QuicSentPacketManager::NetworkChangeVisitor { | 553 public QuicSentPacketManager::NetworkChangeVisitor { |
| 553 public: | 554 public: |
| 554 MockNetworkChangeVisitor(); | 555 MockNetworkChangeVisitor(); |
| 555 virtual ~MockNetworkChangeVisitor(); | 556 ~MockNetworkChangeVisitor() override; |
| 556 | 557 |
| 557 MOCK_METHOD0(OnCongestionWindowChange, void()); | 558 MOCK_METHOD0(OnCongestionWindowChange, void()); |
| 558 | 559 |
| 559 private: | 560 private: |
| 560 DISALLOW_COPY_AND_ASSIGN(MockNetworkChangeVisitor); | 561 DISALLOW_COPY_AND_ASSIGN(MockNetworkChangeVisitor); |
| 561 }; | 562 }; |
| 562 | 563 |
| 563 // Creates per-connection packet writers that register themselves with the | 564 // Creates per-connection packet writers that register themselves with the |
| 564 // TestWriterFactory on each write so that TestWriterFactory::OnPacketSent can | 565 // TestWriterFactory on each write so that TestWriterFactory::OnPacketSent can |
| 565 // be routed to the appropriate QuicConnection. | 566 // be routed to the appropriate QuicConnection. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 596 // clears the pointer to it to prevent use-after-free. | 597 // clears the pointer to it to prevent use-after-free. |
| 597 void Unregister(PerConnectionPacketWriter* writer); | 598 void Unregister(PerConnectionPacketWriter* writer); |
| 598 | 599 |
| 599 PerConnectionPacketWriter* current_writer_; | 600 PerConnectionPacketWriter* current_writer_; |
| 600 }; | 601 }; |
| 601 | 602 |
| 602 } // namespace test | 603 } // namespace test |
| 603 } // namespace net | 604 } // namespace net |
| 604 | 605 |
| 605 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 606 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |