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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 void RemoveNetworkQualitiesCacheObserver( | 334 void RemoveNetworkQualitiesCacheObserver( |
335 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* | 335 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* |
336 observer); | 336 observer); |
337 | 337 |
338 // Called when the persistent prefs have been read. |read_prefs| contains the | 338 // Called when the persistent prefs have been read. |read_prefs| contains the |
339 // parsed prefs as a map between NetworkIDs and CachedNetworkQualities. | 339 // parsed prefs as a map between NetworkIDs and CachedNetworkQualities. |
340 void OnPrefsRead( | 340 void OnPrefsRead( |
341 const std::map<nqe::internal::NetworkID, | 341 const std::map<nqe::internal::NetworkID, |
342 nqe::internal::CachedNetworkQuality> read_prefs); | 342 nqe::internal::CachedNetworkQuality> read_prefs); |
343 | 343 |
| 344 // Prevents |this| from sending any notifications to the observers. |
| 345 void SuppressNotificationsForTesting(); |
| 346 |
344 protected: | 347 protected: |
345 // A protected constructor for testing that allows setting the value of | 348 // A protected constructor for testing that allows setting the value of |
346 // |add_default_platform_observations_|. | 349 // |add_default_platform_observations_|. |
347 NetworkQualityEstimator( | 350 NetworkQualityEstimator( |
348 std::unique_ptr<ExternalEstimateProvider> external_estimates_provider, | 351 std::unique_ptr<ExternalEstimateProvider> external_estimates_provider, |
349 const std::map<std::string, std::string>& variation_params, | 352 const std::map<std::string, std::string>& variation_params, |
350 bool use_local_host_requests_for_tests, | 353 bool use_local_host_requests_for_tests, |
351 bool use_smaller_responses_for_tests, | 354 bool use_smaller_responses_for_tests, |
352 bool add_default_platform_observations, | 355 bool add_default_platform_observations, |
353 const NetLogWithSource& net_log); | 356 const NetLogWithSource& net_log); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 // Vector that contains observation sources that should not be used when | 805 // Vector that contains observation sources that should not be used when |
803 // computing the estimate at HTTP layer. | 806 // computing the estimate at HTTP layer. |
804 const std::vector<NetworkQualityObservationSource> | 807 const std::vector<NetworkQualityObservationSource> |
805 disallowed_observation_sources_for_http_; | 808 disallowed_observation_sources_for_http_; |
806 | 809 |
807 // Vector that contains observation sources that should not be used when | 810 // Vector that contains observation sources that should not be used when |
808 // computing the estimate at transport layer. | 811 // computing the estimate at transport layer. |
809 const std::vector<NetworkQualityObservationSource> | 812 const std::vector<NetworkQualityObservationSource> |
810 disallowed_observation_sources_for_transport_; | 813 disallowed_observation_sources_for_transport_; |
811 | 814 |
| 815 // If true, notifications are not sent to any of the observers. |
| 816 bool suppress_notifications_for_testing_; |
| 817 |
812 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 818 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
813 | 819 |
814 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 820 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
815 }; | 821 }; |
816 | 822 |
817 } // namespace net | 823 } // namespace net |
818 | 824 |
819 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 825 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |