diff options
author | Roshan Pius <rpius@google.com> | 2015-10-14 10:53:39 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2015-11-04 16:11:00 -0800 |
commit | 5a93aaa6f32c3dc5eb15594f5caf54c6cb34276c (patch) | |
tree | 5e043b3043ac0c7a191d898dc621d1ab8bb049bb /test-rpc-proxy | |
parent | ee39bfa925600a2153d5c5c68c503cb22ed7d3fc (diff) | |
download | shill-5a93aaa6f32c3dc5eb15594f5caf54c6cb34276c.tar.gz |
shill-test-proxy: Add a few more dbus helper functions.
Add a few more dbus helper functions to invoke ManagerProxy dbus
methods:
1. GetServiceOrder
2. SetServiceOrder
3. SetSchedScan
While there:
1. Change the return in |ConfigureService| functions to just return a
bool indicating whether the configuration succeeded or not. Creating the
proxy for the newly created service can be done separately.
2. Remove the #ifdef ANDROID conditional include in test-proxy since
this is anyway only going to be compiled for brillo.
Bug: 24335496
Change-Id: I4d687484362290ca62697b6a15d60101d7db82ae
Test: mmm system/connectivity/shill/test-rpc-proxy
Diffstat (limited to 'test-rpc-proxy')
-rw-r--r-- | test-rpc-proxy/proxy_dbus_client.cc | 41 | ||||
-rw-r--r-- | test-rpc-proxy/proxy_dbus_client.h | 17 |
2 files changed, 32 insertions, 26 deletions
diff --git a/test-rpc-proxy/proxy_dbus_client.cc b/test-rpc-proxy/proxy_dbus_client.cc index b46fff8d..4e17927e 100644 --- a/test-rpc-proxy/proxy_dbus_client.cc +++ b/test-rpc-proxy/proxy_dbus_client.cc @@ -307,29 +307,23 @@ std::unique_ptr<ServiceProxy> ProxyDbusClient::WaitForMatchingServiceProxy( return service_proxy; } -std::unique_ptr<ServiceProxy> ProxyDbusClient::ConfigureService( - const brillo::VariantDictionary& config) { +bool ProxyDbusClient::ConfigureService( + const brillo::VariantDictionary& config_params) { dbus::ObjectPath service_path; brillo::ErrorPtr error; - if(!shill_manager_proxy_.ConfigureService( - config, &service_path, &error)) { - return nullptr; - } - return GetProxyForObjectPath<ServiceProxy>(service_path); + return shill_manager_proxy_.ConfigureService( + config_params, &service_path, &error); } -std::unique_ptr<ServiceProxy> ProxyDbusClient::ConfigureServiceByGuid( +bool ProxyDbusClient::ConfigureServiceByGuid( const std::string& guid, - const brillo::VariantDictionary& config) { + const brillo::VariantDictionary& config_params) { dbus::ObjectPath service_path; brillo::ErrorPtr error; - brillo::VariantDictionary guid_config(config); - guid_config[shill::kGuidProperty] = guid; - if(!shill_manager_proxy_.ConfigureService( - guid_config, &service_path, &error)) { - return nullptr; - } - return GetProxyForObjectPath<ServiceProxy>(service_path); + brillo::VariantDictionary guid_config_params(config_params); + guid_config_params[shill::kGuidProperty] = guid; + return shill_manager_proxy_.ConfigureService( + guid_config_params, &service_path, &error); } bool ProxyDbusClient::ConnectService( @@ -397,6 +391,21 @@ bool ProxyDbusClient::RequestServiceScan(const std::string& service_type) { return shill_manager_proxy_.RequestScan(service_type, &error); } +bool ProxyDbusClient::GetServiceOrder(std::string* order) { + brillo::ErrorPtr error; + return shill_manager_proxy_.GetServiceOrder(order, &error); +} + +bool ProxyDbusClient::SetServiceOrder(const std::string& order) { + brillo::ErrorPtr error; + return shill_manager_proxy_.SetServiceOrder(order, &error); +} + +bool ProxyDbusClient::SetSchedScan(bool enable) { + brillo::ErrorPtr error; + return shill_manager_proxy_.SetSchedScan(enable, &error); +} + bool ProxyDbusClient::GetPropertyValueFromManager( const std::string& property_name, brillo::Any* property_value) { diff --git a/test-rpc-proxy/proxy_dbus_client.h b/test-rpc-proxy/proxy_dbus_client.h index 50694edb..1ac7f76f 100644 --- a/test-rpc-proxy/proxy_dbus_client.h +++ b/test-rpc-proxy/proxy_dbus_client.h @@ -29,11 +29,7 @@ #include <base/logging.h> #include <base/timer/timer.h> #include <brillo/any.h> -#if defined(__ANDROID__) #include <service_constants.h> -#else -#include <chromeos/dbus/service_constants.h> -#endif // __ANDROID__ #include <shill/dbus-proxies.h> using ManagerProxy = org::chromium::flimflam::ManagerProxy; @@ -109,12 +105,10 @@ class ProxyDbusClient { const std::string& service_type, int timeout_seconds, int rescan_interval_milliseconds, - int* elapsed_time_seconds); - std::unique_ptr<ServiceProxy> ConfigureService( - const brillo::VariantDictionary& config); - std::unique_ptr<ServiceProxy> ConfigureServiceByGuid( - const std::string& guid, - const brillo::VariantDictionary& config); + int *elapsed_time_seconds); + bool ConfigureService(const brillo::VariantDictionary& config_params); + bool ConfigureServiceByGuid(const std::string& guid, + const brillo::VariantDictionary& config_params); bool ConnectService(const dbus::ObjectPath& object_path, int timeout_seconds); bool DisconnectService(const dbus::ObjectPath& object_path, @@ -125,6 +119,9 @@ class ProxyDbusClient { bool PopProfile(const std::string& profile_name); bool PopAnyProfile(); bool RequestServiceScan(const std::string& service_type); + bool GetServiceOrder(std::string* order); + bool SetServiceOrder(const std::string& order); + bool SetSchedScan(bool enable); private: bool GetPropertyValueFromManager(const std::string& property_name, |