Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: net/quic/test_tools/mock_clock.cc

Issue 12334063: Land recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more EXPECT_FALSE Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/test_tools/mock_clock.h ('k') | net/quic/test_tools/mock_random.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "net/quic/test_tools/mock_clock.h" 5 #include "net/quic/test_tools/mock_clock.h"
6 6
7 namespace net { 7 namespace net {
8 8
9 MockClock::MockClock() : now_(QuicTime::Zero()) { 9 MockClock::MockClock() : now_(QuicTime::Zero()) {
10 } 10 }
11 11
12 MockClock::~MockClock() { 12 MockClock::~MockClock() {
13 } 13 }
14 14
15 void MockClock::AdvanceTime(QuicTime::Delta delta) { 15 void MockClock::AdvanceTime(QuicTime::Delta delta) {
16 CHECK_LE(0, delta.ToMicroseconds()); 16 CHECK_LE(0, delta.ToMicroseconds());
17 now_ = now_.Add(delta); 17 now_ = now_.Add(delta);
18 } 18 }
19 19
20 QuicTime MockClock::Now() const { 20 QuicTime MockClock::Now() const {
21 return now_; 21 return now_;
22 } 22 }
23 23
24 QuicTime MockClock::ApproximateNow() const {
25 return now_;
26 }
27
24 QuicTime::Delta MockClock::NowAsDeltaSinceUnixEpoch() const { 28 QuicTime::Delta MockClock::NowAsDeltaSinceUnixEpoch() const {
25 return now_.Subtract(QuicTime::Zero()); 29 return now_.Subtract(QuicTime::Zero());
26 } 30 }
27 31
28 base::TimeTicks MockClock::NowInTicks() const { 32 base::TimeTicks MockClock::NowInTicks() const {
29 base::TimeTicks ticks; 33 base::TimeTicks ticks;
30 return ticks + base::TimeDelta::FromMicroseconds( 34 return ticks + base::TimeDelta::FromMicroseconds(
31 now_.Subtract(QuicTime::Zero()).ToMicroseconds()); 35 now_.Subtract(QuicTime::Zero()).ToMicroseconds());
32 } 36 }
33 37
34 } // namespace net 38 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/mock_clock.h ('k') | net/quic/test_tools/mock_random.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698