OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // |use_smaller_responses_for_tests| should only be true when testing. | 226 // |use_smaller_responses_for_tests| should only be true when testing. |
227 // Allows the responses smaller than |kMinTransferSizeInBits| to be used for | 227 // Allows the responses smaller than |kMinTransferSizeInBits| to be used for |
228 // network quality estimation. | 228 // network quality estimation. |
229 void SetUseSmallResponsesForTesting(bool use_small_responses); | 229 void SetUseSmallResponsesForTesting(bool use_small_responses); |
230 | 230 |
231 // Reports |effective_connection_type| to all | 231 // Reports |effective_connection_type| to all |
232 // EffectiveConnectionTypeObservers. | 232 // EffectiveConnectionTypeObservers. |
233 void ReportEffectiveConnectionTypeForTesting( | 233 void ReportEffectiveConnectionTypeForTesting( |
234 EffectiveConnectionType effective_connection_type); | 234 EffectiveConnectionType effective_connection_type); |
235 | 235 |
| 236 // Adds and removes |observer| from the list of cache observers. |
| 237 void AddNetworkQualitiesCacheObserver( |
| 238 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* |
| 239 observer); |
| 240 void RemoveNetworkQualitiesCacheObserver( |
| 241 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* |
| 242 observer); |
| 243 |
236 protected: | 244 protected: |
237 // NetworkChangeNotifier::ConnectionTypeObserver implementation: | 245 // NetworkChangeNotifier::ConnectionTypeObserver implementation: |
238 void OnConnectionTypeChanged( | 246 void OnConnectionTypeChanged( |
239 NetworkChangeNotifier::ConnectionType type) override; | 247 NetworkChangeNotifier::ConnectionType type) override; |
240 | 248 |
241 // ExternalEstimateProvider::UpdatedEstimateObserver implementation. | 249 // ExternalEstimateProvider::UpdatedEstimateObserver implementation. |
242 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt, | 250 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt, |
243 int32_t downstream_throughput_kbps, | 251 int32_t downstream_throughput_kbps, |
244 int32_t upstream_throughput_kbps) override; | 252 int32_t upstream_throughput_kbps) override; |
245 | 253 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // prediction should be recorded. Virtualized for testing. | 301 // prediction should be recorded. Virtualized for testing. |
294 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() | 302 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() |
295 const; | 303 const; |
296 | 304 |
297 // Overrides the tick clock used by |this| for testing. | 305 // Overrides the tick clock used by |this| for testing. |
298 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); | 306 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); |
299 | 307 |
300 // Returns a random double in the range [0.0, 1.0). Virtualized for testing. | 308 // Returns a random double in the range [0.0, 1.0). Virtualized for testing. |
301 virtual double RandDouble() const; | 309 virtual double RandDouble() const; |
302 | 310 |
303 // Returns a pointer to |network_quality_store_|. Used only for testing. | |
304 nqe::internal::NetworkQualityStore* NetworkQualityStoreForTesting() const; | |
305 | |
306 private: | 311 private: |
307 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 312 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
308 AdaptiveRecomputationEffectiveConnectionType); | 313 AdaptiveRecomputationEffectiveConnectionType); |
309 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); | 314 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
310 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); | 315 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
311 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); | 316 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); |
312 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 317 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
313 ObtainAlgorithmToUseFromParams); | 318 ObtainAlgorithmToUseFromParams); |
314 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); | 319 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); |
315 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); | 320 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 base::ThreadChecker thread_checker_; | 648 base::ThreadChecker thread_checker_; |
644 | 649 |
645 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 650 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
646 | 651 |
647 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 652 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
648 }; | 653 }; |
649 | 654 |
650 } // namespace net | 655 } // namespace net |
651 | 656 |
652 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 657 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |