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

Unified Diff: chromeos/dbus/fake_shill_manager_client.cc

Issue 299403012: Clean up shill fake implementations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: chromeos/dbus/fake_shill_manager_client.cc
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc
index 5b061b24f3f5abb70269e9b349fc9a697a225a70..ac695bfef9f07f308d67be776638a0d768316c0e 100644
--- a/chromeos/dbus/fake_shill_manager_client.cc
+++ b/chromeos/dbus/fake_shill_manager_client.cc
@@ -144,6 +144,7 @@ void FakeShillManagerClient::SetProperty(const std::string& name,
const base::Value& value,
const base::Closure& callback,
const ErrorCallback& error_callback) {
+ VLOG(2) << "SetProperty: " << name;
stub_properties_.SetWithoutPathExpansion(name, value.DeepCopy());
CallNotifyObserversPropertyChanged(name);
base::MessageLoop::current()->PostTask(FROM_HERE, callback);
@@ -446,6 +447,8 @@ void FakeShillManagerClient::SetManagerProperty(const std::string& key,
void FakeShillManagerClient::AddManagerService(const std::string& service_path,
bool add_to_visible_list,
bool add_to_watch_list) {
+ VLOG(2) << "AddManagerService: " << service_path
+ << " Visible: " << add_to_visible_list;
// Always add to ServiceCompleteListProperty.
GetListProperty(shill::kServiceCompleteListProperty)->AppendIfNotPresent(
base::Value::CreateStringValue(service_path));
@@ -462,6 +465,7 @@ void FakeShillManagerClient::AddManagerService(const std::string& service_path,
void FakeShillManagerClient::RemoveManagerService(
const std::string& service_path,
bool remove_from_complete_list) {
+ VLOG(2) << "RemoveManagerService: " << service_path;
base::StringValue service_path_value(service_path);
if (remove_from_complete_list) {
GetListProperty(shill::kServiceCompleteListProperty)->Remove(
@@ -478,6 +482,7 @@ void FakeShillManagerClient::RemoveManagerService(
}
void FakeShillManagerClient::ClearManagerServices() {
+ VLOG(1) << "ClearManagerServices";
GetListProperty(shill::kServiceCompleteListProperty)->Clear();
GetListProperty(shill::kServicesProperty)->Clear();
GetListProperty(shill::kServiceWatchListProperty)->Clear();
@@ -497,6 +502,7 @@ void FakeShillManagerClient::ServiceStateChanged(
}
void FakeShillManagerClient::SortManagerServices() {
+ VLOG(1) << "SortManagerServices";
SortServiceList(shill::kServicesProperty);
SortServiceList(shill::kServiceCompleteListProperty);
}
@@ -528,8 +534,6 @@ void FakeShillManagerClient::SortServiceList(const std::string& property) {
if (property != shill::kServicesProperty)
return;
- CallNotifyObserversPropertyChanged(property);
stevenjb 2014/05/28 22:47:22 This is redundant and was triggering extra/unneces
stevenjb 2014/05/29 22:18:00 Actually, this is not redundant when SetviceList a
-
// Set the first active service as the Default service.
std::string new_default_service;
if (!active_services.empty()) {
@@ -620,11 +624,11 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
devices->SetDeviceProperty("/device/eth1",
shill::kIPConfigsProperty,
eth_ip_configs);
- services->AddService("eth1", "eth1",
+ services->AddService("/service/eth1", "eth1",
shill::kTypeEthernet,
state,
add_to_visible, add_to_watchlist);
- profiles->AddService(shared_profile, "eth1");
+ profiles->AddService(shared_profile, "/service/eth1");
}
// Wifi
@@ -647,32 +651,32 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
shill::kIPConfigsProperty,
wifi_ip_configs);
- services->AddService("wifi1",
+ services->AddService("/service/wifi1",
"wifi1",
shill::kTypeWifi,
state,
add_to_visible, add_to_watchlist);
- services->SetServiceProperty("wifi1",
+ services->SetServiceProperty("/service/wifi1",
shill::kSecurityProperty,
base::StringValue(shill::kSecurityWep));
- profiles->AddService(shared_profile, "wifi1");
+ profiles->AddService(shared_profile, "/service/wifi1");
- services->AddService("wifi2",
+ services->AddService("/service/wifi2",
"wifi2_PSK",
shill::kTypeWifi,
shill::kStateIdle,
add_to_visible, add_to_watchlist);
- services->SetServiceProperty("wifi2",
+ services->SetServiceProperty("/service/wifi2",
shill::kSecurityProperty,
base::StringValue(shill::kSecurityPsk));
base::FundamentalValue strength_value(80);
services->SetServiceProperty(
- "wifi2", shill::kSignalStrengthProperty, strength_value);
- profiles->AddService(shared_profile, "wifi2");
+ "/service/wifi2", shill::kSignalStrengthProperty, strength_value);
+ profiles->AddService(shared_profile, "/service/wifi2");
if (portaled) {
- const std::string kPortaledWifiPath = "portaled_wifi";
+ const std::string kPortaledWifiPath = "/service/portaled_wifi";
services->AddService(kPortaledWifiPath,
"Portaled Wifi",
shill::kTypeWifi,
@@ -698,13 +702,14 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
devices->AddDevice(
"/device/wimax1", shill::kTypeWimax, "stub_wimax_device1");
- services->AddService("wimax1",
+ services->AddService("/service/wimax1",
"wimax1",
shill::kTypeWimax,
state,
add_to_visible, add_to_watchlist);
- services->SetServiceProperty(
- "wimax1", shill::kConnectableProperty, base::FundamentalValue(true));
+ services->SetServiceProperty("/service/wimax1",
+ shill::kConnectableProperty,
+ base::FundamentalValue(true));
}
// Cellular
@@ -722,31 +727,32 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
shill::kCarrierProperty,
base::StringValue(shill::kCarrierSprint));
- services->AddService("cellular1",
+ services->AddService("/service/cellular1",
"cellular1",
shill::kTypeCellular,
state,
add_to_visible, add_to_watchlist);
base::StringValue technology_value(shill::kNetworkTechnologyGsm);
- services->SetServiceProperty(
- "cellular1", shill::kNetworkTechnologyProperty, technology_value);
+ services->SetServiceProperty("/service/cellular1",
+ shill::kNetworkTechnologyProperty,
+ technology_value);
if (activated) {
services->SetServiceProperty(
- "cellular1",
+ "/service/cellular1",
shill::kActivationStateProperty,
base::StringValue(shill::kActivationStateActivated));
- services->SetServiceProperty("cellular1",
+ services->SetServiceProperty("/service/cellular1",
shill::kConnectableProperty,
base::FundamentalValue(true));
} else {
services->SetServiceProperty(
- "cellular1",
+ "/service/cellular1",
shill::kActivationStateProperty,
base::StringValue(shill::kActivationStateNotActivated));
}
- services->SetServiceProperty("cellular1",
+ services->SetServiceProperty("/service/cellular1",
shill::kRoamingStateProperty,
base::StringValue(shill::kRoamingStateHome));
}
@@ -763,22 +769,22 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
shill::kProviderOpenVpn);
provider_properties.SetString(shill::kHostProperty, "vpn_host");
- services->AddService("vpn1",
+ services->AddService("/service/vpn1",
"vpn1",
shill::kTypeVPN,
state,
add_to_visible, add_to_watchlist);
services->SetServiceProperty(
- "vpn1", shill::kProviderProperty, provider_properties);
- profiles->AddService(shared_profile, "vpn1");
+ "/service/vpn1", shill::kProviderProperty, provider_properties);
+ profiles->AddService(shared_profile, "/service/vpn1");
- services->AddService("vpn2",
+ services->AddService("/service/vpn2",
"vpn2",
shill::kTypeVPN,
shill::kStateIdle,
add_to_visible, add_to_watchlist);
services->SetServiceProperty(
- "vpn2", shill::kProviderProperty, provider_properties);
+ "/service/vpn2", shill::kProviderProperty, provider_properties);
}
SortManagerServices();
@@ -831,6 +837,7 @@ void FakeShillManagerClient::CallNotifyObserversPropertyChanged(
void FakeShillManagerClient::NotifyObserversPropertyChanged(
const std::string& property) {
+ VLOG(1) << "NotifyObserversPropertyChanged: " << property;
if (property == shill::kServicesProperty ||
property == shill::kServiceWatchListProperty) {
scoped_ptr<base::ListValue> services(GetEnabledServiceList(property));
@@ -937,6 +944,7 @@ void FakeShillManagerClient::ScanCompleted(const std::string& device_path,
shill::kScanningProperty,
base::FundamentalValue(false));
}
+ VLOG(2) << "ScanCompleted";
CallNotifyObserversPropertyChanged(shill::kServicesProperty);
CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty);
base::MessageLoop::current()->PostTask(FROM_HERE, callback);

Powered by Google App Engine
This is Rietveld 408576698