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

Side by Side Diff: net/quic/platform/impl/quic_chromium_clock_test.cc

Issue 2871573009: Use clock_gettime instead of base::TimeTicks::Now() in QUIC (Closed)
Patch Set: Fallback Created 3 years, 7 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
« no previous file with comments | « net/quic/platform/impl/quic_chromium_clock.cc ('k') | no next file » | 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/platform/impl/quic_chromium_clock.h" 5 #include "net/quic/platform/impl/quic_chromium_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(QuicChromiumClockTest, Now) { 12 TEST(QuicChromiumClockTest, Now) {
13 QuicChromiumClock clock; 13 QuicChromiumClock clock;
14 14
15 QuicTime start(base::TimeTicks::Now()); 15 QuicTime start = clock.Now();
16 QuicTime now = clock.ApproximateNow(); 16 QuicTime now = clock.ApproximateNow();
17 QuicTime end(base::TimeTicks::Now()); 17 QuicTime end = clock.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(QuicChromiumClockTest, WallNow) { 23 TEST(QuicChromiumClockTest, WallNow) {
24 QuicChromiumClock clock; 24 QuicChromiumClock 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_t>(start.ToTimeT()), now.ToUNIXSeconds()); 32 EXPECT_LE(static_cast<uint64_t>(start.ToTimeT()), now.ToUNIXSeconds());
33 EXPECT_LE(now.ToUNIXSeconds(), static_cast<uint64_t>(end.ToTimeT())); 33 EXPECT_LE(now.ToUNIXSeconds(), static_cast<uint64_t>(end.ToTimeT()));
34 } 34 }
35 } 35 }
36 36
37 } // namespace test 37 } // namespace test
38 } // namespace net 38 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/platform/impl/quic_chromium_clock.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698