OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <math.h> | 5 #include <math.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 return testing::AssertionSuccess(); | 118 return testing::AssertionSuccess(); |
119 } | 119 } |
120 | 120 |
121 NetworkTimeTracker* network_time_tracker() { | 121 NetworkTimeTracker* network_time_tracker() { |
122 return network_time_tracker_.get(); | 122 return network_time_tracker_.get(); |
123 } | 123 } |
124 | 124 |
125 private: | 125 private: |
126 // Message loop and threads for the tracker's internal logic. | 126 // Message loop and threads for the tracker's internal logic. |
127 MessageLoop message_loop_; | 127 base::MessageLoop message_loop_; |
128 content::TestBrowserThread ui_thread; | 128 content::TestBrowserThread ui_thread; |
129 content::TestBrowserThread io_thread; | 129 content::TestBrowserThread io_thread; |
130 | 130 |
131 // Used in building the current time that |tick_clock_| reports. See Now() | 131 // Used in building the current time that |tick_clock_| reports. See Now() |
132 // for details. | 132 // for details. |
133 base::Time now_; | 133 base::Time now_; |
134 base::TimeTicks ticks_now_; | 134 base::TimeTicks ticks_now_; |
135 | 135 |
136 // A custom clock that allows arbitrary time delays. | 136 // A custom clock that allows arbitrary time delays. |
137 scoped_ptr<TestTickClock> tick_clock_; | 137 scoped_ptr<TestTickClock> tick_clock_; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // dereference the destroyed tracker. | 210 // dereference the destroyed tracker. |
211 TEST_F(NetworkTimeTrackerTest, UpdateAfterTrackerDestroyed) { | 211 TEST_F(NetworkTimeTrackerTest, UpdateAfterTrackerDestroyed) { |
212 StartTracker(); | 212 StartTracker(); |
213 StopTracker(); | 213 StopTracker(); |
214 UpdateNetworkTime( | 214 UpdateNetworkTime( |
215 Now(), | 215 Now(), |
216 base::TimeDelta::FromMilliseconds(kResolution1), | 216 base::TimeDelta::FromMilliseconds(kResolution1), |
217 base::TimeDelta::FromMilliseconds(kLatency1), | 217 base::TimeDelta::FromMilliseconds(kLatency1), |
218 TicksNow()); | 218 TicksNow()); |
219 } | 219 } |
OLD | NEW |