Index: chromeos/dbus/fake_shill_service_client.cc |
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc |
index b21ae61013ca35d88b2e74ad941fed1837afbec1..9751972e2c27b04408cb03fe3293517946053af0 100644 |
--- a/chromeos/dbus/fake_shill_service_client.cc |
+++ b/chromeos/dbus/fake_shill_service_client.cc |
@@ -344,7 +344,6 @@ void FakeShillServiceClient::AddServiceWithIPConfig( |
AddManagerService(service_path, true); |
} |
- |
base::DictionaryValue* FakeShillServiceClient::SetServiceProperties( |
const std::string& service_path, |
const std::string& guid, |
@@ -358,11 +357,12 @@ base::DictionaryValue* FakeShillServiceClient::SetServiceProperties( |
std::string profile_path; |
base::DictionaryValue profile_properties; |
- if (DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> |
- GetService(service_path, &profile_path, &profile_properties)) { |
- properties->SetWithoutPathExpansion( |
- shill::kProfileProperty, |
- new base::StringValue(profile_path)); |
+ if (DBusThreadManager::Get() |
+ ->GetShillProfileClient() |
+ ->GetTestInterface() |
+ ->GetService(service_path, &profile_path, &profile_properties)) { |
+ properties->SetStringWithoutPathExpansion(shill::kProfileProperty, |
+ profile_path); |
} |
// If |guid| is provided, set Service.GUID to that. Otherwise if a GUID is |
@@ -370,39 +370,30 @@ base::DictionaryValue* FakeShillServiceClient::SetServiceProperties( |
// not enforce a valid guid, we do that at the NetworkStateHandler layer. |
std::string guid_to_set = guid; |
if (guid_to_set.empty()) { |
- profile_properties.GetStringWithoutPathExpansion( |
- shill::kGuidProperty, &guid_to_set); |
+ profile_properties.GetStringWithoutPathExpansion(shill::kGuidProperty, |
+ &guid_to_set); |
} |
if (!guid_to_set.empty()) { |
- properties->SetWithoutPathExpansion(shill::kGuidProperty, |
- new base::StringValue(guid_to_set)); |
+ properties->SetStringWithoutPathExpansion(shill::kGuidProperty, |
+ guid_to_set); |
} |
- shill_property_util::SetSSID(name, properties); |
- properties->SetWithoutPathExpansion( |
- shill::kNameProperty, |
- new base::StringValue(name)); |
- std::string device_path = |
- DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> |
- GetDevicePathForType(type); |
- properties->SetWithoutPathExpansion( |
- shill::kDeviceProperty, |
- new base::StringValue(device_path)); |
- properties->SetWithoutPathExpansion( |
- shill::kTypeProperty, |
- new base::StringValue(type)); |
- properties->SetWithoutPathExpansion( |
- shill::kStateProperty, |
- new base::StringValue(state)); |
- properties->SetWithoutPathExpansion( |
- shill::kVisibleProperty, |
- new base::FundamentalValue(visible)); |
+ properties->SetStringWithoutPathExpansion(shill::kSSIDProperty, name); |
+ shill_property_util::SetSSID(name, properties); // Sets kWifiHexSsid |
+ properties->SetStringWithoutPathExpansion(shill::kNameProperty, name); |
+ std::string device_path = DBusThreadManager::Get() |
+ ->GetShillDeviceClient() |
+ ->GetTestInterface() |
+ ->GetDevicePathForType(type); |
+ properties->SetStringWithoutPathExpansion(shill::kDeviceProperty, |
+ device_path); |
+ properties->SetStringWithoutPathExpansion(shill::kTypeProperty, type); |
+ properties->SetStringWithoutPathExpansion(shill::kStateProperty, state); |
+ properties->SetBooleanWithoutPathExpansion(shill::kVisibleProperty, visible); |
if (type == shill::kTypeWifi) { |
- properties->SetWithoutPathExpansion( |
- shill::kSecurityProperty, |
- new base::StringValue(shill::kSecurityNone)); |
- properties->SetWithoutPathExpansion( |
- shill::kModeProperty, |
- new base::StringValue(shill::kModeManaged)); |
+ properties->SetStringWithoutPathExpansion(shill::kSecurityProperty, |
+ shill::kSecurityNone); |
+ properties->SetStringWithoutPathExpansion(shill::kModeProperty, |
+ shill::kModeManaged); |
} |
return properties; |
} |
@@ -431,9 +422,14 @@ bool FakeShillServiceClient::SetServiceProperty(const std::string& service_path, |
StartsWithASCII(property, "OpenVPN.", case_sensitive) || |
StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) { |
// These properties are only nested within the Provider dictionary if read |
- // from Shill. |
+ // from Shill. Properties that start with "Provider" need to have that |
+ // stripped off, other properties are nested in the "Provider" dictionary |
+ // as-is. |
+ std::string key = property; |
+ if (StartsWithASCII(property, "Provider.", case_sensitive)) |
+ key = property.substr(strlen("Provider.")); |
base::DictionaryValue* provider = new base::DictionaryValue; |
- provider->SetWithoutPathExpansion(property, value.DeepCopy()); |
+ provider->SetWithoutPathExpansion(key, value.DeepCopy()); |
new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); |
changed_property = shill::kProviderProperty; |
} else { |