summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_shill_service_client.cc
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2015-04-14 12:49:59 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-14 19:50:54 +0000
commite22e5bcbad2cea941993b32e6cc3b082822a42fc (patch)
tree4b769cf0ca87ecdc6f2a30b18a54559940269893 /chromeos/dbus/fake_shill_service_client.cc
parente6a653183ba2a1c4f24990904dfc78e32c975f5b (diff)
downloadchromium_src-e22e5bcbad2cea941993b32e6cc3b082822a42fc.zip
chromium_src-e22e5bcbad2cea941993b32e6cc3b082822a42fc.tar.gz
chromium_src-e22e5bcbad2cea941993b32e6cc3b082822a42fc.tar.bz2
Use networkingPrivate.startConnect
This adds checks for unconfigured or non-activated networks to internet_details.js since it no longer uses the checks in network_connect.cc. It also moves some notification handling from network_connect.cc to network_state_notifier.cc so that it does not rely on network_connect.cc. BUG=430115 Review URL: https://codereview.chromium.org/1043343002 Cr-Commit-Position: refs/heads/master@{#325108}
Diffstat (limited to 'chromeos/dbus/fake_shill_service_client.cc')
-rw-r--r--chromeos/dbus/fake_shill_service_client.cc34
1 files changed, 16 insertions, 18 deletions
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc
index d4e789c3..fdae9db 100644
--- a/chromeos/dbus/fake_shill_service_client.cc
+++ b/chromeos/dbus/fake_shill_service_client.cc
@@ -178,8 +178,8 @@ void FakeShillServiceClient::Connect(const dbus::ObjectPath& service_path,
const ErrorCallback& error_callback) {
VLOG(1) << "FakeShillServiceClient::Connect: " << service_path.value();
base::DictionaryValue* service_properties = NULL;
- if (!stub_services_.GetDictionary(
- service_path.value(), &service_properties)) {
+ if (!stub_services_.GetDictionary(service_path.value(),
+ &service_properties)) {
LOG(ERROR) << "Service not found: " << service_path.value();
error_callback.Run("Error.InvalidService", "Invalid Service");
return;
@@ -190,21 +190,22 @@ void FakeShillServiceClient::Connect(const dbus::ObjectPath& service_path,
// sending an update.
SetOtherServicesOffline(service_path.value());
+ // Clear Error.
+ service_properties->SetStringWithoutPathExpansion(shill::kErrorProperty, "");
+
// Set Associating.
base::StringValue associating_value(shill::kStateAssociation);
- SetServiceProperty(service_path.value(),
- shill::kStateProperty,
+ SetServiceProperty(service_path.value(), shill::kStateProperty,
associating_value);
// Stay Associating until the state is changed again after a delay.
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&FakeShillServiceClient::ContinueConnect,
- weak_ptr_factory_.GetWeakPtr(),
- service_path.value()),
+ weak_ptr_factory_.GetWeakPtr(), service_path.value()),
base::TimeDelta::FromSeconds(GetInteractiveDelay()));
- callback.Run();
+ base::MessageLoop::current()->PostTask(FROM_HERE, callback);
}
void FakeShillServiceClient::Disconnect(const dbus::ObjectPath& service_path,
@@ -606,8 +607,7 @@ void FakeShillServiceClient::SetCellularActivated(
error_callback);
}
-void FakeShillServiceClient::ContinueConnect(
- const std::string& service_path) {
+void FakeShillServiceClient::ContinueConnect(const std::string& service_path) {
VLOG(1) << "FakeShillServiceClient::ContinueConnect: " << service_path;
base::DictionaryValue* service_properties = NULL;
if (!stub_services_.GetDictionary(service_path, &service_properties)) {
@@ -625,26 +625,24 @@ void FakeShillServiceClient::ContinueConnect(
// No custom connect behavior set, continue with the default connect behavior.
std::string passphrase;
- service_properties->GetStringWithoutPathExpansion(
- shill::kPassphraseProperty, &passphrase);
+ service_properties->GetStringWithoutPathExpansion(shill::kPassphraseProperty,
+ &passphrase);
if (passphrase == "failure") {
// Simulate a password failure.
- SetServiceProperty(service_path,
- shill::kStateProperty,
+ SetServiceProperty(service_path, shill::kErrorProperty,
+ base::StringValue(shill::kErrorBadPassphrase));
+ SetServiceProperty(service_path, shill::kStateProperty,
base::StringValue(shill::kStateFailure));
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(
base::IgnoreResult(&FakeShillServiceClient::SetServiceProperty),
- weak_ptr_factory_.GetWeakPtr(),
- service_path,
- shill::kErrorProperty,
+ weak_ptr_factory_.GetWeakPtr(), service_path, shill::kErrorProperty,
base::StringValue(shill::kErrorBadPassphrase)));
} else {
// Set Online.
VLOG(1) << "Setting state to Online " << service_path;
- SetServiceProperty(service_path,
- shill::kStateProperty,
+ SetServiceProperty(service_path, shill::kStateProperty,
base::StringValue(shill::kStateOnline));
}
}