Skip to content

Commit

Permalink
Rename GetMaxBandwidthForConnectionSubtype.
Browse files Browse the repository at this point in the history
As the comment in network_change_notifier.h by jkarlin@,
rename GetMaxBandwidthForConnectionSubtype to
GetMaxBandwidthMbpsForConnectionSubtype.

BUG=488585
R=jkarlin@chromium.org

Signed-off-by: zhuoyu.qian <zhuoyu.qian@samsung.com>
Change-Id: Ic6d3cef9a66b0520581f1af388b1857578502323
Reviewed-on: https://chromium-review.googlesource.com/734921
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512480}
  • Loading branch information
ZhuoyuQian authored and Commit Bot committed Oct 30, 2017
1 parent a1f36fd commit 4d65140
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ void FileManagerBrowserTestBase::OnMessage(const std::string& name,

if (name == "useCellularNetwork") {
net::NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeForTests(
net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
net::NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
net::NetworkChangeNotifier::SUBTYPE_HSPA),
net::NetworkChangeNotifier::CONNECTION_3G);
return;
Expand Down
7 changes: 4 additions & 3 deletions chromeos/network/network_change_notifier_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ NetworkChangeNotifierChromeos::NetworkChangeNotifierChromeos()
: NetworkChangeNotifier(NetworkChangeCalculatorParamsChromeos()),
connection_type_(CONNECTION_NONE),
max_bandwidth_mbps_(
NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
SUBTYPE_NONE)),
task_runner_(base::ThreadTaskRunnerHandle::Get()),
weak_ptr_factory_(this) {
Expand Down Expand Up @@ -158,7 +158,8 @@ void NetworkChangeNotifierChromeos::UpdateState(
*connection_type_changed = true;
*max_bandwidth_changed = true;
connection_type_ = CONNECTION_NONE;
max_bandwidth_mbps_ = GetMaxBandwidthForConnectionSubtype(SUBTYPE_NONE);
max_bandwidth_mbps_ =
GetMaxBandwidthMbpsForConnectionSubtype(SUBTYPE_NONE);
service_path_.clear();
ip_address_.clear();
dns_servers_.clear();
Expand Down Expand Up @@ -220,7 +221,7 @@ void NetworkChangeNotifierChromeos::UpdateState(
dns_servers_ = new_dns_servers;
double old_max_bandwidth = max_bandwidth_mbps_;
max_bandwidth_mbps_ =
GetMaxBandwidthForConnectionSubtype(GetConnectionSubtype(
GetMaxBandwidthMbpsForConnectionSubtype(GetConnectionSubtype(
default_network->type(), default_network->network_technology()));
if (max_bandwidth_mbps_ != old_max_bandwidth)
*max_bandwidth_changed = true;
Expand Down
8 changes: 4 additions & 4 deletions content/browser/net_info_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class NetInfoBrowserTest : public content::ContentBrowserTest {
net::NetworkChangeNotifier::ConnectionType type,
net::NetworkChangeNotifier::ConnectionSubtype subtype) {
net::NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeForTests(
net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
net::NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
subtype),
type);
base::RunLoop().RunUntilIdle();
Expand Down Expand Up @@ -154,7 +154,7 @@ IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, VerifyNetworkStateInitialized) {
NavigateToURL(shell(), content::GetTestUrl("", "net_info.html"));
EXPECT_TRUE(RunScriptExtractBool("getOnLine()"));
EXPECT_EQ("ethernet", RunScriptExtractString("getType()"));
EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
net::NetworkChangeNotifier::SUBTYPE_GIGABIT_ETHERNET),
RunScriptExtractDouble("getDownlinkMax()"));
}
Expand All @@ -166,14 +166,14 @@ IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkChangePlumbsToNavigator) {
SetConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI,
net::NetworkChangeNotifier::SUBTYPE_WIFI_N);
EXPECT_EQ("wifi", RunScriptExtractString("getType()"));
EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
net::NetworkChangeNotifier::SUBTYPE_WIFI_N),
RunScriptExtractDouble("getDownlinkMax()"));

SetConnectionType(net::NetworkChangeNotifier::CONNECTION_ETHERNET,
net::NetworkChangeNotifier::SUBTYPE_GIGABIT_ETHERNET);
EXPECT_EQ("ethernet", RunScriptExtractString("getType()"));
EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
net::NetworkChangeNotifier::SUBTYPE_GIGABIT_ETHERNET),
RunScriptExtractDouble("getDownlinkMax()"));
}
Expand Down
4 changes: 2 additions & 2 deletions net/android/network_change_notifier_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid
void OnNetworkDisconnected(NetworkHandle network) override;
void OnNetworkMadeDefault(NetworkHandle network) override;

// Promote GetMaxBandwidthForConnectionSubtype to public for the Android
// Promote GetMaxBandwidthMbpsForConnectionSubtype to public for the Android
// delegate class.
using NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype;
using NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype;

