| 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 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ |
| 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // lower-layer metrics. | 161 // lower-layer metrics. |
| 162 DCHECK(!effective_connection_type_ && !recent_effective_connection_type_); | 162 DCHECK(!effective_connection_type_ && !recent_effective_connection_type_); |
| 163 recent_downlink_throughput_kbps_ = recent_downlink_throughput_kbps; | 163 recent_downlink_throughput_kbps_ = recent_downlink_throughput_kbps; |
| 164 } | 164 } |
| 165 // Returns the downlink throughput that was set using | 165 // Returns the downlink throughput that was set using |
| 166 // |set_recent_downlink_throughput_kbps|. If the downlink throughput has not | 166 // |set_recent_downlink_throughput_kbps|. If the downlink throughput has not |
| 167 // been set, then the base implementation is called. | 167 // been set, then the base implementation is called. |
| 168 bool GetRecentDownlinkThroughputKbps(const base::TimeTicks& start_time, | 168 bool GetRecentDownlinkThroughputKbps(const base::TimeTicks& start_time, |
| 169 int32_t* kbps) const override; | 169 int32_t* kbps) const override; |
| 170 | 170 |
| 171 // Returns the recent HTTP RTT value that was set using |
| 172 // |set_rtt_estimate_internal|. If it has not been set, then the base |
| 173 // implementation is called. |
| 174 base::TimeDelta GetRTTEstimateInternal( |
| 175 const std::vector<NetworkQualityObservationSource>& |
| 176 disallowed_observation_sources, |
| 177 base::TimeTicks start_time, |
| 178 const base::Optional<NetworkQualityEstimator::Statistic>& statistic, |
| 179 int percentile) const override; |
| 180 |
| 181 void set_rtt_estimate_internal(base::TimeDelta value) { |
| 182 rtt_estimate_internal_ = value; |
| 183 } |
| 184 |
| 171 void SetAccuracyRecordingIntervals( | 185 void SetAccuracyRecordingIntervals( |
| 172 const std::vector<base::TimeDelta>& accuracy_recording_intervals); | 186 const std::vector<base::TimeDelta>& accuracy_recording_intervals); |
| 173 | 187 |
| 174 const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() | 188 const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() |
| 175 const override; | 189 const override; |
| 176 | 190 |
| 177 void set_rand_double(double rand_double) { rand_double_ = rand_double; } | 191 void set_rand_double(double rand_double) { rand_double_ = rand_double; } |
| 178 | 192 |
| 179 double RandDouble() const override; | 193 double RandDouble() const override; |
| 180 | 194 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 base::Optional<base::TimeDelta> start_time_null_transport_rtt_; | 241 base::Optional<base::TimeDelta> start_time_null_transport_rtt_; |
| 228 base::Optional<base::TimeDelta> recent_transport_rtt_; | 242 base::Optional<base::TimeDelta> recent_transport_rtt_; |
| 229 | 243 |
| 230 // If set, GetRecentDownlinkThroughputKbps() would return one of the set | 244 // If set, GetRecentDownlinkThroughputKbps() would return one of the set |
| 231 // values. |start_time_null_downlink_throughput_kbps_| is returned if the | 245 // values. |start_time_null_downlink_throughput_kbps_| is returned if the |
| 232 // |start_time| is null. Otherwise, |recent_downlink_throughput_kbps_| is | 246 // |start_time| is null. Otherwise, |recent_downlink_throughput_kbps_| is |
| 233 // returned. | 247 // returned. |
| 234 base::Optional<int32_t> start_time_null_downlink_throughput_kbps_; | 248 base::Optional<int32_t> start_time_null_downlink_throughput_kbps_; |
| 235 base::Optional<int32_t> recent_downlink_throughput_kbps_; | 249 base::Optional<int32_t> recent_downlink_throughput_kbps_; |
| 236 | 250 |
| 251 // If set, GetRTTEstimateInternal() would return the set value. |
| 252 base::Optional<base::TimeDelta> rtt_estimate_internal_; |
| 253 |
| 237 double rand_double_; | 254 double rand_double_; |
| 238 | 255 |
| 239 LocalHttpTestServer embedded_test_server_; | 256 LocalHttpTestServer embedded_test_server_; |
| 240 | 257 |
| 241 // Net log provided to network quality estimator. | 258 // Net log provided to network quality estimator. |
| 242 std::unique_ptr<net::BoundTestNetLog> net_log_; | 259 std::unique_ptr<net::BoundTestNetLog> net_log_; |
| 243 | 260 |
| 244 DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityEstimator); | 261 DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityEstimator); |
| 245 }; | 262 }; |
| 246 | 263 |
| 247 } // namespace net | 264 } // namespace net |
| 248 | 265 |
| 249 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ | 266 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ |
| OLD | NEW |