| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "net/nqe/network_quality_estimator_test_util.h" | 5 #include "net/nqe/network_quality_estimator_test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 void TestNetworkQualityEstimator:: | 278 void TestNetworkQualityEstimator:: |
| 279 NotifyObserversOfRTTOrThroughputEstimatesComputed( | 279 NotifyObserversOfRTTOrThroughputEstimatesComputed( |
| 280 const net::nqe::internal::NetworkQuality& network_quality) { | 280 const net::nqe::internal::NetworkQuality& network_quality) { |
| 281 for (auto& observer : rtt_and_throughput_estimates_observer_list_) { | 281 for (auto& observer : rtt_and_throughput_estimates_observer_list_) { |
| 282 observer.OnRTTOrThroughputEstimatesComputed( | 282 observer.OnRTTOrThroughputEstimatesComputed( |
| 283 network_quality.http_rtt(), network_quality.transport_rtt(), | 283 network_quality.http_rtt(), network_quality.transport_rtt(), |
| 284 network_quality.downstream_throughput_kbps()); | 284 network_quality.downstream_throughput_kbps()); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 void TestNetworkQualityEstimator::NotifyObserversOfEffectiveConnectionType( |
| 289 EffectiveConnectionType type) { |
| 290 for (auto& observer : effective_connection_type_observer_list_) |
| 291 observer.OnEffectiveConnectionTypeChanged(type); |
| 292 } |
| 293 |
| 288 nqe::internal::NetworkID TestNetworkQualityEstimator::GetCurrentNetworkID() | 294 nqe::internal::NetworkID TestNetworkQualityEstimator::GetCurrentNetworkID() |
| 289 const { | 295 const { |
| 290 return nqe::internal::NetworkID(current_network_type_, current_network_id_); | 296 return nqe::internal::NetworkID(current_network_type_, current_network_id_); |
| 291 } | 297 } |
| 292 | 298 |
| 293 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( | 299 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( |
| 294 const base::FilePath& document_root) { | 300 const base::FilePath& document_root) { |
| 295 AddDefaultHandlers(document_root); | 301 AddDefaultHandlers(document_root); |
| 296 } | 302 } |
| 297 | 303 |
| 298 void TestNetworkQualityEstimator::NotifyObserversOfRTTOrThroughputComputed() | 304 void TestNetworkQualityEstimator::NotifyObserversOfRTTOrThroughputComputed() |
| 299 const { | 305 const { |
| 300 if (suppress_notifications_for_testing_) | 306 if (suppress_notifications_for_testing_) |
| 301 return; | 307 return; |
| 302 | 308 |
| 303 NetworkQualityEstimator::NotifyObserversOfRTTOrThroughputComputed(); | 309 NetworkQualityEstimator::NotifyObserversOfRTTOrThroughputComputed(); |
| 304 } | 310 } |
| 305 | 311 |
| 306 void TestNetworkQualityEstimator:: | 312 void TestNetworkQualityEstimator:: |
| 307 NotifyRTTAndThroughputEstimatesObserverIfPresent( | 313 NotifyRTTAndThroughputEstimatesObserverIfPresent( |
| 308 RTTAndThroughputEstimatesObserver* observer) const { | 314 RTTAndThroughputEstimatesObserver* observer) const { |
| 309 if (suppress_notifications_for_testing_) | 315 if (suppress_notifications_for_testing_) |
| 310 return; | 316 return; |
| 311 | 317 |
| 312 NetworkQualityEstimator::NotifyRTTAndThroughputEstimatesObserverIfPresent( | 318 NetworkQualityEstimator::NotifyRTTAndThroughputEstimatesObserverIfPresent( |
| 313 observer); | 319 observer); |
| 314 } | 320 } |
| 315 | 321 |
| 316 } // namespace net | 322 } // namespace net |
| OLD | NEW |