| 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 #include "net/quic/quic_clock.h" | 5 #include "net/quic/quic_clock.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 namespace test { | 10 namespace test { |
| 11 | 11 |
| 12 TEST(QuicClockTest, Now) { | 12 TEST(QuicClockTest, Now) { |
| 13 QuicClock clock; | 13 QuicClock clock; |
| 14 | 14 |
| 15 QuicTime start(base::TimeTicks::Now()); | 15 QuicTime start(base::TimeTicks::Now()); |
| 16 QuicTime now = clock.Now(); | 16 QuicTime now = clock.ApproximateNow(); |
| 17 QuicTime end(base::TimeTicks::Now()); | 17 QuicTime end(base::TimeTicks::Now()); |
| 18 | 18 |
| 19 EXPECT_LE(start, now); | 19 EXPECT_LE(start, now); |
| 20 EXPECT_LE(now, end); | 20 EXPECT_LE(now, end); |
| 21 } | 21 } |
| 22 | 22 |
| 23 TEST(QuicClockTest, NowAsDeltaSinceUnixEpoch) { | 23 TEST(QuicClockTest, NowAsDeltaSinceUnixEpoch) { |
| 24 QuicClock clock; | 24 QuicClock clock; |
| 25 | 25 |
| 26 QuicTime::Delta start(base::Time::Now() - base::Time::UnixEpoch()); | 26 QuicTime::Delta start(base::Time::Now() - base::Time::UnixEpoch()); |
| 27 QuicTime::Delta now = clock.NowAsDeltaSinceUnixEpoch(); | 27 QuicTime::Delta now = clock.NowAsDeltaSinceUnixEpoch(); |
| 28 QuicTime::Delta end(base::Time::Now() - base::Time::UnixEpoch()); | 28 QuicTime::Delta end(base::Time::Now() - base::Time::UnixEpoch()); |
| 29 | 29 |
| 30 EXPECT_LE(start, now); | 30 EXPECT_LE(start, now); |
| 31 EXPECT_LE(now, end); | 31 EXPECT_LE(now, end); |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace test | 34 } // namespace test |
| 35 } // namespace net | 35 } // namespace net |
| OLD | NEW |