Loading audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp +23 −10 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include <fcntl.h> #include <unistd.h> #include <hwbinder/IPCThreadState.h> #include <VtsHalHidlTargetTestBase.h> #include <android-base/logging.h> Loading @@ -55,13 +57,14 @@ using std::vector; using std::list; using ::android::sp; using ::android::hardware::Return; using ::android::hardware::hidl_bitfield; using ::android::hardware::hidl_enum_range; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::IPCThreadState; using ::android::hardware::MQDescriptorSync; using ::android::hardware::Return; using ::android::hardware::audio::V4_0::AudioDrain; using ::android::hardware::audio::V4_0::DeviceAddress; using ::android::hardware::audio::V4_0::IDevice; Loading Loading @@ -164,6 +167,7 @@ TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) { TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) { doc::test("Calling openDevice(\"primary\") should return the primary device."); { Result result; sp<IDevice> baseDevice; ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice))); Loading @@ -173,6 +177,15 @@ TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) { Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice); ASSERT_TRUE(primaryDevice.isOk()); ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr); } // Destroy local IDevice proxy // FIXME: there is no way to know when the remote IDevice is being destroyed // Binder does not support testing if an object is alive, thus // wait for 100ms to let the binder destruction propagates and // the remote device has the time to be destroyed. // flushCommand makes sure all local command are sent, thus should reduce // the latency between local and remote destruction. IPCThreadState::self()->flushCommands(); usleep(100); } ////////////////////////////////////////////////////////////////////////////// Loading Loading
audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp +23 −10 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include <fcntl.h> #include <unistd.h> #include <hwbinder/IPCThreadState.h> #include <VtsHalHidlTargetTestBase.h> #include <android-base/logging.h> Loading @@ -55,13 +57,14 @@ using std::vector; using std::list; using ::android::sp; using ::android::hardware::Return; using ::android::hardware::hidl_bitfield; using ::android::hardware::hidl_enum_range; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::IPCThreadState; using ::android::hardware::MQDescriptorSync; using ::android::hardware::Return; using ::android::hardware::audio::V4_0::AudioDrain; using ::android::hardware::audio::V4_0::DeviceAddress; using ::android::hardware::audio::V4_0::IDevice; Loading Loading @@ -164,6 +167,7 @@ TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) { TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) { doc::test("Calling openDevice(\"primary\") should return the primary device."); { Result result; sp<IDevice> baseDevice; ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice))); Loading @@ -173,6 +177,15 @@ TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) { Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice); ASSERT_TRUE(primaryDevice.isOk()); ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr); } // Destroy local IDevice proxy // FIXME: there is no way to know when the remote IDevice is being destroyed // Binder does not support testing if an object is alive, thus // wait for 100ms to let the binder destruction propagates and // the remote device has the time to be destroyed. // flushCommand makes sure all local command are sent, thus should reduce // the latency between local and remote destruction. IPCThreadState::self()->flushCommands(); usleep(100); } ////////////////////////////////////////////////////////////////////////////// Loading