summaryrefslogtreecommitdiffstats
path: root/net/quic/test_tools/mock_clock.h
blob: 3a698692c9d7e8932726cad736b163e3983d78fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_QUIC_TEST_TOOLS_MOCK_CLOCK_H_
#define NET_QUIC_TEST_TOOLS_MOCK_CLOCK_H_

#include "net/quic/quic_clock.h"

#include "base/compiler_specific.h"
#include "base/time.h"

namespace net {

class MockClock : public QuicClock {
 public:
  MockClock();

  virtual ~MockClock();

  virtual uint64 NowInUsec() OVERRIDE;

  void AdvanceTime(WallTime delta) {
    uint64 delta_us = delta * base::Time::kMicrosecondsPerSecond;
    now_ += delta_us;
  }

 private:
  uint64 now_;
};

}  // namespace net

#endif  // NET_QUIC_TEST_TOOLS_MOCK_CLOCK_H_