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

Unified Diff: chromeos/dbus/fake_shill_service_client.cc

Issue 175243004: Chrome OS: Use Manager.DefaultService for Default Network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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/dbus/fake_shill_service_client.h ('k') | chromeos/dbus/shill_manager_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_shill_service_client.cc
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc
index 8987c189686e8a8fa978ec3ee811f8ebda403109..ed47b28e8999bea85c3bbc4747a53cec23f1e62a 100644
--- a/chromeos/dbus/fake_shill_service_client.cc
+++ b/chromeos/dbus/fake_shill_service_client.cc
@@ -39,6 +39,11 @@ void PassStubServiceProperties(
callback.Run(call_status, *properties);
}
+void CallSortManagerServices() {
+ DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
+ SortManagerServices();
+}
+
} // namespace
FakeShillServiceClient::FakeShillServiceClient() : weak_ptr_factory_(this) {
@@ -358,10 +363,14 @@ void FakeShillServiceClient::AddServiceWithIPConfig(
properties->SetWithoutPathExpansion(
shill::kStateProperty,
base::Value::CreateStringValue(state));
- if (!ipconfig_path.empty())
+ if (!ipconfig_path.empty()) {
properties->SetWithoutPathExpansion(
shill::kIPConfigProperty,
base::Value::CreateStringValue(ipconfig_path));
+ }
+
+ DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
+ SortManagerServices();
}
void FakeShillServiceClient::RemoveService(const std::string& service_path) {
@@ -401,12 +410,22 @@ bool FakeShillServiceClient::SetServiceProperty(const std::string& service_path,
dict->MergeDictionary(&new_properties);
+ // Notify the Manager if the state changed (affects DefaultService).
if (property == shill::kStateProperty) {
- // When State changes the sort order of Services may change.
+ std::string state;
+ value.GetAsString(&state);
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
- SortManagerServices();
+ ServiceStateChanged(service_path, state);
+ }
+
+ // If the State changes, the sort order of Services may change and the
+ // DefaultService property may change.
+ if (property == shill::kStateProperty) {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(&CallSortManagerServices));
}
+ // Notifiy Chrome of the property change.
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&FakeShillServiceClient::NotifyObserversPropertyChanged,
« no previous file with comments | « chromeos/dbus/fake_shill_service_client.h ('k') | chromeos/dbus/shill_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698