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 { |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 TEST(QuicClockTest, WallNow) { | 23 TEST(QuicClockTest, WallNow) { |
24 QuicClock clock; | 24 QuicClock clock; |
25 | 25 |
26 base::Time start = base::Time::Now(); | 26 base::Time start = base::Time::Now(); |
27 QuicWallTime now = clock.WallNow(); | 27 QuicWallTime now = clock.WallNow(); |
28 base::Time end = base::Time::Now(); | 28 base::Time end = base::Time::Now(); |
29 | 29 |
30 // If end > start, then we can check now is between start and end. | 30 // If end > start, then we can check now is between start and end. |
31 if (end > start) { | 31 if (end > start) { |
32 EXPECT_LE(static_cast<uint64>(start.ToInternalValue() / 1000000), | 32 EXPECT_LE(static_cast<uint64>(start.ToTimeT()), now.ToUNIXSeconds()); |
33 now.ToUNIXSeconds()); | 33 EXPECT_LE(now.ToUNIXSeconds(), static_cast<uint64>(end.ToTimeT())); |
34 EXPECT_LE(now.ToUNIXSeconds(), | |
35 static_cast<uint64>(end.ToInternalValue() / 1000000)); | |
36 } | 34 } |
37 } | 35 } |
38 | 36 |
39 } // namespace test | 37 } // namespace test |
40 } // namespace net | 38 } // namespace net |
OLD | NEW |