summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 01:39:29 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 01:39:29 +0000
commitce66b49db8a2b0add7dfbcfc16a0d15f6bbd85ba (patch)
tree052c4b6b0aca884ccae3a64cd6a65997149f08f8 /chrome
parentdad7ad48393cb560438ec23b7242d8354fed62ec (diff)
downloadchromium_src-ce66b49db8a2b0add7dfbcfc16a0d15f6bbd85ba.zip
chromium_src-ce66b49db8a2b0add7dfbcfc16a0d15f6bbd85ba.tar.gz
chromium_src-ce66b49db8a2b0add7dfbcfc16a0d15f6bbd85ba.tar.bz2
Revert 142847 - Add a CONNECT_REQUESTED state to Network ConnectionState.
When a connection request is made, Chrome now sets the state to CONNECT_REQUESTED and ignores "Idle" state updates while in that state. This informs the UI to show "connecting" icons / text until the connection attempt succeeds or fails. Also: Don't update the network icon while scanning. Also: includes a bunch of logging changes for improved debugging. BUG=125121 TEST=See issue, test connecting between networks, UI should behave correctly. For chrome/browser/chromeos/gdata: TBR=tbarzic@chromium.org Review URL: https://chromiumcodereview.appspot.com/10554013 TBR=stevenjb@google.com Review URL: https://chromiumcodereview.appspot.com/10536197 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/browser/chromeos/cros/cros_network_functions.cc1
-rw-r--r--chrome/browser/chromeos/cros/network_constants.h3
-rw-r--r--chrome/browser/chromeos/cros/network_library.cc72
-rw-r--r--chrome/browser/chromeos/cros/network_library.h25
-rw-r--r--chrome/browser/chromeos/cros/network_library_impl_base.cc2
-rw-r--r--chrome/browser/chromeos/cros/network_library_impl_cros.cc12
-rw-r--r--chrome/browser/chromeos/cros/network_library_impl_stub.cc14
-rw-r--r--chrome/browser/chromeos/cros/network_library_unittest.cc4
-rw-r--r--chrome/browser/chromeos/cros/network_parser.cc12
-rw-r--r--chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc9
-rw-r--r--chrome/browser/chromeos/status/network_menu_icon.cc3
-rw-r--r--chrome/browser/chromeos/status/network_menu_icon_unittest.cc37
13 files changed, 81 insertions, 116 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 15014fb..e308da8 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -15150,9 +15150,6 @@ Battery full
<message name="IDS_CHROMEOS_NETWORK_STATE_ONLINE" desc="Network state in about:network: Online">
Online state
</message>
- <message name="IDS_CHROMEOS_NETWORK_STATE_CONNECT_REQUESTED" desc="Network state in about:network: Connect Requested">
- Connect Requested
- </message>
<!-- Network error strings for ChromeOS -->
<message name="IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN" desc="Network error in about:network: UNKNOWN">
diff --git a/chrome/browser/chromeos/cros/cros_network_functions.cc b/chrome/browser/chromeos/cros/cros_network_functions.cc
index bbcb00e..3bd0ca0 100644
--- a/chrome/browser/chromeos/cros/cros_network_functions.cc
+++ b/chrome/browser/chromeos/cros/cros_network_functions.cc
@@ -344,7 +344,6 @@ void OnGetService(const NetworkPropertiesCallback& callback,
DBusMethodCallStatus call_status,
const dbus::ObjectPath& service_path) {
if (call_status == DBUS_METHOD_CALL_SUCCESS) {
- VLOG(1) << "OnGetServiceService: " << service_path.value();
DBusThreadManager::Get()->GetFlimflamServiceClient()->GetProperties(
service_path, base::Bind(&RunCallbackWithDictionaryValue,
callback,
diff --git a/chrome/browser/chromeos/cros/network_constants.h b/chrome/browser/chromeos/cros/network_constants.h
index 332d8c4..5fb7e77 100644
--- a/chrome/browser/chromeos/cros/network_constants.h
+++ b/chrome/browser/chromeos/cros/network_constants.h
@@ -226,8 +226,7 @@ enum ConnectionState {
STATE_FAILURE = 7,
STATE_ACTIVATION_FAILURE = 8,
STATE_PORTAL = 9,
- STATE_ONLINE = 10,
- STATE_CONNECT_REQUESTED = 11, // Chrome only state
+ STATE_ONLINE = 10
};
// Network enums (see flimflam/include/network.h)
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc
index e6c4f1a..bcca34a 100644
--- a/chrome/browser/chromeos/cros/network_library.cc
+++ b/chrome/browser/chromeos/cros/network_library.cc
@@ -134,38 +134,6 @@ void ValidateUTF8(const std::string& str, std::string* output) {
}
}
-std::string ConnectionStateString(ConnectionState state) {
- switch (state) {
- case STATE_UNKNOWN:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_UNKNOWN);
- case STATE_IDLE:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_IDLE);
- case STATE_CARRIER:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_CARRIER);
- case STATE_ASSOCIATION:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_ASSOCIATION);
- case STATE_CONFIGURATION:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_CONFIGURATION);
- case STATE_READY:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_READY);
- case STATE_DISCONNECT:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_DISCONNECT);
- case STATE_FAILURE:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_FAILURE);
- case STATE_ACTIVATION_FAILURE:
- return l10n_util::GetStringUTF8(
- IDS_CHROMEOS_NETWORK_STATE_ACTIVATION_FAILURE);
- case STATE_PORTAL:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_PORTAL);
- case STATE_ONLINE:
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_ONLINE);
- case STATE_CONNECT_REQUESTED:
- return l10n_util::GetStringUTF8(
- IDS_CHROMEOS_NETWORK_STATE_CONNECT_REQUESTED);
- }
- return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_UNRECOGNIZED);
-}
-
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -257,12 +225,12 @@ void Network::UpdatePropertyMap(PropertyIndex index, const base::Value* value) {
Value*& entry = property_map_[index];
delete entry;
entry = value->DeepCopy();
- if (VLOG_IS_ON(3)) {
+ if (VLOG_IS_ON(2)) {
std::string value_json;
base::JSONWriter::WriteWithOptions(value,
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&value_json);
- VLOG(3) << "Updated property map on network: "
+ VLOG(2) << "Updated property map on network: "
<< unique_id() << "[" << index << "] = " << value_json;
}
}
@@ -285,12 +253,6 @@ Network* Network::CreateForTesting(ConnectionType type) {
void Network::SetState(ConnectionState new_state) {
if (new_state == state_)
return;
- if (state_ == STATE_CONNECT_REQUESTED && new_state == STATE_IDLE) {
- // CONNECT_REQUESTED is set internally. Shill/flimflam do not update the
- // state immediately, so ignore any Idle state updates sent while a
- // connection attempt is in progress.
- return;
- }
ConnectionState old_state = state_;
state_ = new_state;
if (!IsConnectingState(new_state))
@@ -312,8 +274,7 @@ void Network::SetState(ConnectionState new_state) {
// Note: blocking DBus call. TODO(stevenjb): refactor this.
InitIPAddress();
}
- VLOG(1) << name() << ".State [" << service_path() << "]: " << GetStateString()
- << " (was: " << ConnectionStateString(old_state) << ")";
+ VLOG(1) << name() << ".State = " << GetStateString();
}
void Network::SetName(const std::string& name) {
@@ -428,7 +389,32 @@ void Network::SetProfilePath(const std::string& profile_path) {
}
std::string Network::GetStateString() const {
- return ConnectionStateString(state_);
+ switch (state_) {
+ case STATE_UNKNOWN:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_UNKNOWN);
+ case STATE_IDLE:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_IDLE);
+ case STATE_CARRIER:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_CARRIER);
+ case STATE_ASSOCIATION:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_ASSOCIATION);
+ case STATE_CONFIGURATION:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_CONFIGURATION);
+ case STATE_READY:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_READY);
+ case STATE_DISCONNECT:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_DISCONNECT);
+ case STATE_FAILURE:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_FAILURE);
+ case STATE_ACTIVATION_FAILURE:
+ return l10n_util::GetStringUTF8(
+ IDS_CHROMEOS_NETWORK_STATE_ACTIVATION_FAILURE);
+ case STATE_PORTAL:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_PORTAL);
+ case STATE_ONLINE:
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_ONLINE);
+ }
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_UNRECOGNIZED);
}
std::string Network::GetErrorString() const {
diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
index 935cd6e..7df2a9f 100644
--- a/chrome/browser/chromeos/cros/network_library.h
+++ b/chrome/browser/chromeos/cros/network_library.h
@@ -299,14 +299,11 @@ class Network {
class TestApi {
public:
explicit TestApi(Network* network) : network_(network) {}
- void SetConnected() {
- network_->set_connected();
+ void SetConnected(bool connected) {
+ network_->set_connected(connected);
}
- void SetConnecting() {
- network_->set_connecting();
- }
- void SetDisconnected() {
- network_->set_disconnected();
+ void SetConnecting(bool connecting) {
+ network_->set_connecting(connecting);
}
private:
Network* network_;
@@ -410,8 +407,7 @@ class Network {
state == STATE_PORTAL);
}
static bool IsConnectingState(ConnectionState state) {
- return (state == STATE_CONNECT_REQUESTED ||
- state == STATE_ASSOCIATION ||
+ return (state == STATE_ASSOCIATION ||
state == STATE_CONFIGURATION ||
state == STATE_CARRIER);
}
@@ -524,14 +520,11 @@ class Network {
}
void set_name(const std::string& name) { name_ = name; }
void set_mode(ConnectionMode mode) { mode_ = mode; }
- void set_connecting() {
- state_ = STATE_CONNECT_REQUESTED;
- }
- void set_connected() {
- state_ = STATE_ONLINE;
+ void set_connecting(bool connecting) {
+ state_ = (connecting ? STATE_ASSOCIATION : STATE_IDLE);
}
- void set_disconnected() {
- state_ = STATE_IDLE;
+ void set_connected(bool connected) {
+ state_ = (connected ? STATE_ONLINE : STATE_IDLE);
}
void set_connectable(bool connectable) { connectable_ = connectable; }
void set_connection_started(bool started) { connection_started_ = started; }
diff --git a/chrome/browser/chromeos/cros/network_library_impl_base.cc b/chrome/browser/chromeos/cros/network_library_impl_base.cc
index 1cdbd51..fc765b4 100644
--- a/chrome/browser/chromeos/cros/network_library_impl_base.cc
+++ b/chrome/browser/chromeos/cros/network_library_impl_base.cc
@@ -842,7 +842,7 @@ void NetworkLibraryImplBase::NetworkConnectStart(
// In order to be certain to trigger any notifications, set the connecting
// state locally and notify observers. Otherwise there might be a state
// change without a forced notify.
- network->set_connecting();
+ network->set_connecting(true);
// Distinguish between user-initiated connection attempts
// and auto-connect.
network->set_connection_started(true);
diff --git a/chrome/browser/chromeos/cros/network_library_impl_cros.cc b/chrome/browser/chromeos/cros/network_library_impl_cros.cc
index b94fbd8..0ea08cf 100644
--- a/chrome/browser/chromeos/cros/network_library_impl_cros.cc
+++ b/chrome/browser/chromeos/cros/network_library_impl_cros.cc
@@ -708,7 +708,7 @@ bool NetworkLibraryImplCros::NetworkManagerStatusChanged(
// Currently we ignore PortalURL and ArpGateway.
break;
default:
- VLOG(2) << "Manager: Unhandled key: " << key;
+ LOG(WARNING) << "Manager: Unhandled key: " << key;
break;
}
base::TimeDelta delta = base::TimeTicks::Now() - start;
@@ -827,7 +827,6 @@ void NetworkLibraryImplCros::UpdateNetworkServiceList(
// Use update_request map to store network priority.
network_update_requests_[service_path] = network_priority_order++;
wifi_scanning_ = true;
- VLOG(2) << "UpdateNetworkServiceList, Service: " << service_path;
CrosRequestNetworkServiceProperties(
service_path,
base::Bind(&NetworkLibraryImplCros::NetworkServiceUpdate,
@@ -887,7 +886,6 @@ void NetworkLibraryImplCros::NetworkServiceUpdate(
const base::DictionaryValue* properties) {
if (!properties)
return; // Network no longer in visible list, ignore.
- VLOG(2) << "NetworkServiceUpdate: " << service_path;
ParseNetwork(service_path, *properties);
}
@@ -1029,7 +1027,7 @@ void NetworkLibraryImplCros::UpdateProfile(
LOG(WARNING) << "Empty service path in profile.";
continue;
}
- VLOG(2) << " Remembered service: " << service_path;
+ VLOG(1) << " Remembered service: " << service_path;
// Add service to profile list.
profile.services.insert(service_path);
// Request update for remembered network.
@@ -1084,7 +1082,7 @@ Network* NetworkLibraryImplCros::ParseRememberedNetwork(
SetProfileTypeFromPath(remembered);
- VLOG(2) << "ParseRememberedNetwork: " << remembered->name()
+ VLOG(1) << "ParseRememberedNetwork: " << remembered->name()
<< " path: " << remembered->service_path()
<< " profile: " << remembered->profile_path_;
NotifyNetworkManagerChanged(false); // Not forced.
@@ -1095,7 +1093,7 @@ Network* NetworkLibraryImplCros::ParseRememberedNetwork(
if (!FindNetworkByUniqueId(remembered->unique_id())) {
VirtualNetwork* vpn = static_cast<VirtualNetwork*>(remembered);
std::string provider_type = ProviderTypeToString(vpn->provider_type());
- VLOG(2) << "Requesting VPN: " << vpn->name()
+ VLOG(1) << "Requesting VPN: " << vpn->name()
<< " Server: " << vpn->server_hostname()
<< " Type: " << provider_type;
CrosRequestVirtualNetworkProperties(
@@ -1173,7 +1171,7 @@ void NetworkLibraryImplCros::ParseNetworkDevice(const std::string& device_path,
}
CHECK(device) << "Attempted to add NULL device for path: " << device_path;
}
- VLOG(2) << "ParseNetworkDevice:" << device->name();
+ VLOG(1) << "ParseNetworkDevice:" << device->name();
if (device && device->type() == TYPE_CELLULAR) {
if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) {
SetCellularDataRoamingAllowed(true);
diff --git a/chrome/browser/chromeos/cros/network_library_impl_stub.cc b/chrome/browser/chromeos/cros/network_library_impl_stub.cc
index 7a8111e..90030b4 100644
--- a/chrome/browser/chromeos/cros/network_library_impl_stub.cc
+++ b/chrome/browser/chromeos/cros/network_library_impl_stub.cc
@@ -79,13 +79,13 @@ void NetworkLibraryImplStub::Init() {
Network* ethernet = new EthernetNetwork("eth1");
ethernet->set_name("Fake Ethernet");
ethernet->set_is_active(true);
- ethernet->set_connected();
+ ethernet->set_connected(true);
AddStubNetwork(ethernet, PROFILE_SHARED);
WifiNetwork* wifi1 = new WifiNetwork("wifi1");
wifi1->set_name("Fake WiFi1");
wifi1->set_strength(100);
- wifi1->set_connected();
+ wifi1->set_connected(true);
wifi1->set_encryption(SECURITY_NONE);
AddStubNetwork(wifi1, PROFILE_SHARED);
@@ -163,7 +163,7 @@ void NetworkLibraryImplStub::Init() {
CellularNetwork* cellular1 = new CellularNetwork("cellular1");
cellular1->set_name("Fake Cellular 1");
cellular1->set_strength(100);
- cellular1->set_connected();
+ cellular1->set_connected(true);
cellular1->set_activation_state(ACTIVATION_STATE_ACTIVATED);
cellular1->set_payment_url(std::string("http://www.google.com"));
cellular1->set_usage_url(std::string("http://www.google.com"));
@@ -249,7 +249,7 @@ void NetworkLibraryImplStub::Init() {
WimaxNetwork* wimax2 = new WimaxNetwork("wimax2");
wimax2->set_name("Fake WiMAX Open");
wimax2->set_strength(50);
- wimax2->set_connected();
+ wimax2->set_connected(true);
wimax2->set_passphrase_required(false);
AddStubNetwork(wimax2, PROFILE_NONE);
@@ -408,7 +408,7 @@ void NetworkLibraryImplStub::ConnectToNetwork(Network* network) {
}
// Set connected state.
- network->set_connected();
+ network->set_connected(true);
network->set_connection_started(false);
// Make the connected network the highest priority network.
@@ -424,7 +424,7 @@ void NetworkLibraryImplStub::ConnectToNetwork(Network* network) {
other->priority_order_++;
if (other->type() == network->type()) {
other->set_is_active(false);
- other->set_disconnected();
+ other->set_connected(false);
}
}
@@ -640,7 +640,7 @@ void NetworkLibraryImplStub::DisconnectFromNetwork(const Network* network) {
// Update the network state here since no network manager in stub impl.
Network* modify_network = const_cast<Network*>(network);
modify_network->set_is_active(false);
- modify_network->set_disconnected();
+ modify_network->set_connected(false);
if (network == active_wifi_)
active_wifi_ = NULL;
else if (network == active_cellular_)
diff --git a/chrome/browser/chromeos/cros/network_library_unittest.cc b/chrome/browser/chromeos/cros/network_library_unittest.cc
index 568bd96..d97e885 100644
--- a/chrome/browser/chromeos/cros/network_library_unittest.cc
+++ b/chrome/browser/chromeos/cros/network_library_unittest.cc
@@ -283,12 +283,12 @@ TEST_F(NetworkLibraryStubTest, NetworkLibraryAccessors) {
WifiNetwork* wifi2 = cros_->FindWifiNetworkByPath("wifi2");
ASSERT_NE(static_cast<const Network*>(NULL), wifi2);
Network::TestApi test_wifi2(wifi2);
- test_wifi2.SetConnecting();
+ test_wifi2.SetConnecting(true);
// Set cellular1->connecting for these tests.
CellularNetwork* cellular1 = cros_->FindCellularNetworkByPath("cellular1");
ASSERT_NE(static_cast<const Network*>(NULL), cellular1);
Network::TestApi test_cellular1(cellular1);
- test_cellular1.SetConnecting();
+ test_cellular1.SetConnecting(true);
// Ethernet
ASSERT_NE(static_cast<const EthernetNetwork*>(NULL),
diff --git a/chrome/browser/chromeos/cros/network_parser.cc b/chrome/browser/chromeos/cros/network_parser.cc
index 9fcdcaf..74fb9e1 100644
--- a/chrome/browser/chromeos/cros/network_parser.cc
+++ b/chrome/browser/chromeos/cros/network_parser.cc
@@ -63,15 +63,15 @@ bool NetworkDeviceParser::UpdateStatus(const std::string& key,
if (index)
*index = found_index;
if (!ParseValue(found_index, value, device)) {
- VLOG(3) << "NetworkDeviceParser: Unhandled key: " << key;
+ VLOG(1) << "NetworkDeviceParser: Unhandled key: " << key;
return false;
}
- if (VLOG_IS_ON(3)) {
+ if (VLOG_IS_ON(2)) {
std::string value_json;
base::JSONWriter::WriteWithOptions(&value,
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&value_json);
- VLOG(3) << "Updated value on device: "
+ VLOG(2) << "Updated value on device: "
<< device->device_path() << "[" << key << "] = " << value_json;
}
return true;
@@ -135,17 +135,17 @@ bool NetworkParser::UpdateStatus(const std::string& key,
*index = found_index;
network->UpdatePropertyMap(found_index, &value);
if (!ParseValue(found_index, value, network)) {
- VLOG(3) << "Unhandled key '" << key << "' in Network: " << network->name()
+ VLOG(1) << "Unhandled key '" << key << "' in Network: " << network->name()
<< " ID: " << network->unique_id()
<< " Type: " << ConnectionTypeToString(network->type());
return false;
}
- if (VLOG_IS_ON(3)) {
+ if (VLOG_IS_ON(2)) {
std::string value_json;
base::JSONWriter::WriteWithOptions(&value,
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&value_json);
- VLOG(3) << "Updated value on network: "
+ VLOG(2) << "Updated value on network: "
<< network->unique_id() << "[" << key << "] = " << value_json;
}
return true;
diff --git a/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc b/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
index 12c3e8e..c23c26c 100644
--- a/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
@@ -101,7 +101,7 @@ class GDataSyncClientTest : public testing::Test {
EXPECT_CALL(*mock_network_library_, active_network())
.Times(AnyNumber())
.WillRepeatedly((Return(active_network_.get())));
- chromeos::Network::TestApi(active_network_.get()).SetConnected();
+ chromeos::Network::TestApi(active_network_.get()).SetConnected(true);
// Notify the sync client that the network is changed. This is done via
// NetworkLibrary in production, but here, we simulate the behavior by
// directly calling OnNetworkManagerChanged().
@@ -115,7 +115,7 @@ class GDataSyncClientTest : public testing::Test {
EXPECT_CALL(*mock_network_library_, active_network())
.Times(AnyNumber())
.WillRepeatedly((Return(active_network_.get())));
- chromeos::Network::TestApi(active_network_.get()).SetConnected();
+ chromeos::Network::TestApi(active_network_.get()).SetConnected(true);
sync_client_->OnNetworkManagerChanged(mock_network_library_);
}
@@ -126,7 +126,7 @@ class GDataSyncClientTest : public testing::Test {
EXPECT_CALL(*mock_network_library_, active_network())
.Times(AnyNumber())
.WillRepeatedly((Return(active_network_.get())));
- chromeos::Network::TestApi(active_network_.get()).SetConnected();
+ chromeos::Network::TestApi(active_network_.get()).SetConnected(true);
sync_client_->OnNetworkManagerChanged(mock_network_library_);
}
@@ -137,7 +137,8 @@ class GDataSyncClientTest : public testing::Test {
EXPECT_CALL(*mock_network_library_, active_network())
.Times(AnyNumber())
.WillRepeatedly((Return(active_network_.get())));
- chromeos::Network::TestApi(active_network_.get()).SetDisconnected();
+ // Here false is passed to make it disconnected.
+ chromeos::Network::TestApi(active_network_.get()).SetConnected(false);
sync_client_->OnNetworkManagerChanged(mock_network_library_);
}
diff --git a/chrome/browser/chromeos/status/network_menu_icon.cc b/chrome/browser/chromeos/status/network_menu_icon.cc
index c6c08ff..52db566 100644
--- a/chrome/browser/chromeos/status/network_menu_icon.cc
+++ b/chrome/browser/chromeos/status/network_menu_icon.cc
@@ -634,9 +634,6 @@ void NetworkMenuIcon::SetIconAndText() {
NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
DCHECK(cros);
- if (cros->wifi_scanning())
- return; // Don't update icon while scanning
-
icon_->ClearIconAndBadges();
// If we are connecting to a network, display that.
diff --git a/chrome/browser/chromeos/status/network_menu_icon_unittest.cc b/chrome/browser/chromeos/status/network_menu_icon_unittest.cc
index 356b4f0..b890000 100644
--- a/chrome/browser/chromeos/status/network_menu_icon_unittest.cc
+++ b/chrome/browser/chromeos/status/network_menu_icon_unittest.cc
@@ -144,19 +144,14 @@ class NetworkMenuIconTest : public testing::Test {
}
protected:
- void SetConnected(Network* network) {
+ void SetConnected(Network* network, bool connected) {
Network::TestApi test_network(network);
- test_network.SetConnected();
+ test_network.SetConnected(connected);
}
- void SetConnecting(Network* network) {
+ void SetConnecting(Network* network, bool connecting) {
Network::TestApi test_network(network);
- test_network.SetConnecting();
- }
-
- void SetDisconnected(Network* network) {
- Network::TestApi test_network(network);
- test_network.SetDisconnected();
+ test_network.SetConnecting(connecting);
}
void SetActive(Network* network, bool active) {
@@ -219,12 +214,12 @@ class NetworkMenuIconTest : public testing::Test {
TEST_F(NetworkMenuIconTest, EthernetIcon) {
Network* network = cros_->FindNetworkByPath("eth1");
ASSERT_NE(static_cast<const Network*>(NULL), network);
- SetConnected(network);
+ SetConnected(network, true);
gfx::ImageSkia icon = NetworkMenuIcon::GetImage(network,
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, ethernet_connected_image_));
- SetDisconnected(network);
+ SetConnected(network, false);
icon = NetworkMenuIcon::GetImage(network,
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, ethernet_disconnected_image_));
@@ -243,7 +238,7 @@ TEST_F(NetworkMenuIconTest, WifiIcon) {
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, wifi_encrypted_50_image_));
- SetDisconnected(network);
+ SetConnected(network, false);
SetStrength(network, 0);
SetEncryption(network, SECURITY_NONE);
icon = NetworkMenuIcon::GetImage(network,
@@ -254,7 +249,7 @@ TEST_F(NetworkMenuIconTest, WifiIcon) {
TEST_F(NetworkMenuIconTest, CellularIcon) {
CellularNetwork* network = cros_->FindCellularNetworkByPath("cellular1");
ASSERT_NE(static_cast<const Network*>(NULL), network);
- SetConnected(network);
+ SetConnected(network, true);
SetStrength(network, 100);
SetRoamingState(network, ROAMING_STATE_HOME);
gfx::ImageSkia icon = NetworkMenuIcon::GetImage(network,
@@ -267,7 +262,7 @@ TEST_F(NetworkMenuIconTest, CellularIcon) {
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, cellular_roaming_50_image_));
- SetDisconnected(network);
+ SetConnected(network, false);
SetStrength(network, 0);
SetRoamingState(network, ROAMING_STATE_HOME);
icon = NetworkMenuIcon::GetImage(network,
@@ -323,14 +318,14 @@ TEST_F(NetworkMenuIconTest, StatusIconMenuMode) {
CellularNetwork* cellular1 = cros_->FindCellularNetworkByPath("cellular1");
ASSERT_NE(static_cast<const Network*>(NULL), cellular1);
SetRoamingState(cellular1, ROAMING_STATE_HOME); // Clear romaing state
- SetConnecting(cellular1);
+ SetConnecting(cellular1, true);
// For MENU_MODE, we always display the connecting icon (cellular1).
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, cellular_connecting_image_));
// Set cellular1 to connected; ethernet icon should be shown.
- SetConnected(cellular1);
+ SetConnected(cellular1, true);
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, ethernet_connected_image_));
@@ -338,7 +333,7 @@ TEST_F(NetworkMenuIconTest, StatusIconMenuMode) {
Network* eth1 = cros_->FindNetworkByPath("eth1");
ASSERT_NE(static_cast<const Network*>(NULL), eth1);
SetActive(eth1, false);
- SetDisconnected(eth1);
+ SetConnected(eth1, false);
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, wifi_connected_100_image_));
}
@@ -350,7 +345,7 @@ TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) {
// Set wifi1 to connecting.
WifiNetwork* wifi1 = cros_->FindWifiNetworkByPath("wifi1");
ASSERT_NE(static_cast<const Network*>(NULL), wifi1);
- SetConnecting(wifi1);
+ SetConnecting(wifi1, true);
// For DROPDOWN_MODE, we prioritize the connected network (ethernet).
icon = menu_icon.GetIconAndText(NULL);
@@ -360,7 +355,7 @@ TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) {
Network* ethernet = cros_->FindNetworkByPath("eth1");
ASSERT_NE(static_cast<const Network*>(NULL), ethernet);
SetActive(ethernet, false);
- SetDisconnected(ethernet);
+ SetConnected(ethernet, false);
// Icon should now be cellular connected icon.
icon = menu_icon.GetIconAndText(NULL);
@@ -369,12 +364,12 @@ TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) {
// Set cellular1 to disconnected; Icon should now be wimax icon.
CellularNetwork* cellular1 = cros_->FindCellularNetworkByPath("cellular1");
ASSERT_NE(static_cast<const Network*>(NULL), cellular1);
- SetDisconnected(cellular1);
+ SetConnected(cellular1, false);
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, wimax_connected_50_image_));
// Set wifi1 to connected. Icon should now be wifi connected icon.
- SetConnected(wifi1);
+ SetConnected(wifi1, true);
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, wifi_connected_100_image_));
}