protected:
void OnFinalizingMetricsLogRecord() override;
Expand Down
4 changes: 2 additions & 2 deletions net/android/network_change_notifier_delegate_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ NetworkChangeNotifierDelegateAndroid::NetworkChangeNotifierDelegateAndroid()
ConvertConnectionType(Java_NetworkChangeNotifier_getCurrentConnectionType(
env, java_network_change_notifier_)));
SetCurrentMaxBandwidth(
NetworkChangeNotifierAndroid::GetMaxBandwidthForConnectionSubtype(
NetworkChangeNotifierAndroid::GetMaxBandwidthMbpsForConnectionSubtype(
GetCurrentConnectionSubtype()));
SetCurrentDefaultNetwork(Java_NetworkChangeNotifier_getCurrentDefaultNetId(
env, java_network_change_notifier_));
Expand Down Expand Up @@ -185,7 +185,7 @@ void NetworkChangeNotifierDelegateAndroid::NotifyMaxBandwidthChanged(
jint subtype) {
DCHECK(thread_checker_.CalledOnValidThread());
double new_max_bandwidth =
NetworkChangeNotifierAndroid::GetMaxBandwidthForConnectionSubtype(
NetworkChangeNotifierAndroid::GetMaxBandwidthMbpsForConnectionSubtype(
ConvertConnectionSubtype(subtype));
SetCurrentMaxBandwidth(new_max_bandwidth);
observers_->Notify(FROM_HERE, &Observer::OnMaxBandwidthChanged,
Expand Down
9 changes: 5 additions & 4 deletions net/base/network_change_notifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ void NetworkChangeNotifier::GetMaxBandwidthAndConnectionType(
ConnectionType* connection_type) {
if (!g_network_change_notifier) {
*connection_type = CONNECTION_UNKNOWN;
*max_bandwidth_mbps = GetMaxBandwidthForConnectionSubtype(SUBTYPE_UNKNOWN);
*max_bandwidth_mbps =
GetMaxBandwidthMbpsForConnectionSubtype(SUBTYPE_UNKNOWN);
return;
}

Expand All @@ -572,7 +573,7 @@ void NetworkChangeNotifier::GetMaxBandwidthAndConnectionType(
}

// static
double NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
double NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
ConnectionSubtype subtype) {
switch (subtype) {
case SUBTYPE_GSM:
Expand Down Expand Up @@ -1035,8 +1036,8 @@ void NetworkChangeNotifier::GetCurrentMaxBandwidthAndConnectionType(
*connection_type = GetCurrentConnectionType();
*max_bandwidth_mbps =
*connection_type == CONNECTION_NONE
? GetMaxBandwidthForConnectionSubtype(SUBTYPE_NONE)
: GetMaxBandwidthForConnectionSubtype(SUBTYPE_UNKNOWN);
? GetMaxBandwidthMbpsForConnectionSubtype(SUBTYPE_NONE)
: GetMaxBandwidthMbpsForConnectionSubtype(SUBTYPE_UNKNOWN);
}

bool NetworkChangeNotifier::AreNetworkHandlesCurrentlySupported() const {
Expand Down
4 changes: 2 additions & 2 deletions net/base/network_change_notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ class NET_EXPORT NetworkChangeNotifier {
// Returns a theoretical upper limit (in Mbps) on download bandwidth given a
// connection subtype. The mapping of connection type to maximum bandwidth is
// provided in the NetInfo spec: http://w3c.github.io/netinfo/.
// TODO(jkarlin): Rename to GetMaxBandwidthMbpsForConnectionSubtype.
static double GetMaxBandwidthForConnectionSubtype(ConnectionSubtype subtype);
static double GetMaxBandwidthMbpsForConnectionSubtype(
ConnectionSubtype subtype);

// Returns true if the platform supports use of APIs based on NetworkHandles.
// Public methods that use NetworkHandles are GetNetworkConnectionType(),
Expand Down
2 changes: 1 addition & 1 deletion net/base/network_change_notifier_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void NetworkChangeNotifierLinux::Thread::OnLinkChanged() {
NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
last_type_ = GetCurrentConnectionType();
double max_bandwidth_mbps =
NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
last_type_ == CONNECTION_NONE ? SUBTYPE_NONE : SUBTYPE_UNKNOWN);
NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChange(
max_bandwidth_mbps, last_type_);
Expand Down
2 changes: 1 addition & 1 deletion net/base/network_change_notifier_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void NetworkChangeNotifierMac::ReachabilityCallback(
if (old_type != new_type) {
NotifyObserversOfConnectionTypeChange();
double max_bandwidth_mbps =
NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
new_type == CONNECTION_NONE ? SUBTYPE_NONE : SUBTYPE_UNKNOWN);
NotifyObserversOfMaxBandwidthChange(max_bandwidth_mbps, new_type);
}
Expand Down

0 comments on commit 4d65140

Please sign in to comment.