Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: net/nqe/network_quality_estimator_test_util.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/nqe/network_quality_estimator_test_util.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/network_quality_estimator_test_util.cc
diff --git a/net/nqe/network_quality_estimator_test_util.cc b/net/nqe/network_quality_estimator_test_util.cc
index 90083349f76497ffa83d7566a488eb6f5dad9e79..7294cffb9d701aefee94f5599b0d77f66a769c2a 100644
--- a/net/nqe/network_quality_estimator_test_util.cc
+++ b/net/nqe/network_quality_estimator_test_util.cc
@@ -30,18 +30,8 @@ TestNetworkQualityEstimator::TestNetworkQualityEstimator(
variation_params,
allow_local_host_requests_for_tests,
allow_smaller_responses_for_tests),
- effective_connection_type_set_(false),
- effective_connection_type_(EFFECTIVE_CONNECTION_TYPE_UNKNOWN),
- recent_effective_connection_type_set_(false),
- recent_effective_connection_type_(EFFECTIVE_CONNECTION_TYPE_UNKNOWN),
current_network_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN),
accuracy_recording_intervals_set_(false),
- http_rtt_set_(false),
- recent_http_rtt_set_(false),
- transport_rtt_set_(false),
- recent_transport_rtt_set_(false),
- downlink_throughput_kbps_set_(false),
- recent_downlink_throughput_kbps_set_(false),
rand_double_(0.0) {
// Set up the embedded test server.
embedded_test_server_.ServeFilesFromDirectory(
@@ -96,16 +86,16 @@ const GURL TestNetworkQualityEstimator::GetEchoURL() const {
EffectiveConnectionType
TestNetworkQualityEstimator::GetEffectiveConnectionType() const {
- if (effective_connection_type_set_)
- return effective_connection_type_;
+ if (effective_connection_type_)
+ return effective_connection_type_.value();
return NetworkQualityEstimator::GetEffectiveConnectionType();
}
EffectiveConnectionType
TestNetworkQualityEstimator::GetRecentEffectiveConnectionType(
const base::TimeTicks& start_time) const {
- if (recent_effective_connection_type_set_)
- return recent_effective_connection_type_;
+ if (recent_effective_connection_type_)
+ return recent_effective_connection_type_.value();
return NetworkQualityEstimator::GetRecentEffectiveConnectionType(start_time);
}
@@ -115,67 +105,66 @@ TestNetworkQualityEstimator::GetRecentEffectiveConnectionTypeAndNetworkQuality(
base::TimeDelta* http_rtt,
base::TimeDelta* transport_rtt,
int32_t* downstream_throughput_kbps) const {
- if (recent_effective_connection_type_set_) {
- *http_rtt = recent_http_rtt_;
- *transport_rtt = recent_transport_rtt_;
- *downstream_throughput_kbps = recent_downlink_throughput_kbps_;
- return recent_effective_connection_type_;
+ if (recent_effective_connection_type_) {
+ GetRecentHttpRTT(start_time, http_rtt);
+ GetRecentTransportRTT(start_time, transport_rtt);
+ GetRecentDownlinkThroughputKbps(start_time, downstream_throughput_kbps);
+ return recent_effective_connection_type_.value();
}
return NetworkQualityEstimator::
GetRecentEffectiveConnectionTypeAndNetworkQuality(
start_time, http_rtt, transport_rtt, downstream_throughput_kbps);
}
-bool TestNetworkQualityEstimator::GetHttpRTT(base::TimeDelta* rtt) const {
- if (http_rtt_set_) {
- *rtt = http_rtt_;
- return true;
- }
- return NetworkQualityEstimator::GetHttpRTT(rtt);
-}
-
bool TestNetworkQualityEstimator::GetRecentHttpRTT(
const base::TimeTicks& start_time,
base::TimeDelta* rtt) const {
- if (recent_http_rtt_set_) {
- *rtt = recent_http_rtt_;
- return true;
+ if (start_time.is_null()) {
+ if (start_time_null_http_rtt_) {
+ *rtt = start_time_null_http_rtt_.value();
+ return true;
+ }
+ return NetworkQualityEstimator::GetRecentHttpRTT(start_time, rtt);
}
- return NetworkQualityEstimator::GetRecentHttpRTT(start_time, rtt);
-}
-
-bool TestNetworkQualityEstimator::GetTransportRTT(base::TimeDelta* rtt) const {
- if (transport_rtt_set_) {
- *rtt = transport_rtt_;
+ if (recent_http_rtt_) {
+ *rtt = recent_http_rtt_.value();
return true;
}
- return NetworkQualityEstimator::GetTransportRTT(rtt);
+ return NetworkQualityEstimator::GetRecentHttpRTT(start_time, rtt);
}
bool TestNetworkQualityEstimator::GetRecentTransportRTT(
const base::TimeTicks& start_time,
base::TimeDelta* rtt) const {
- if (recent_transport_rtt_set_) {
- *rtt = recent_transport_rtt_;
- return true;
+ if (start_time.is_null()) {
+ if (start_time_null_transport_rtt_) {
+ *rtt = start_time_null_transport_rtt_.value();
+ return true;
+ }
+ return NetworkQualityEstimator::GetRecentTransportRTT(start_time, rtt);
}
- return NetworkQualityEstimator::GetRecentTransportRTT(start_time, rtt);
-}
-bool TestNetworkQualityEstimator::GetDownlinkThroughputKbps(
- int32_t* kbps) const {
- if (downlink_throughput_kbps_set_) {
- *kbps = downlink_throughput_kbps_;
+ if (recent_transport_rtt_) {
+ *rtt = recent_transport_rtt_.value();
return true;
}
- return NetworkQualityEstimator::GetDownlinkThroughputKbps(kbps);
+ return NetworkQualityEstimator::GetRecentTransportRTT(start_time, rtt);
}
bool TestNetworkQualityEstimator::GetRecentDownlinkThroughputKbps(
const base::TimeTicks& start_time,
int32_t* kbps) const {
- if (recent_downlink_throughput_kbps_set_) {
- *kbps = recent_downlink_throughput_kbps_;
+ if (start_time.is_null()) {
+ if (start_time_null_downlink_throughput_kbps_) {
+ *kbps = start_time_null_downlink_throughput_kbps_.value();
+ return true;
+ }
+ return NetworkQualityEstimator::GetRecentDownlinkThroughputKbps(start_time,
+ kbps);
+ }
+
+ if (recent_downlink_throughput_kbps_) {
+ *kbps = recent_downlink_throughput_kbps_.value();
return true;
}
return NetworkQualityEstimator::GetRecentDownlinkThroughputKbps(start_time,
« no previous file with comments | « net/nqe/network_quality_estimator_test_util.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698