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

Unified Diff: net/nqe/effective_connection_type_unittest.cc

Issue 2720513002: Change the string representation of Slow2G ECT (Closed)
Patch Set: ryansturm comments Created 3 years, 10 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/effective_connection_type.cc ('k') | net/nqe/network_quality_estimator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/effective_connection_type_unittest.cc
diff --git a/net/nqe/effective_connection_type_unittest.cc b/net/nqe/effective_connection_type_unittest.cc
index 841a9115ca6a4791a4a49edbb155b9ecaa22d9d1..90e8d1479be7a98404409b3416375dde730d7dca 100644
--- a/net/nqe/effective_connection_type_unittest.cc
+++ b/net/nqe/effective_connection_type_unittest.cc
@@ -42,11 +42,39 @@ TEST(EffectiveConnectionTypeTest, NameConnectionTypeConversion) {
GetNameForEffectiveConnectionType(effective_connection_type));
EXPECT_FALSE(connection_type_name.empty());
+ if (effective_connection_type != EFFECTIVE_CONNECTION_TYPE_SLOW_2G) {
+ // For all effective connection types except Slow2G,
+ // DeprecatedGetNameForEffectiveConnectionType should return the same
+ // name as GetNameForEffectiveConnectionType.
+ EXPECT_EQ(connection_type_name,
+ DeprecatedGetNameForEffectiveConnectionType(
+ effective_connection_type));
+ }
+
EXPECT_TRUE(GetEffectiveConnectionTypeForName(
connection_type_name, &converted_effective_connection_type));
EXPECT_EQ(effective_connection_type, converted_effective_connection_type);
}
}
+// Tests that the Slow 2G effective connection type is converted correctly to a
+// descriptive string name, and vice-versa.
+TEST(EffectiveConnectionTypeTest, Slow2GTypeConversion) {
+ EffectiveConnectionType type;
+
+ // GetEffectiveConnectionTypeForName should return Slow2G as effective
+ // connection type for both the deprecated and the current string
+ // representation.
+ EXPECT_TRUE(GetEffectiveConnectionTypeForName("Slow2G", &type));
+ EXPECT_EQ(EFFECTIVE_CONNECTION_TYPE_SLOW_2G, type);
+
+ EXPECT_TRUE(GetEffectiveConnectionTypeForName("Slow-2G", &type));
+ EXPECT_EQ(EFFECTIVE_CONNECTION_TYPE_SLOW_2G, type);
+
+ EXPECT_EQ("Slow-2G", std::string(GetNameForEffectiveConnectionType(
+ EFFECTIVE_CONNECTION_TYPE_SLOW_2G)));
+ EXPECT_EQ("Slow2G", std::string(DeprecatedGetNameForEffectiveConnectionType(
+ EFFECTIVE_CONNECTION_TYPE_SLOW_2G)));
+}
} // namespace
« no previous file with comments | « net/nqe/effective_connection_type.cc ('k') | net/nqe/network_quality_estimator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698