xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/test_tools/mock_clock.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_TEST_TOOLS_MOCK_CLOCK_H_
6 #define QUICHE_QUIC_TEST_TOOLS_MOCK_CLOCK_H_
7 
8 #include "quiche/quic/core/quic_clock.h"
9 #include "quiche/quic/core/quic_time.h"
10 
11 namespace quic {
12 
13 class MockClock : public QuicClock {
14  public:
15   MockClock();
16   MockClock(const MockClock&) = delete;
17   MockClock& operator=(const MockClock&) = delete;
18   ~MockClock() override;
19 
20   // QuicClock implementation:
21   QuicTime Now() const override;
22   QuicTime ApproximateNow() const override;
23   QuicWallTime WallNow() const override;
24 
25   // Advances the current time by |delta|, which may be negative.
26   void AdvanceTime(QuicTime::Delta delta);
27   // Resets time back to zero.
28   void Reset();
29 
30  private:
31   QuicTime now_;
32 };
33 
34 }  // namespace quic
35 
36 #endif  // QUICHE_QUIC_TEST_TOOLS_MOCK_CLOCK_H_
37