| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 class MockConnectionHelper : public QuicConnectionHelperInterface { | 298 class MockConnectionHelper : public QuicConnectionHelperInterface { |
| 299 public: | 299 public: |
| 300 MockConnectionHelper(); | 300 MockConnectionHelper(); |
| 301 ~MockConnectionHelper() override; | 301 ~MockConnectionHelper() override; |
| 302 const QuicClock* GetClock() const override; | 302 const QuicClock* GetClock() const override; |
| 303 QuicRandom* GetRandomGenerator() override; | 303 QuicRandom* GetRandomGenerator() override; |
| 304 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; | 304 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; |
| 305 QuicBufferAllocator* GetBufferAllocator() override; | 305 QuicBufferAllocator* GetBufferAllocator() override; |
| 306 void AdvanceTime(QuicTime::Delta delta); | 306 void AdvanceTime(QuicTime::Delta delta); |
| 307 | 307 |
| 308 // No-op alarm implementation |
| 309 class TestAlarm : public QuicAlarm { |
| 310 public: |
| 311 explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {} |
| 312 |
| 313 void SetImpl() override {} |
| 314 void CancelImpl() override {} |
| 315 |
| 316 using QuicAlarm::Fire; |
| 317 }; |
| 318 |
| 319 void FireAlarm(QuicAlarm* alarm) { |
| 320 reinterpret_cast<TestAlarm*>(alarm)->Fire(); |
| 321 } |
| 322 |
| 308 private: | 323 private: |
| 309 MockClock clock_; | 324 MockClock clock_; |
| 310 MockRandom random_generator_; | 325 MockRandom random_generator_; |
| 311 SimpleBufferAllocator buffer_allocator_; | 326 SimpleBufferAllocator buffer_allocator_; |
| 312 | 327 |
| 313 DISALLOW_COPY_AND_ASSIGN(MockConnectionHelper); | 328 DISALLOW_COPY_AND_ASSIGN(MockConnectionHelper); |
| 314 }; | 329 }; |
| 315 | 330 |
| 316 class NiceMockPacketWriterFactory : public QuicConnection::PacketWriterFactory { | 331 class NiceMockPacketWriterFactory : public QuicConnection::PacketWriterFactory { |
| 317 public: | 332 public: |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 TestQuicSpdyServerSession** server_session); | 839 TestQuicSpdyServerSession** server_session); |
| 825 | 840 |
| 826 // Helper to generate client side stream ids, generalizes | 841 // Helper to generate client side stream ids, generalizes |
| 827 // kClientDataStreamId1 etc. above. | 842 // kClientDataStreamId1 etc. above. |
| 828 QuicStreamId QuicClientDataStreamId(int i); | 843 QuicStreamId QuicClientDataStreamId(int i); |
| 829 | 844 |
| 830 } // namespace test | 845 } // namespace test |
| 831 } // namespace net | 846 } // namespace net |
| 832 | 847 |
| 833 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 848 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |