summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_shill_service_client.cc
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2014-11-19 00:09:33 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-19 08:10:04 +0000
commitbc4af0395bb3c948c7704a83bc989ca770d1d7f9 (patch)
treeacbd062f2a99ca63d58f608aed10535c5b8aa96b /chromeos/dbus/fake_shill_service_client.cc
parent522f4f02470c4c1edf926bfd6342688602d7cfdc (diff)
downloadchromium_src-bc4af0395bb3c948c7704a83bc989ca770d1d7f9.zip
chromium_src-bc4af0395bb3c948c7704a83bc989ca770d1d7f9.tar.gz
chromium_src-bc4af0395bb3c948c7704a83bc989ca770d1d7f9.tar.bz2
Add 'setProperties' to InternetOptionsHandler
Replaces simple custom setters with setProperties call, matching the networkingPrivate API. BUG=430113 Review URL: https://codereview.chromium.org/694533007 Cr-Commit-Position: refs/heads/master@{#304780}
Diffstat (limited to 'chromeos/dbus/fake_shill_service_client.cc')
-rw-r--r--chromeos/dbus/fake_shill_service_client.cc70
1 files changed, 33 insertions, 37 deletions
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc
index b21ae61..9751972 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 {