| Index: chrome/browser/net/nqe/ui_network_quality_estimator_service_test_util.cc
|
| diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service_test_util.cc b/chrome/browser/net/nqe/ui_network_quality_estimator_service_test_util.cc
|
| index fe3e55cb9248d53d068dd8bc8e5c53f518626571..d1eac6a2218bbf726ca4e3bd6713b8e79fca544c 100644
|
| --- a/chrome/browser/net/nqe/ui_network_quality_estimator_service_test_util.cc
|
| +++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service_test_util.cc
|
| @@ -28,6 +28,16 @@ void OverrideEffectiveConnectionTypeOnIO(net::EffectiveConnectionType type,
|
| network_quality_estimator->ReportEffectiveConnectionTypeForTesting(type);
|
| }
|
|
|
| +void OverrideRTTsAndWaitOnIO(base::TimeDelta rtt, IOThread* io_thread) {
|
| + if (!io_thread->globals()->network_quality_estimator)
|
| + return;
|
| + net::NetworkQualityEstimator* network_quality_estimator =
|
| + io_thread->globals()->network_quality_estimator.get();
|
| + if (!network_quality_estimator)
|
| + return;
|
| + network_quality_estimator->ReportRTTsAndThroughputForTesting(rtt, rtt, -1);
|
| +}
|
| +
|
| } // namespace
|
|
|
| void OverrideEffectiveConnectionTypeAndWait(net::EffectiveConnectionType type) {
|
| @@ -43,4 +53,16 @@ void OverrideEffectiveConnectionTypeAndWait(net::EffectiveConnectionType type) {
|
| run_loop.Run();
|
| }
|
|
|
| +void OverrideRTTsAndWait(base::TimeDelta rtt) {
|
| + // Block |run_loop| until OverrideRTTsAndWaitOnIO has completed.
|
| + // Any UI tasks posted by calling OverrideRTTsAndWaitOnIO will complete before
|
| + // the reply unblocks |run_loop|.
|
| + base::RunLoop run_loop;
|
| + content::BrowserThread::PostTaskAndReply(
|
| + content::BrowserThread::IO, FROM_HERE,
|
| + base::Bind(&OverrideRTTsAndWaitOnIO, rtt, g_browser_process->io_thread()),
|
| + run_loop.QuitClosure());
|
| + run_loop.Run();
|
| +}
|
| +
|
| } // namespace nqe_test_util
|
|
|