diff options
Diffstat (limited to 'client/spi_unittest.cc')
-rw-r--r-- | client/spi_unittest.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/client/spi_unittest.cc b/client/spi_unittest.cc index d0529c0..cc8a3fb 100644 --- a/client/spi_unittest.cc +++ b/client/spi_unittest.cc @@ -16,6 +16,8 @@ #include <memory> +#include <binderwrapper/binder_test_base.h> +#include <binderwrapper/stub_binder_wrapper.h> #include <gtest/gtest.h> #include "fake_devices.h" @@ -35,10 +37,13 @@ using android::PeripheralManager; // Base class used to test the Spi C API. // As we rely on static, global managers, we cannot run this tests in parallel. // Please use -j1 when running theses tests or you may see false negatives. -class SpiTest : public ::testing::Test { +class SpiTest : public android::BinderTestBase { public: void SetUp() { - pman_.InitForTest(); + android::sp<PeripheralManager> pman(new PeripheralManager); + android::String8 interface_desc(pman->getInterfaceDescriptor()); + binder_wrapper()->SetBinderForService(interface_desc.string(), pman); + SpiManager* man = SpiManager::GetSpiManager(); man->GetSpiDevBuses(); @@ -53,7 +58,6 @@ class SpiTest : public ::testing::Test { void TearDown() { SpiManager::ResetSpiManager(); } private: - PeripheralManager pman_; FakeDeviceFactory device_factory_; }; @@ -186,7 +190,7 @@ TEST_F(SpiTest, CantOpenDeviceTwice) { TEST_F(SpiTest, CantOpenUnknownDevice) { BPeripheralManagerClient* client = BPeripheralManagerClient_new(); - BSpiDevice* device; + BSpiDevice* device = nullptr; ASSERT_EQ( ENODEV, BPeripheralManagerClient_openSpiDevice(client, "SPI_UNKOWN", &device)); |