| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 258   QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; | 258   QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; | 
| 259   void AdvanceTime(QuicTime::Delta delta); | 259   void AdvanceTime(QuicTime::Delta delta); | 
| 260 | 260 | 
| 261  private: | 261  private: | 
| 262   MockClock clock_; | 262   MockClock clock_; | 
| 263   MockRandom random_generator_; | 263   MockRandom random_generator_; | 
| 264 | 264 | 
| 265   DISALLOW_COPY_AND_ASSIGN(MockHelper); | 265   DISALLOW_COPY_AND_ASSIGN(MockHelper); | 
| 266 }; | 266 }; | 
| 267 | 267 | 
|  | 268 class NiceMockPacketWriterFactory : public QuicConnection::PacketWriterFactory { | 
|  | 269  public: | 
|  | 270   NiceMockPacketWriterFactory() {} | 
|  | 271   ~NiceMockPacketWriterFactory() override {} | 
|  | 272 | 
|  | 273   QuicPacketWriter* Create(QuicConnection* /*connection*/) const override; | 
|  | 274 | 
|  | 275  private: | 
|  | 276   DISALLOW_COPY_AND_ASSIGN(NiceMockPacketWriterFactory); | 
|  | 277 }; | 
|  | 278 | 
| 268 class MockConnection : public QuicConnection { | 279 class MockConnection : public QuicConnection { | 
| 269  public: | 280  public: | 
| 270   // Uses a MockHelper, ConnectionId of 42, and 127.0.0.1:123. | 281   // Uses a MockHelper, ConnectionId of 42, and 127.0.0.1:123. | 
| 271   explicit MockConnection(bool is_server); | 282   explicit MockConnection(bool is_server); | 
| 272 | 283 | 
|  | 284   // Uses a MockHelper, ConnectionId of 42, and 127.0.0.1:123. | 
|  | 285   MockConnection(bool is_server, bool is_secure); | 
|  | 286 | 
| 273   // Uses a MockHelper, ConnectionId of 42. | 287   // Uses a MockHelper, ConnectionId of 42. | 
| 274   MockConnection(IPEndPoint address, bool is_server); | 288   MockConnection(IPEndPoint address, bool is_server); | 
| 275 | 289 | 
| 276   // Uses a MockHelper, and 127.0.0.1:123 | 290   // Uses a MockHelper, and 127.0.0.1:123 | 
| 277   MockConnection(QuicConnectionId connection_id, bool is_server); | 291   MockConnection(QuicConnectionId connection_id, bool is_server); | 
| 278 | 292 | 
| 279   // 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. | 
| 280   MockConnection(bool is_server, const QuicVersionVector& supported_versions); | 294   MockConnection(bool is_server, const QuicVersionVector& supported_versions); | 
| 281 | 295 | 
| 282   virtual ~MockConnection(); | 296   virtual ~MockConnection(); | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 430 | 444 | 
| 431  private: | 445  private: | 
| 432   DISALLOW_COPY_AND_ASSIGN(MockPacketWriter); | 446   DISALLOW_COPY_AND_ASSIGN(MockPacketWriter); | 
| 433 }; | 447 }; | 
| 434 | 448 | 
| 435 class MockSendAlgorithm : public SendAlgorithmInterface { | 449 class MockSendAlgorithm : public SendAlgorithmInterface { | 
| 436  public: | 450  public: | 
| 437   MockSendAlgorithm(); | 451   MockSendAlgorithm(); | 
| 438   virtual ~MockSendAlgorithm(); | 452   virtual ~MockSendAlgorithm(); | 
| 439 | 453 | 
| 440   MOCK_METHOD2(SetFromConfig, void(const QuicConfig& config, bool is_server)); | 454   MOCK_METHOD3(SetFromConfig, void(const QuicConfig& config, | 
|  | 455                                    bool is_server, | 
|  | 456                                    bool using_pacing)); | 
| 441   MOCK_METHOD1(SetNumEmulatedConnections, void(int num_connections)); | 457   MOCK_METHOD1(SetNumEmulatedConnections, void(int num_connections)); | 
| 442   MOCK_METHOD1(SetMaxPacketSize, void(QuicByteCount max_packet_size)); | 458   MOCK_METHOD1(SetMaxPacketSize, void(QuicByteCount max_packet_size)); | 
| 443   MOCK_METHOD2(OnIncomingQuicCongestionFeedbackFrame, | 459   MOCK_METHOD2(OnIncomingQuicCongestionFeedbackFrame, | 
| 444                void(const QuicCongestionFeedbackFrame&, | 460                void(const QuicCongestionFeedbackFrame&, | 
| 445                     QuicTime feedback_receive_time)); | 461                     QuicTime feedback_receive_time)); | 
| 446   MOCK_METHOD4(OnCongestionEvent, void(bool rtt_updated, | 462   MOCK_METHOD4(OnCongestionEvent, void(bool rtt_updated, | 
| 447                                        QuicByteCount bytes_in_flight, | 463                                        QuicByteCount bytes_in_flight, | 
| 448                                        const CongestionVector& acked_packets, | 464                                        const CongestionVector& acked_packets, | 
| 449                                        const CongestionVector& lost_packets)); | 465                                        const CongestionVector& lost_packets)); | 
| 450   MOCK_METHOD5(OnPacketSent, | 466   MOCK_METHOD5(OnPacketSent, | 
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 580   // clears the pointer to it to prevent use-after-free. | 596   // clears the pointer to it to prevent use-after-free. | 
| 581   void Unregister(PerConnectionPacketWriter* writer); | 597   void Unregister(PerConnectionPacketWriter* writer); | 
| 582 | 598 | 
| 583   PerConnectionPacketWriter* current_writer_; | 599   PerConnectionPacketWriter* current_writer_; | 
| 584 }; | 600 }; | 
| 585 | 601 | 
| 586 }  // namespace test | 602 }  // namespace test | 
| 587 }  // namespace net | 603 }  // namespace net | 
| 588 | 604 | 
| 589 #endif  // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 605 #endif  // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 
| OLD | NEW | 
|---|