f933540bb968efa2744ee48b40ab713ccd358d51 |
|
16-Nov-2015 |
Peter Qiu <zqiu@google.com> |
Refactor D-Bus adaptor for Device out of the Device class This removes the RPC specific dependencies out of the Device class. Device adaptors will now be created through the ControlInterface. While there, make the D-Bus object registration for Device object to be synchronous instead of asynchronous. Since the daemon will not be doing anything anyway besides waiting for the registration to complete. This avoids unnecessary complexity with the object registration. Currently for D-Bus, the property variables are being created/stored in the generated adaptor code. This means that the property variables will be stored in the adaptor instead of the Device class itself. Even though this is not ideal, there is no good way around it. In the ideal world, the Device would maintain its property variables, and register them with the RPC specific adaptor. So for the unittest, we will use FakeDeviceAdaptor, which provides the storage for the property variables. Also currently gmock doesn't support mocking of a function that returns a unique_ptr, since it only supports copyable return value and unique_ptr is not copyable. To work around this issue, I've created mock functions that return a raw pointer, and override the proxy/adaptor creation functions to use the mock function in MockControl. Bug: 24194427 TEST=Start AP service on both Brillo and Chrome OS TEST=Run unittests on both Brillo and Chrome OS Change-Id: I8e9f736bb27fe6736f616dd752a37b9cc1be8dfe
/system/connectivity/apmanager/dbus/device_dbus_adaptor.h
|