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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 DISALLOW_COPY_AND_ASSIGN(MockConnectionVisitor); | 295 DISALLOW_COPY_AND_ASSIGN(MockConnectionVisitor); |
296 }; | 296 }; |
297 | 297 |
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 QuicArenaScopedPtr<QuicAlarm> CreateAlarm( |
| 306 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, |
| 307 QuicConnectionArena* arena) override; |
305 QuicBufferAllocator* GetBufferAllocator() override; | 308 QuicBufferAllocator* GetBufferAllocator() override; |
306 void AdvanceTime(QuicTime::Delta delta); | 309 void AdvanceTime(QuicTime::Delta delta); |
307 | 310 |
308 // No-op alarm implementation | 311 // No-op alarm implementation |
309 class TestAlarm : public QuicAlarm { | 312 class TestAlarm : public QuicAlarm { |
310 public: | 313 public: |
311 explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {} | 314 explicit TestAlarm(QuicArenaScopedPtr<QuicAlarm::Delegate> delegate) |
| 315 : QuicAlarm(std::move(delegate)) {} |
312 | 316 |
313 void SetImpl() override {} | 317 void SetImpl() override {} |
314 void CancelImpl() override {} | 318 void CancelImpl() override {} |
315 | 319 |
316 using QuicAlarm::Fire; | 320 using QuicAlarm::Fire; |
317 }; | 321 }; |
318 | 322 |
319 void FireAlarm(QuicAlarm* alarm) { | 323 void FireAlarm(QuicAlarm* alarm) { |
320 reinterpret_cast<TestAlarm*>(alarm)->Fire(); | 324 reinterpret_cast<TestAlarm*>(alarm)->Fire(); |
321 } | 325 } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 TestQuicSpdyServerSession** server_session); | 798 TestQuicSpdyServerSession** server_session); |
795 | 799 |
796 // Helper to generate client side stream ids, generalizes | 800 // Helper to generate client side stream ids, generalizes |
797 // kClientDataStreamId1 etc. above. | 801 // kClientDataStreamId1 etc. above. |
798 QuicStreamId QuicClientDataStreamId(int i); | 802 QuicStreamId QuicClientDataStreamId(int i); |
799 | 803 |
800 } // namespace test | 804 } // namespace test |
801 } // namespace net | 805 } // namespace net |
802 | 806 |
803 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 807 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |