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

Unified Diff: net/nqe/network_quality_estimator.cc

Issue 2064763003: Add function that converts string connection type to ECT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed bengr comments Created 4 years, 6 months 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.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.cc
diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc
index 93e177d07803d2e5bf6a3798106f1792a317f7ad..3b27cb7afc9163482e722c67d8dd8c333b7a1ec6 100644
--- a/net/nqe/network_quality_estimator.cc
+++ b/net/nqe/network_quality_estimator.cc
@@ -1074,8 +1074,9 @@ void NetworkQualityEstimator::OnUpdatedEstimateAvailable(
}
}
+// static
const char* NetworkQualityEstimator::GetNameForEffectiveConnectionType(
- EffectiveConnectionType type) const {
+ EffectiveConnectionType type) {
switch (type) {
case EFFECTIVE_CONNECTION_TYPE_UNKNOWN:
return "Unknown";
@@ -1098,6 +1099,28 @@ const char* NetworkQualityEstimator::GetNameForEffectiveConnectionType(
return "";
}
+// static
+NetworkQualityEstimator::EffectiveConnectionType
+NetworkQualityEstimator::GetEffectiveConnectionTypeForName(
+ const std::string& connection_type_name) {
+ if (connection_type_name == "Unknown")
+ return EFFECTIVE_CONNECTION_TYPE_UNKNOWN;
+ if (connection_type_name == "Offline")
+ return EFFECTIVE_CONNECTION_TYPE_OFFLINE;
+ if (connection_type_name == "Slow2G")
+ return EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
+ if (connection_type_name == "2G")
+ return EFFECTIVE_CONNECTION_TYPE_2G;
+ if (connection_type_name == "3G")
+ return EFFECTIVE_CONNECTION_TYPE_3G;
+ if (connection_type_name == "4G")
+ return EFFECTIVE_CONNECTION_TYPE_4G;
+ if (connection_type_name == "Broadband")
+ return EFFECTIVE_CONNECTION_TYPE_BROADBAND;
+ NOTREACHED();
+ return EFFECTIVE_CONNECTION_TYPE_UNKNOWN;
+}
+
void NetworkQualityEstimator::SetTickClockForTesting(
std::unique_ptr<base::TickClock> tick_clock) {
DCHECK(thread_checker_.CalledOnValidThread());
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698