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
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.
TEST=Start AP service on both Brillo and Chrome OS
TEST=Run unittests on both Brillo and Chrome OS
27 files changed