| 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/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
| 10 #include "net/test/embedded_test_server/http_response.h" | 10 #include "net/test/embedded_test_server/http_response.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 EffectiveConnectionType | 104 EffectiveConnectionType |
| 105 TestNetworkQualityEstimator::GetRecentEffectiveConnectionType( | 105 TestNetworkQualityEstimator::GetRecentEffectiveConnectionType( |
| 106 const base::TimeTicks& start_time) const { | 106 const base::TimeTicks& start_time) const { |
| 107 if (recent_effective_connection_type_set_) | 107 if (recent_effective_connection_type_set_) |
| 108 return recent_effective_connection_type_; | 108 return recent_effective_connection_type_; |
| 109 return NetworkQualityEstimator::GetRecentEffectiveConnectionType(start_time); | 109 return NetworkQualityEstimator::GetRecentEffectiveConnectionType(start_time); |
| 110 } | 110 } |
| 111 | 111 |
| 112 EffectiveConnectionType |
| 113 TestNetworkQualityEstimator::GetRecentEffectiveConnectionTypeAndNetworkQuality( |
| 114 const base::TimeTicks& start_time, |
| 115 base::TimeDelta* http_rtt, |
| 116 base::TimeDelta* transport_rtt, |
| 117 int32_t* downstream_throughput_kbps) const { |
| 118 if (recent_effective_connection_type_set_) { |
| 119 *http_rtt = recent_http_rtt_; |
| 120 *transport_rtt = recent_transport_rtt_; |
| 121 *downstream_throughput_kbps = recent_downlink_throughput_kbps_; |
| 122 return recent_effective_connection_type_; |
| 123 } |
| 124 return NetworkQualityEstimator:: |
| 125 GetRecentEffectiveConnectionTypeAndNetworkQuality( |
| 126 start_time, http_rtt, transport_rtt, downstream_throughput_kbps); |
| 127 } |
| 128 |
| 112 bool TestNetworkQualityEstimator::GetHttpRTT(base::TimeDelta* rtt) const { | 129 bool TestNetworkQualityEstimator::GetHttpRTT(base::TimeDelta* rtt) const { |
| 113 if (http_rtt_set_) { | 130 if (http_rtt_set_) { |
| 114 *rtt = http_rtt_; | 131 *rtt = http_rtt_; |
| 115 return true; | 132 return true; |
| 116 } | 133 } |
| 117 return NetworkQualityEstimator::GetHttpRTT(rtt); | 134 return NetworkQualityEstimator::GetHttpRTT(rtt); |
| 118 } | 135 } |
| 119 | 136 |
| 120 bool TestNetworkQualityEstimator::GetRecentHttpRTT( | 137 bool TestNetworkQualityEstimator::GetRecentHttpRTT( |
| 121 const base::TimeTicks& start_time, | 138 const base::TimeTicks& start_time, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 double TestNetworkQualityEstimator::RandDouble() const { | 199 double TestNetworkQualityEstimator::RandDouble() const { |
| 183 return rand_double_; | 200 return rand_double_; |
| 184 } | 201 } |
| 185 | 202 |
| 186 nqe::internal::NetworkID TestNetworkQualityEstimator::GetCurrentNetworkID() | 203 nqe::internal::NetworkID TestNetworkQualityEstimator::GetCurrentNetworkID() |
| 187 const { | 204 const { |
| 188 return nqe::internal::NetworkID(current_network_type_, current_network_id_); | 205 return nqe::internal::NetworkID(current_network_type_, current_network_id_); |
| 189 } | 206 } |
| 190 | 207 |
| 191 } // namespace net | 208 } // namespace net |
| OLD | NEW |