summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/cros/cros_mock.cc5
-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.cc71
-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
-rw-r--r--dbus/object_proxy.cc1
14 files changed, 117 insertions, 82 deletions
diff --git a/chrome/browser/chromeos/cros/cros_mock.cc b/chrome/browser/chromeos/cros/cros_mock.cc
index 2917fd6..5134974 100644
--- a/chrome/browser/chromeos/cros/cros_mock.cc
+++ b/chrome/browser/chromeos/cros/cros_mock.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -175,6 +175,9 @@ void CrosMock::SetNetworkLibraryStatusAreaExpectations() {
EXPECT_CALL(*mock_network_library_, virtual_network_connected())
.Times(AnyNumber())
.WillRepeatedly((Return(false)));
+ EXPECT_CALL(*mock_network_library_, wifi_scanning())
+ .Times(AnyNumber())
+ .WillRepeatedly((Return(false)));
// Set specific expectations for interesting functions:
diff --git a/chrome/browser/chromeos/cros/cros_network_functions.cc b/chrome/browser/chromeos/cros/cros_network_functions.cc
index 3bd0ca0..bbcb00e 100644
--- a/chrome/browser/chromeos/cros/cros_network_functions.cc
+++ b/chrome/browser/chromeos/cros/cros_network_functions.cc
@@ -344,6 +344,7 @@ 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 5fb7e77..332d8c4 100644
--- a/chrome/browser/chromeos/cros/network_constants.h
+++ b/chrome/browser/chromeos/cros/network_constants.h
@@ -226,7 +226,8 @@ enum ConnectionState {
STATE_FAILURE = 7,
STATE_ACTIVATION_FAILURE = 8,
STATE_PORTAL = 9,
- STATE_ONLINE = 10
+ STATE_ONLINE = 10,
+ STATE_CONNECT_REQUESTED = 11, // Chrome only state
};
// 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 bcca34a..1b31dfe 100644
--- a/chrome/browser/chromeos/cros/network_library.cc
+++ b/chrome/browser/chromeos/cros/network_library.cc
@@ -134,6 +134,37 @@ 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 "Connect Requested";
+ }
+ return l10n_util::GetStringUTF8(IDS_CHROMEOS_NETWORK_STATE_UNRECOGNIZED);
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -225,12 +256,12 @@ void Network::UpdatePropertyMap(PropertyIndex index, const base::Value* value) {
Value*& entry = property_map_[index];
delete entry;
entry = value->DeepCopy();
- if (VLOG_IS_ON(2)) {
+ if (VLOG_IS_ON(3)) {
std::string value_json;
base::JSONWriter::WriteWithOptions(value,
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&value_json);
- VLOG(2) << "Updated property map on network: "
+ VLOG(3) << "Updated property map on network: "
<< unique_id() << "[" << index << "] = " << value_json;
}
}
@@ -253,6 +284,12 @@ 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))
@@ -274,7 +311,8 @@ void Network::SetState(ConnectionState new_state) {
// Note: blocking DBus call. TODO(stevenjb): refactor this.
InitIPAddress();
}
- VLOG(1) << name() << ".State = " << GetStateString();
+ VLOG(1) << name() << ".State [" << service_path() << "]: " << GetStateString()
+ << " (was: " << ConnectionStateString(old_state) << ")";
}
void Network::SetName(const std::string& name) {
@@ -389,32 +427,7 @@ void Network::SetProfilePath(const std::string& profile_path) {
}
std::string Network::GetStateString() const {
- 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);
+ return ConnectionStateString(state_);
}
std::string Network::GetErrorString() const {
diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
index 7df2a9f..935cd6e 100644
--- a/chrome/browser/chromeos/cros/network_library.h
+++ b/chrome/browser/chromeos/cros/network_library.h
@@ -299,11 +299,14 @@ class Network {
class TestApi {
public:
explicit TestApi(Network* network) : network_(network) {}
- void SetConnected(bool connected) {
- network_->set_connected(connected);
+ void SetConnected() {
+ network_->set_connected();
}
- void SetConnecting(bool connecting) {
- network_->set_connecting(connecting);
+ void SetConnecting() {
+ network_->set_connecting();
+ }
+ void SetDisconnected() {
+ network_->set_disconnected();
}
private:
Network* network_;
@@ -407,7 +410,8 @@ class Network {
state == STATE_PORTAL);
}
static bool IsConnectingState(ConnectionState state) {
- return (state == STATE_ASSOCIATION ||
+ return (state == STATE_CONNECT_REQUESTED ||
+ state == STATE_ASSOCIATION ||
state == STATE_CONFIGURATION ||
state == STATE_CARRIER);
}
@@ -520,11 +524,14 @@ class Network {
}
void set_name(const std::string& name) { name_ = name; }
void set_mode(ConnectionMode mode) { mode_ = mode; }
- void set_connecting(bool connecting) {
- state_ = (connecting ? STATE_ASSOCIATION : STATE_IDLE);
+ void set_connecting() {
+ state_ = STATE_CONNECT_REQUESTED;
+ }
+ void set_connected() {
+ state_ = STATE_ONLINE;
}
- void set_connected(bool connected) {
- state_ = (connected ? STATE_ONLINE : STATE_IDLE);
+ void set_disconnected() {
+ state_ = 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 fc765b4..1cdbd51 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(true);
+ network->set_connecting();
// 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 0ea08cf..b94fbd8 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:
- LOG(WARNING) << "Manager: Unhandled key: " << key;
+ VLOG(2) << "Manager: Unhandled key: " << key;
break;
}
base::TimeDelta delta = base::TimeTicks::Now() - start;
@@ -827,6 +827,7 @@ 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,
@@ -886,6 +887,7 @@ 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);
}
@@ -1027,7 +1029,7 @@ void NetworkLibraryImplCros::UpdateProfile(
LOG(WARNING) << "Empty service path in profile.";
continue;
}
- VLOG(1) << " Remembered service: " << service_path;
+ VLOG(2) << " Remembered service: " << service_path;
// Add service to profile list.
profile.services.insert(service_path);
// Request update for remembered network.
@@ -1082,7 +1084,7 @@ Network* NetworkLibraryImplCros::ParseRememberedNetwork(
SetProfileTypeFromPath(remembered);
- VLOG(1) << "ParseRememberedNetwork: " << remembered->name()
+ VLOG(2) << "ParseRememberedNetwork: " << remembered->name()
<< " path: " << remembered->service_path()
<< " profile: " << remembered->profile_path_;
NotifyNetworkManagerChanged(false); // Not forced.
@@ -1093,7 +1095,7 @@ Network* NetworkLibraryImplCros::ParseRememberedNetwork(
if (!FindNetworkByUniqueId(remembered->unique_id())) {
VirtualNetwork* vpn = static_cast<VirtualNetwork*>(remembered);
std::string provider_type = ProviderTypeToString(vpn->provider_type());
- VLOG(1) << "Requesting VPN: " << vpn->name()
+ VLOG(2) << "Requesting VPN: " << vpn->name()
<< " Server: " << vpn->server_hostname()
<< " Type: " << provider_type;
CrosRequestVirtualNetworkProperties(
@@ -1171,7 +1173,7 @@ void NetworkLibraryImplCros::ParseNetworkDevice(const std::string& device_path,
}
CHECK(device) << "Attempted to add NULL device for path: " << device_path;
}
- VLOG(1) << "ParseNetworkDevice:" << device->name();
+ VLOG(2) << "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 90030b4..7a8111e 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(true);
+ ethernet->set_connected();
AddStubNetwork(ethernet, PROFILE_SHARED);
WifiNetwork* wifi1 = new WifiNetwork("wifi1");
wifi1->set_name("Fake WiFi1");
wifi1->set_strength(100);
- wifi1->set_connected(true);
+ wifi1->set_connected();
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(true);
+ cellular1->set_connected();
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(true);
+ wimax2->set_connected();
wimax2->set_passphrase_required(false);
AddStubNetwork(wimax2, PROFILE_NONE);
@@ -408,7 +408,7 @@ void NetworkLibraryImplStub::ConnectToNetwork(Network* network) {
}
// Set connected state.
- network->set_connected(true);
+ network->set_connected();
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_connected(false);
+ other->set_disconnected();
}
}
@@ -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_connected(false);
+ modify_network->set_disconnected();
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 d97e885..568bd96 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(true);
+ test_wifi2.SetConnecting();
// 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(true);
+ test_cellular1.SetConnecting();
// 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 74fb9e1..9fcdcaf 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(1) << "NetworkDeviceParser: Unhandled key: " << key;
+ VLOG(3) << "NetworkDeviceParser: Unhandled key: " << key;
return false;
}
- if (VLOG_IS_ON(2)) {
+ if (VLOG_IS_ON(3)) {
std::string value_json;
base::JSONWriter::WriteWithOptions(&value,
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&value_json);
- VLOG(2) << "Updated value on device: "
+ VLOG(3) << "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(1) << "Unhandled key '" << key << "' in Network: " << network->name()
+ VLOG(3) << "Unhandled key '" << key << "' in Network: " << network->name()
<< " ID: " << network->unique_id()
<< " Type: " << ConnectionTypeToString(network->type());
return false;
}
- if (VLOG_IS_ON(2)) {
+ if (VLOG_IS_ON(3)) {
std::string value_json;
base::JSONWriter::WriteWithOptions(&value,
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&value_json);
- VLOG(2) << "Updated value on network: "
+ VLOG(3) << "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 f8c6316..dd5c251 100644
--- a/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
@@ -102,7 +102,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(true);
+ chromeos::Network::TestApi(active_network_.get()).SetConnected();
// 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().
@@ -116,7 +116,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(true);
+ chromeos::Network::TestApi(active_network_.get()).SetConnected();
sync_client_->OnNetworkManagerChanged(mock_network_library_);
}
@@ -127,7 +127,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(true);
+ chromeos::Network::TestApi(active_network_.get()).SetConnected();
sync_client_->OnNetworkManagerChanged(mock_network_library_);
}
@@ -138,8 +138,7 @@ class GDataSyncClientTest : public testing::Test {
EXPECT_CALL(*mock_network_library_, active_network())
.Times(AnyNumber())
.WillRepeatedly((Return(active_network_.get())));
- // Here false is passed to make it disconnected.
- chromeos::Network::TestApi(active_network_.get()).SetConnected(false);
+ chromeos::Network::TestApi(active_network_.get()).SetDisconnected();
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 52db566..c6c08ff 100644
--- a/chrome/browser/chromeos/status/network_menu_icon.cc
+++ b/chrome/browser/chromeos/status/network_menu_icon.cc
@@ -634,6 +634,9 @@ 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 b890000..356b4f0 100644
--- a/chrome/browser/chromeos/status/network_menu_icon_unittest.cc
+++ b/chrome/browser/chromeos/status/network_menu_icon_unittest.cc
@@ -144,14 +144,19 @@ class NetworkMenuIconTest : public testing::Test {
}
protected:
- void SetConnected(Network* network, bool connected) {
+ void SetConnected(Network* network) {
Network::TestApi test_network(network);
- test_network.SetConnected(connected);
+ test_network.SetConnected();
}
- void SetConnecting(Network* network, bool connecting) {
+ void SetConnecting(Network* network) {
Network::TestApi test_network(network);
- test_network.SetConnecting(connecting);
+ test_network.SetConnecting();
+ }
+
+ void SetDisconnected(Network* network) {
+ Network::TestApi test_network(network);
+ test_network.SetDisconnected();
}
void SetActive(Network* network, bool active) {
@@ -214,12 +219,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, true);
+ SetConnected(network);
gfx::ImageSkia icon = NetworkMenuIcon::GetImage(network,
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, ethernet_connected_image_));
- SetConnected(network, false);
+ SetDisconnected(network);
icon = NetworkMenuIcon::GetImage(network,
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, ethernet_disconnected_image_));
@@ -238,7 +243,7 @@ TEST_F(NetworkMenuIconTest, WifiIcon) {
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, wifi_encrypted_50_image_));
- SetConnected(network, false);
+ SetDisconnected(network);
SetStrength(network, 0);
SetEncryption(network, SECURITY_NONE);
icon = NetworkMenuIcon::GetImage(network,
@@ -249,7 +254,7 @@ TEST_F(NetworkMenuIconTest, WifiIcon) {
TEST_F(NetworkMenuIconTest, CellularIcon) {
CellularNetwork* network = cros_->FindCellularNetworkByPath("cellular1");
ASSERT_NE(static_cast<const Network*>(NULL), network);
- SetConnected(network, true);
+ SetConnected(network);
SetStrength(network, 100);
SetRoamingState(network, ROAMING_STATE_HOME);
gfx::ImageSkia icon = NetworkMenuIcon::GetImage(network,
@@ -262,7 +267,7 @@ TEST_F(NetworkMenuIconTest, CellularIcon) {
NetworkMenuIcon::COLOR_DARK);
EXPECT_TRUE(CompareImages(icon, cellular_roaming_50_image_));
- SetConnected(network, false);
+ SetDisconnected(network);
SetStrength(network, 0);
SetRoamingState(network, ROAMING_STATE_HOME);
icon = NetworkMenuIcon::GetImage(network,
@@ -318,14 +323,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, true);
+ SetConnecting(cellular1);
// 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, true);
+ SetConnected(cellular1);
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, ethernet_connected_image_));
@@ -333,7 +338,7 @@ TEST_F(NetworkMenuIconTest, StatusIconMenuMode) {
Network* eth1 = cros_->FindNetworkByPath("eth1");
ASSERT_NE(static_cast<const Network*>(NULL), eth1);
SetActive(eth1, false);
- SetConnected(eth1, false);
+ SetDisconnected(eth1);
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, wifi_connected_100_image_));
}
@@ -345,7 +350,7 @@ TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) {
// Set wifi1 to connecting.
WifiNetwork* wifi1 = cros_->FindWifiNetworkByPath("wifi1");
ASSERT_NE(static_cast<const Network*>(NULL), wifi1);
- SetConnecting(wifi1, true);
+ SetConnecting(wifi1);
// For DROPDOWN_MODE, we prioritize the connected network (ethernet).
icon = menu_icon.GetIconAndText(NULL);
@@ -355,7 +360,7 @@ TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) {
Network* ethernet = cros_->FindNetworkByPath("eth1");
ASSERT_NE(static_cast<const Network*>(NULL), ethernet);
SetActive(ethernet, false);
- SetConnected(ethernet, false);
+ SetDisconnected(ethernet);
// Icon should now be cellular connected icon.
icon = menu_icon.GetIconAndText(NULL);
@@ -364,12 +369,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);
- SetConnected(cellular1, false);
+ SetDisconnected(cellular1);
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, true);
+ SetConnected(wifi1);
icon = menu_icon.GetIconAndText(NULL);
EXPECT_TRUE(CompareImages(icon, wifi_connected_100_image_));
}
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 62c0eb8..ba51efa 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -494,6 +494,7 @@ void ObjectProxy::LogMethodCallFailure(
return;
LOG(ERROR) << "Failed to call method: "
<< interface_name << "." << method_name
+ << ": object_path= " << object_path_.value()
<< ": " << error_name << ": " << error_message;
}