diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-20 04:39:56 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-20 04:39:56 +0000 |
commit | 05adc159b148ae1c9ac6bd173c92b4cced5cce39 (patch) | |
tree | 5408daa81ed3d2cfe7029f0168dd79dd3d1fbea7 /chromeos/dbus/fake_shill_service_client.cc | |
parent | 5d654b92a3d2ce7d6b7273c4828d7c27ef4cdcc5 (diff) | |
download | chromium_src-05adc159b148ae1c9ac6bd173c92b4cced5cce39.zip chromium_src-05adc159b148ae1c9ac6bd173c92b4cced5cce39.tar.gz chromium_src-05adc159b148ae1c9ac6bd173c92b4cced5cce39.tar.bz2 |
Rely on Service.Visible instead of Manager.Services
With this change we rely on Service.Visible and only use
Manager.Services to determine which services to observe.
BUG=384380
R=pneubeck@chromium.org
Review URL: https://codereview.chromium.org/330833003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_shill_service_client.cc')
-rw-r--r-- | chromeos/dbus/fake_shill_service_client.cc | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc index 647625c..605f372 100644 --- a/chromeos/dbus/fake_shill_service_client.cc +++ b/chromeos/dbus/fake_shill_service_client.cc @@ -308,10 +308,10 @@ void FakeShillServiceClient::AddService(const std::string& service_path, const std::string& name, const std::string& type, const std::string& state, - bool add_to_visible_list) { + bool visible) { AddServiceWithIPConfig(service_path, "" /* guid */, name, type, state, "" /* ipconfig_path */, - add_to_visible_list); + visible); } void FakeShillServiceClient::AddServiceWithIPConfig( @@ -321,11 +321,36 @@ void FakeShillServiceClient::AddServiceWithIPConfig( const std::string& type, const std::string& state, const std::string& ipconfig_path, - bool add_to_visible_list) { - std::string device_path = - DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> - GetDevicePathForType(type); + bool visible) { + base::DictionaryValue* properties = SetServiceProperties( + service_path, guid, name, type, state, visible); + + std::string profile_path; + if (properties->GetStringWithoutPathExpansion(shill::kProfileProperty, + &profile_path) && + !profile_path.empty()) { + DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> + UpdateService(profile_path, service_path); + } + if (!ipconfig_path.empty()) { + properties->SetWithoutPathExpansion( + shill::kIPConfigProperty, + new base::StringValue(ipconfig_path)); + } + + DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> + AddManagerService(service_path, true); +} + + +base::DictionaryValue* FakeShillServiceClient::SetServiceProperties( + const std::string& service_path, + const std::string& guid, + const std::string& name, + const std::string& type, + const std::string& state, + bool visible) { base::DictionaryValue* properties = GetModifiableServiceProperties(service_path, true); connect_behavior_.erase(service_path); @@ -355,6 +380,9 @@ void FakeShillServiceClient::AddServiceWithIPConfig( properties->SetWithoutPathExpansion( shill::kNameProperty, new base::StringValue(name)); + std::string device_path = + DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> + GetDevicePathForType(type); properties->SetWithoutPathExpansion( shill::kDeviceProperty, new base::StringValue(device_path)); @@ -366,25 +394,13 @@ void FakeShillServiceClient::AddServiceWithIPConfig( new base::StringValue(state)); properties->SetWithoutPathExpansion( shill::kVisibleProperty, - new base::FundamentalValue(add_to_visible_list)); - if (!ipconfig_path.empty()) { - properties->SetWithoutPathExpansion( - shill::kIPConfigProperty, - new base::StringValue(ipconfig_path)); - } + new base::FundamentalValue(visible)); if (type == shill::kTypeWifi) { properties->SetWithoutPathExpansion( shill::kSecurityProperty, new base::StringValue(shill::kSecurityNone)); } - - if (!profile_path.empty()) { - DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> - UpdateService(profile_path, service_path); - } - - DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> - AddManagerService(service_path); + return properties; } void FakeShillServiceClient::RemoveService(const std::string& service_path) { |