OLD | NEW |
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 #ifndef COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ | 5 #ifndef COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ |
6 #define COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ | 6 #define COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 base::TimeDelta resolution, | 123 base::TimeDelta resolution, |
124 base::TimeDelta latency, | 124 base::TimeDelta latency, |
125 base::TimeTicks post_time); | 125 base::TimeTicks post_time); |
126 | 126 |
127 void SetMaxResponseSizeForTesting(size_t limit); | 127 void SetMaxResponseSizeForTesting(size_t limit); |
128 | 128 |
129 void SetPublicKeyForTesting(const base::StringPiece& key); | 129 void SetPublicKeyForTesting(const base::StringPiece& key); |
130 | 130 |
131 void SetTimeServerURLForTesting(const GURL& url); | 131 void SetTimeServerURLForTesting(const GURL& url); |
132 | 132 |
| 133 GURL GetTimeServerURLForTesting() const; |
| 134 |
133 bool QueryTimeServiceForTesting(); | 135 bool QueryTimeServiceForTesting(); |
134 | 136 |
135 void WaitForFetchForTesting(uint32_t nonce); | 137 void WaitForFetchForTesting(uint32_t nonce); |
136 | 138 |
| 139 void OverrideNonceForTesting(uint32_t nonce); |
| 140 |
137 base::TimeDelta GetTimerDelayForTesting() const; | 141 base::TimeDelta GetTimerDelayForTesting() const; |
138 | 142 |
139 private: | 143 private: |
140 // Checks whether a network time query should be issued, and issues one if so. | 144 // Checks whether a network time query should be issued, and issues one if so. |
141 // Upon response, execution resumes in |OnURLFetchComplete|. | 145 // Upon response, execution resumes in |OnURLFetchComplete|. |
142 void CheckTime(); | 146 void CheckTime(); |
143 | 147 |
144 // Updates network time from a time server response, returning true | 148 // Updates network time from a time server response, returning true |
145 // if successful. | 149 // if successful. |
146 bool UpdateTimeFromResponse(); | 150 bool UpdateTimeFromResponse(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 std::vector<base::Closure> fetch_completion_callbacks_; | 205 std::vector<base::Closure> fetch_completion_callbacks_; |
202 | 206 |
203 base::ThreadChecker thread_checker_; | 207 base::ThreadChecker thread_checker_; |
204 | 208 |
205 DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker); | 209 DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker); |
206 }; | 210 }; |
207 | 211 |
208 } // namespace network_time | 212 } // namespace network_time |
209 | 213 |
210 #endif // COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ | 214 #endif // COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ |
OLD | NEW |