Commit 53564d95 authored by Azeem Arshad's avatar Azeem Arshad Committed by Commit Bot

[CrOS Cellular] Fix notification of active network technology change

This is a followup to https://crrev.com/c/1977309 to fix cellular
network technology icon inconsistency. The previous CL adds checks for
network technology changes when checking for active network changes.
This CL makes changes to NetworkStateHandler that ensures that these
checks are run for network technology property changes in the first
place. Unit tests were also added.

Fixed: 994445
Change-Id: I7790c3794f27c26e099eaab9e7db718b00aff73e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1982238Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Azeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728054}
parent 2ffc3db9
...@@ -1413,6 +1413,7 @@ void NetworkStateHandler::UpdateNetworkServiceProperty( ...@@ -1413,6 +1413,7 @@ void NetworkStateHandler::UpdateNetworkServiceProperty(
if (key == shill::kSignalStrengthProperty || key == shill::kWifiBSsid || if (key == shill::kSignalStrengthProperty || key == shill::kWifiBSsid ||
key == shill::kWifiFrequency || key == shill::kWifiFrequency ||
key == shill::kWifiFrequencyListProperty || key == shill::kWifiFrequencyListProperty ||
key == shill::kNetworkTechnologyProperty ||
(key == shill::kDeviceProperty && value_str == "/")) { (key == shill::kDeviceProperty && value_str == "/")) {
// Uninteresting update. This includes 'Device' property changes to "/" // Uninteresting update. This includes 'Device' property changes to "/"
// (occurs before just a service is removed). // (occurs before just a service is removed).
...@@ -1421,9 +1422,12 @@ void NetworkStateHandler::UpdateNetworkServiceProperty( ...@@ -1421,9 +1422,12 @@ void NetworkStateHandler::UpdateNetworkServiceProperty(
return; return;
// Otherwise do not trigger 'default network changed'. // Otherwise do not trigger 'default network changed'.
notify_default = false; notify_default = false;
// Notify signal strength changes for active networks. // Notify signal strength and network technology changes for active
if (key == shill::kSignalStrengthProperty) // networks.
if (key == shill::kSignalStrengthProperty ||
key == shill::kNetworkTechnologyProperty) {
notify_active = true; notify_active = true;
}
} }
LogPropertyUpdated(network, key, value); LogPropertyUpdated(network, key, value);
......
...@@ -1636,6 +1636,25 @@ TEST_F(NetworkStateHandlerTest, NetworkActiveNetworksStateChanged) { ...@@ -1636,6 +1636,25 @@ TEST_F(NetworkStateHandlerTest, NetworkActiveNetworksStateChanged) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, test_observer_->active_network_change_count()); EXPECT_EQ(1u, test_observer_->active_network_change_count());
// Activate cellular network so that it's part of active network list.
service_test_->SetServiceProperty(
kShillManagerClientStubCellular, shill::kActivationStateProperty,
base::Value(shill::kActivationStateActivating));
base::RunLoop().RunUntilIdle();
expected_active_network_paths = {kShillManagerClientStubCellular};
EXPECT_EQ(expected_active_network_paths,
test_observer_->active_network_paths());
// Test that network technology change signals the observer.
test_observer_->reset_change_counts();
service_test_->SetServiceProperty(kShillManagerClientStubCellular,
shill::kNetworkTechnologyProperty,
base::Value(shill::kNetworkTechnologyUmts));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, test_observer_->active_network_change_count());
// Remove cellular service.
service_test_->RemoveService(kShillManagerClientStubCellular);
base::RunLoop().RunUntilIdle();
// Add two Tether networks. // Add two Tether networks.
test_observer_->reset_change_counts(); test_observer_->reset_change_counts();
network_state_handler_->SetTetherTechnologyState( network_state_handler_->SetTetherTechnologyState(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment