Re-land: C++ readability review
[chromium-blink-merge.git] / net / quic / quic_clock_test.cc
blob6ee4540889f7a1115f1962f5a216efb19c1d05f4
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.
5 #include "net/quic/quic_clock.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace net {
10 namespace test {
12 TEST(QuicClockTest, Now) {
13 QuicClock clock;
15 QuicTime start(base::TimeTicks::Now());
16 QuicTime now = clock.ApproximateNow();
17 QuicTime end(base::TimeTicks::Now());
19 EXPECT_LE(start, now);
20 EXPECT_LE(now, end);
23 TEST(QuicClockTest, WallNow) {
24 QuicClock clock;
26 base::Time start = base::Time::Now();
27 QuicWallTime now = clock.WallNow();
28 base::Time end = base::Time::Now();
30 // If end > start, then we can check now is between start and end.
31 if (end > start) {
32 EXPECT_LE(static_cast<uint64>(start.ToTimeT()), now.ToUNIXSeconds());
33 EXPECT_LE(now.ToUNIXSeconds(), static_cast<uint64>(end.ToTimeT()));
37 } // namespace test
38 } // namespace net