diff --git a/bluetooth/a2dp/1.0/vts/functional/Android.bp b/bluetooth/a2dp/1.0/vts/functional/Android.bp index e50e16730a..5b8410adc5 100644 --- a/bluetooth/a2dp/1.0/vts/functional/Android.bp +++ b/bluetooth/a2dp/1.0/vts/functional/Android.bp @@ -23,5 +23,5 @@ cc_test { "android.hardware.bluetooth.a2dp@1.0", "libbluetooth-types", ], - test_suites: ["general-tests"], + test_suites: ["general-tests", "vts-core"], } diff --git a/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp b/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp index d8d0c29828..44b138a894 100644 --- a/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp +++ b/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp @@ -19,12 +19,14 @@ #include #include #include +#include #include +#include +#include +#include #include #include -#include -#include using ::android::sp; using ::android::hardware::Return; @@ -38,34 +40,12 @@ using ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload; using ::android::hardware::bluetooth::a2dp::V1_0::SampleRate; using ::android::hardware::bluetooth::a2dp::V1_0::Status; -// Test environment for Bluetooth HIDL A2DP HAL. -class BluetoothA2dpHidlEnvironment - : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static BluetoothA2dpHidlEnvironment* Instance() { - static BluetoothA2dpHidlEnvironment* instance = - new BluetoothA2dpHidlEnvironment; - return instance; - } - - virtual void registerTestServices() override { - registerTestService(); - } - - private: - BluetoothA2dpHidlEnvironment() {} -}; - // The main test class for Bluetooth A2DP HIDL HAL. -class BluetoothA2dpHidlTest : public ::testing::VtsHalHidlTargetTestBase { +class BluetoothA2dpHidlTest : public ::testing::TestWithParam { public: virtual void SetUp() override { // currently test passthrough mode only - audio_offload = - ::testing::VtsHalHidlTargetTestBase::getService( - BluetoothA2dpHidlEnvironment::Instance() - ->getServiceName()); + audio_offload = IBluetoothAudioOffload::getService(GetParam()); ASSERT_NE(audio_offload, nullptr); audio_host = new BluetoothAudioHost(*this); @@ -115,19 +95,16 @@ class BluetoothA2dpHidlTest : public ::testing::VtsHalHidlTargetTestBase { }; // Empty test: Initialize()/Close() are called in SetUp()/TearDown(). -TEST_F(BluetoothA2dpHidlTest, InitializeAndClose) {} +TEST_P(BluetoothA2dpHidlTest, InitializeAndClose) {} // Test start and end session -TEST_F(BluetoothA2dpHidlTest, StartAndEndSession) { +TEST_P(BluetoothA2dpHidlTest, StartAndEndSession) { EXPECT_EQ(Status::SUCCESS, audio_offload->startSession(audio_host, codec)); audio_offload->endSession(); } -int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(BluetoothA2dpHidlEnvironment::Instance()); - ::testing::InitGoogleTest(&argc, argv); - BluetoothA2dpHidlEnvironment::Instance()->init(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -} +INSTANTIATE_TEST_SUITE_P( + PerInstance, BluetoothA2dpHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + IBluetoothAudioOffload::descriptor)), + android::hardware::PrintInstanceNameToString); \ No newline at end of file