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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/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"
(...skipping 12 matching lines...) Expand all
23 const int64 kResolution1 = 17; 23 const int64 kResolution1 = 17;
24 const int64 kResolution2 = 177; 24 const int64 kResolution2 = 177;
25 25
26 const int64 kPseudoSleepTime1 = 500000001; 26 const int64 kPseudoSleepTime1 = 500000001;
27 const int64 kPseudoSleepTime2 = 1888; 27 const int64 kPseudoSleepTime2 = 1888;
28 28
29 // A custom tick clock that will return an arbitrary time. 29 // A custom tick clock that will return an arbitrary time.
30 class TestTickClock : public base::TickClock { 30 class TestTickClock : public base::TickClock {
31 public: 31 public:
32 explicit TestTickClock(base::TimeTicks* ticks_now) : ticks_now_(ticks_now) {} 32 explicit TestTickClock(base::TimeTicks* ticks_now) : ticks_now_(ticks_now) {}
33 virtual ~TestTickClock() {} 33 ~TestTickClock() override {}
34 34
35 virtual base::TimeTicks NowTicks() override { 35 base::TimeTicks NowTicks() override { return *ticks_now_; }
36 return *ticks_now_;
37 }
38 36
39 private: 37 private:
40 base::TimeTicks* ticks_now_; 38 base::TimeTicks* ticks_now_;
41 }; 39 };
42 40
43 } // namespace 41 } // namespace
44 42
45 class NetworkTimeTrackerTest : public testing::Test { 43 class NetworkTimeTrackerTest : public testing::Test {
46 public: 44 public:
47 virtual ~NetworkTimeTrackerTest() {} 45 virtual ~NetworkTimeTrackerTest() {}
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 AddToTicksNow(kPseudoSleepTime2); 152 AddToTicksNow(kPseudoSleepTime2);
155 UpdateNetworkTime( 153 UpdateNetworkTime(
156 old_now, 154 old_now,
157 base::TimeDelta::FromMilliseconds(kResolution2), 155 base::TimeDelta::FromMilliseconds(kResolution2),
158 base::TimeDelta::FromMilliseconds(kLatency2), 156 base::TimeDelta::FromMilliseconds(kLatency2),
159 old_ticks); 157 old_ticks);
160 EXPECT_TRUE(ValidateExpectedTime()); 158 EXPECT_TRUE(ValidateExpectedTime());
161 } 159 }
162 160
163 } // namespace network_time 161 } // namespace network_time
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698