summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_shill_service_client.cc
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-05 19:54:40 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-05 19:54:40 +0000
commit4d201ec63db39d03f5928550d3777859965d8759 (patch)
tree0fb7348ab6552fe6a4fbaa10af731e8cf358a930 /chromeos/dbus/fake_shill_service_client.cc
parent0d911ae9a10844fbe092696d5c4dae102fd3f184 (diff)
downloadchromium_src-4d201ec63db39d03f5928550d3777859965d8759.zip
chromium_src-4d201ec63db39d03f5928550d3777859965d8759.tar.gz
chromium_src-4d201ec63db39d03f5928550d3777859965d8759.tar.bz2
Chrome OS: Use Manager.DefaultService for Default Network
This changes Chrome to use Manager.DefaultService to provide the default network to Chrome (i.e. NetworkChangeNotifier) instead of relying on Manager.Services[0]. This should fix some timing issues and make the NCS more in sync with Shill. One change in behavior that should be benign is that Shill considers a connecting network to be the default network, whereas previously only a connected network would be considered. BUG=159540, 330873 R=gauravsh@chromium.org, pneubeck@chromium.org, tbarzic@chromium.org Review URL: https://codereview.chromium.org/175243004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255124 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_shill_service_client.cc')
-rw-r--r--chromeos/dbus/fake_shill_service_client.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc
index 8987c18..ed47b28 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,