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

Unified Diff: components/wifi/fake_wifi_service.cc

Issue 275543005: Use GUID instead of ServicePath in networkingPrivate API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « chromeos/network/shill_property_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/wifi/fake_wifi_service.cc
diff --git a/components/wifi/fake_wifi_service.cc b/components/wifi/fake_wifi_service.cc
index 86b635873bbf976b6608933731350465033e028c..87b01a4fd24af12f1c340fbc82a84eb1f083a54d 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,
« no previous file with comments | « chromeos/network/shill_property_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698