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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bool QueryTimeServiceForTesting(); | 133 bool QueryTimeServiceForTesting(); |
134 | 134 |
135 void WaitForFetchForTesting(uint32_t nonce); | 135 void WaitForFetchForTesting(uint32_t nonce); |
136 | 136 |
| 137 void OverrideNonceForTesting(uint32_t nonce); |
| 138 |
137 base::TimeDelta GetTimerDelayForTesting() const; | 139 base::TimeDelta GetTimerDelayForTesting() const; |
138 | 140 |
139 private: | 141 private: |
140 // Checks whether a network time query should be issued, and issues one if so. | 142 // Checks whether a network time query should be issued, and issues one if so. |
141 // Upon response, execution resumes in |OnURLFetchComplete|. | 143 // Upon response, execution resumes in |OnURLFetchComplete|. |
142 void CheckTime(); | 144 void CheckTime(); |
143 | 145 |
144 // Updates network time from a time server response, returning true | 146 // Updates network time from a time server response, returning true |
145 // if successful. | 147 // if successful. |
146 bool UpdateTimeFromResponse(); | 148 bool UpdateTimeFromResponse(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 std::vector<base::Closure> fetch_completion_callbacks_; | 203 std::vector<base::Closure> fetch_completion_callbacks_; |
202 | 204 |
203 base::ThreadChecker thread_checker_; | 205 base::ThreadChecker thread_checker_; |
204 | 206 |
205 DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker); | 207 DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker); |
206 }; | 208 }; |
207 | 209 |
208 } // namespace network_time | 210 } // namespace network_time |
209 | 211 |
210 #endif // COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ | 212 #endif // COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ |
OLD | NEW |