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

Side by Side Diff: net/tools/quic/quic_epoll_clock_test.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « net/tools/quic/quic_epoll_clock.cc ('k') | net/tools/quic/quic_epoll_connection_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "net/tools/quic/quic_epoll_clock.h"
6
7 #include "net/tools/quic/test_tools/mock_epoll_server.h"
8 #include "testing/gmock/include/gmock/gmock.h"
9
10 namespace net {
11 namespace tools {
12 namespace test {
13
14 TEST(QuicEpollClockTest, ApproximateNowInUsec) {
15 MockEpollServer epoll_server;
16 QuicEpollClock clock(&epoll_server);
17
18 epoll_server.set_now_in_usec(1000000);
19 EXPECT_EQ(1000000,
20 clock.ApproximateNow().Subtract(QuicTime::Zero()).ToMicroseconds());
21
22 epoll_server.AdvanceBy(5);
23 EXPECT_EQ(1000005,
24 clock.ApproximateNow().Subtract(QuicTime::Zero()).ToMicroseconds());
25 }
26
27 TEST(QuicEpollClockTest, NowInUsec) {
28 MockEpollServer epoll_server;
29 QuicEpollClock clock(&epoll_server);
30
31 epoll_server.set_now_in_usec(1000000);
32 EXPECT_EQ(1000000,
33 clock.Now().Subtract(QuicTime::Zero()).ToMicroseconds());
34
35 epoll_server.AdvanceBy(5);
36 EXPECT_EQ(1000005,
37 clock.Now().Subtract(QuicTime::Zero()).ToMicroseconds());
38 }
39
40 TEST(QuicEpollClockTest, WallNow) {
41 MockEpollServer epoll_server;
42 QuicEpollClock clock(&epoll_server);
43
44 base::Time start = base::Time::Now();
45 QuicWallTime now = clock.WallNow();
46 base::Time end = base::Time::Now();
47
48 // If end > start, then we can check now is between start and end.
49 if (end > start) {
50 EXPECT_LE(static_cast<uint64>(start.ToTimeT()), now.ToUNIXSeconds());
51 EXPECT_LE(now.ToUNIXSeconds(), static_cast<uint64>(end.ToTimeT()));
52 }
53 }
54
55 } // namespace test
56 } // namespace tools
57 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_epoll_clock.cc ('k') | net/tools/quic/quic_epoll_connection_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698