diff options
author | Bertrand SIMONNET <bsimonnet@google.com> | 2016-03-28 09:59:36 -0700 |
---|---|---|
committer | Bertrand Simonnet <bsimonnet@google.com> | 2016-03-30 23:09:18 +0000 |
commit | c5d5330637ed208e92b81c80ad12b53ffe4f0721 (patch) | |
tree | 568547222b63728fd4a23e076bfc3a0900cba347 /daemon | |
parent | 2abf0833508ecfb74e44c3f00e6b6cdf8081019b (diff) | |
download | peripheralmanager-c5d5330637ed208e92b81c80ad12b53ffe4f0721.tar.gz |
Fix binder mocking in unit tests.
This CL mocks binder correctly in the unit tests, avoiding calling
service manager.
Bug: 27901103
Test: Unit tests pass. Service manager is not called.
Change-Id: Ic4d8d80e47768dcabb69ae970b66bab2e3b1ee8d
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/peripheral_manager.cc | 7 | ||||
-rw-r--r-- | daemon/peripheral_manager.h | 2 |
2 files changed, 1 insertions, 8 deletions
diff --git a/daemon/peripheral_manager.cc b/daemon/peripheral_manager.cc index d24cbe0..c946932 100644 --- a/daemon/peripheral_manager.cc +++ b/daemon/peripheral_manager.cc @@ -18,6 +18,7 @@ #include <base/logging.h> #include <binderwrapper/binder_wrapper.h> +#include <binderwrapper/stub_binder_wrapper.h> #include <hardware/hardware.h> #include <hardware/peripheral_io.h> @@ -113,12 +114,6 @@ bool PeripheralManager::Init() { return BinderWrapper::Get()->RegisterService(interface_desc.string(), this); } -bool PeripheralManager::InitForTest() { - BinderWrapper::Create(); - String8 interface_desc(getInterfaceDescriptor()); - return BinderWrapper::Get()->RegisterService(interface_desc.string(), this); -} - Status PeripheralManager::GetClient(const sp<IBinder>& lifeline, sp<os::IPeripheralManagerClient>* client) { sp<PeripheralManagerClient> c = new PeripheralManagerClient; diff --git a/daemon/peripheral_manager.h b/daemon/peripheral_manager.h index a1e354f..2c97a56 100644 --- a/daemon/peripheral_manager.h +++ b/daemon/peripheral_manager.h @@ -38,8 +38,6 @@ class PeripheralManager : public BnPeripheralManager, bool Init(); - bool InitForTest(); - // IPeripheralManager Interface Status GetClient(const sp<IBinder>& lifeline, sp<os::IPeripheralManagerClient>* _aidl_return); |