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

Side by Side Diff: components/network_time/network_time_tracker_unittest.cc

Issue 296453005: Componentize chrome/browser/network_time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix iOS Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « components/network_time/network_time_tracker.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/network_time/network_time_tracker.h" 5 #include "components/network_time/network_time_tracker.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
11 #include "base/time/tick_clock.h" 11 #include "base/time/tick_clock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace network_time {
15
14 namespace { 16 namespace {
15 17
16 // These are all in milliseconds. 18 // These are all in milliseconds.
17 const int64 kLatency1 = 50; 19 const int64 kLatency1 = 50;
18 const int64 kLatency2 = 500; 20 const int64 kLatency2 = 500;
19 21
20 // Can not be smaller than 15, it's the NowFromSystemTime() resolution. 22 // Can not be smaller than 15, it's the NowFromSystemTime() resolution.
21 const int64 kResolution1 = 17; 23 const int64 kResolution1 = 17;
22 const int64 kResolution2 = 177; 24 const int64 kResolution2 = 177;
23 25
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::Time old_now = Now(); 152 base::Time old_now = Now();
151 base::TimeTicks old_ticks = TicksNow(); 153 base::TimeTicks old_ticks = TicksNow();
152 AddToTicksNow(kPseudoSleepTime2); 154 AddToTicksNow(kPseudoSleepTime2);
153 UpdateNetworkTime( 155 UpdateNetworkTime(
154 old_now, 156 old_now,
155 base::TimeDelta::FromMilliseconds(kResolution2), 157 base::TimeDelta::FromMilliseconds(kResolution2),
156 base::TimeDelta::FromMilliseconds(kLatency2), 158 base::TimeDelta::FromMilliseconds(kLatency2),
157 old_ticks); 159 old_ticks);
158 EXPECT_TRUE(ValidateExpectedTime()); 160 EXPECT_TRUE(ValidateExpectedTime());
159 } 161 }
162
163 } // namespace network_time
OLDNEW
« no previous file with comments | « components/network_time/network_time_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698