summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_shill_service_client.cc
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2015-04-16 12:03:14 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-16 19:03:40 +0000
commitac04fd8970250987d888f557a328dabc7548941a (patch)
tree3d6ecc358a502c778e7cc1ba5d91160f51a80b89 /chromeos/dbus/fake_shill_service_client.cc
parentfe4be3daa9f58e38bfc44ef8c692eb59b4db0b29 (diff)
downloadchromium_src-ac04fd8970250987d888f557a328dabc7548941a.zip
chromium_src-ac04fd8970250987d888f557a328dabc7548941a.tar.gz
chromium_src-ac04fd8970250987d888f557a328dabc7548941a.tar.bz2
Use networkingPrivate.startConnect (Take 2)
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. Original CL (reverted for unrelated failure): https://codereview.chromium.org/1043343002/ BUG=430115 TBR=michaelpg, pneubeck, mpearson@chromium.org Review URL: https://codereview.chromium.org/1091043002 Cr-Commit-Position: refs/heads/master@{#325484}
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));
}
}