summaryrefslogtreecommitdiffstats
path: root/components/wifi/fake_wifi_service.cc
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 21:48:35 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 21:48:35 +0000
commit164da42873b70ce025199d15a870ca4650534ac5 (patch)
treea05626c399ecadae950b388e06972a7777d189c7 /components/wifi/fake_wifi_service.cc
parentb8787eab8e2ad5ecf3e2a8c0db10c6305ce9e448 (diff)
downloadchromium_src-164da42873b70ce025199d15a870ca4650534ac5.zip
chromium_src-164da42873b70ce025199d15a870ca4650534ac5.tar.gz
chromium_src-164da42873b70ce025199d15a870ca4650534ac5.tar.bz2
Use GUID instead of ServicePath in networkingPrivate API
Currently we pass the service path of networks as the "GUID" in the networkingPrivate implementation on Chrome OS. We should be using the actual GUID (if one exists) or create a GUID if one does not. Note: This change should not break any existing usage since the GUID value should be transparant to the implementation. (This will have the positive side effect of making the GUID consistent across sessions). BUG=284827 For fake_wifi_service.cc: R=asargent@chromium.org, pneubeck@chromium.org TBR=mef@chromium.org Review URL: https://codereview.chromium.org/275543005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/wifi/fake_wifi_service.cc')
-rw-r--r--components/wifi/fake_wifi_service.cc40
1 files changed, 20 insertions, 20 deletions
diff --git a/components/wifi/fake_wifi_service.cc b/components/wifi/fake_wifi_service.cc
index 86b6358..87b01a4 100644
--- a/components/wifi/fake_wifi_service.cc
+++ b/components/wifi/fake_wifi_service.cc
@@ -69,11 +69,11 @@ void FakeWiFiService::GetProperties(const std::string& network_guid,
std::string* error) {
WiFiService::NetworkList::iterator network_properties =
FindNetwork(network_guid);
- if (network_properties != networks_.end()) {
- properties->Swap(network_properties->ToValue(false).get());
- } else {
- *error = "Error.DBusFailed";
+ if (network_properties == networks_.end()) {
+ *error = "Error.InvalidNetworkGuid";
+ return;
}
+ properties->Swap(network_properties->ToValue(false).get());
}
void FakeWiFiService::GetManagedProperties(
@@ -90,7 +90,7 @@ void FakeWiFiService::GetState(const std::string& network_guid,
WiFiService::NetworkList::iterator network_properties =
FindNetwork(network_guid);
if (network_properties == networks_.end()) {
- *error = "Error.InvalidParameter";
+ *error = "Error.InvalidNetworkGuid";
return;
}
properties->Swap(network_properties->ToValue(true).get());
@@ -143,29 +143,29 @@ void FakeWiFiService::RequestNetworkScan() {
void FakeWiFiService::StartConnect(const std::string& network_guid,
std::string* error) {
NetworkList::iterator network_properties = FindNetwork(network_guid);
- if (network_properties != networks_.end()) {
- DisconnectAllNetworksOfType(network_properties->type);
- network_properties->connection_state = onc::connection_state::kConnected;
- SortNetworks();
- NotifyNetworkListChanged(networks_);
- NotifyNetworkChanged(network_guid);
- } else {
- *error = "configure-failed";
+ if (network_properties == networks_.end()) {
+ *error = "Error.InvalidNetworkGuid";
+ return;
}
+ DisconnectAllNetworksOfType(network_properties->type);
+ network_properties->connection_state = onc::connection_state::kConnected;
+ SortNetworks();
+ NotifyNetworkListChanged(networks_);
+ NotifyNetworkChanged(network_guid);
}
void FakeWiFiService::StartDisconnect(const std::string& network_guid,
std::string* error) {
WiFiService::NetworkList::iterator network_properties =
FindNetwork(network_guid);
- if (network_properties != networks_.end()) {
- network_properties->connection_state = onc::connection_state::kNotConnected;
- SortNetworks();
- NotifyNetworkListChanged(networks_);
- NotifyNetworkChanged(network_guid);
- } else {
- *error = "not-found";
+ if (network_properties == networks_.end()) {
+ *error = "Error.InvalidNetworkGuid";
+ return;
}
+ network_properties->connection_state = onc::connection_state::kNotConnected;
+ SortNetworks();
+ NotifyNetworkListChanged(networks_);
+ NotifyNetworkChanged(network_guid);
}
void FakeWiFiService::GetKeyFromSystem(const std::string& network_guid,