Loading automotive/audiocontrol/1.0/vts/functional/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -25,5 +25,8 @@ cc_test { static_libs: [ "android.hardware.automotive.audiocontrol@1.0", ], test_suites: ["general-tests"], test_suites: [ "general-tests", "vts", ], } automotive/audiocontrol/1.0/vts/functional/VtsHalAudioControlV1_0TargetTest.cpp +15 −27 Original line number Diff line number Diff line Loading @@ -25,11 +25,12 @@ #include <utils/Errors.h> #include <utils/StrongPointer.h> #include <android/hardware/automotive/audiocontrol/1.0/types.h> #include <android/hardware/automotive/audiocontrol/1.0/IAudioControl.h> #include <android/hardware/automotive/audiocontrol/1.0/types.h> #include <android/log.h> #include <VtsHalHidlTargetTestBase.h> #include <gtest/gtest.h> #include <hidl/GtestPrinter.h> #include <hidl/ServiceManagement.h> using namespace ::android::hardware::automotive::audiocontrol::V1_0; using ::android::hardware::Return; Loading @@ -40,30 +41,12 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::sp; // Boiler plate for test harness class CarAudioControlHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { public: // get the test environment singleton static CarAudioControlHidlEnvironment* Instance() { static CarAudioControlHidlEnvironment* instance = new CarAudioControlHidlEnvironment; return instance; } virtual void registerTestServices() override { registerTestService<IAudioControl>(); } private: CarAudioControlHidlEnvironment() {} }; // The main test class for the automotive AudioControl HAL class CarAudioControlHidlTest : public ::testing::VtsHalHidlTargetTestBase { class CarAudioControlHidlTest : public ::testing::TestWithParam<std::string> { public: virtual void SetUp() override { // Make sure we can connect to the driver pAudioControl = ::testing::VtsHalHidlTargetTestBase::getService<IAudioControl>( CarAudioControlHidlEnvironment::Instance()-> getServiceName<IAudioControl>()); pAudioControl = IAudioControl::getService(GetParam()); ASSERT_NE(pAudioControl.get(), nullptr); } Loading @@ -82,7 +65,7 @@ public: * fader actually works. The only thing we can do is exercise the HAL and if the HAL crashes, * we _might_ get a test failure if that breaks the connection to the driver. */ TEST_F(CarAudioControlHidlTest, FaderExercise) { TEST_P(CarAudioControlHidlTest, FaderExercise) { ALOGI("Fader exercise test (silent)"); // Set the fader all the way to the back Loading @@ -104,7 +87,7 @@ TEST_F(CarAudioControlHidlTest, FaderExercise) { /* * Balance exercise test. */ TEST_F(CarAudioControlHidlTest, BalanceExercise) { TEST_P(CarAudioControlHidlTest, BalanceExercise) { ALOGI("Balance exercise test (silent)"); // Set the balance all the way to the left Loading @@ -126,7 +109,7 @@ TEST_F(CarAudioControlHidlTest, BalanceExercise) { /* * Context mapping test. */ TEST_F(CarAudioControlHidlTest, ContextMapping) { TEST_P(CarAudioControlHidlTest, ContextMapping) { ALOGI("Context mapping test"); int bus = -1; Loading Loading @@ -156,3 +139,8 @@ TEST_F(CarAudioControlHidlTest, ContextMapping) { bus = pAudioControl->getBusForContext((ContextNumber)~0); EXPECT_EQ(bus, -1); } INSTANTIATE_TEST_SUITE_P( PerInstance, CarAudioControlHidlTest, testing::ValuesIn(android::hardware::getAllHalInstanceNames(IAudioControl::descriptor)), android::hardware::PrintInstanceNameToString); No newline at end of file Loading
automotive/audiocontrol/1.0/vts/functional/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -25,5 +25,8 @@ cc_test { static_libs: [ "android.hardware.automotive.audiocontrol@1.0", ], test_suites: ["general-tests"], test_suites: [ "general-tests", "vts", ], }
automotive/audiocontrol/1.0/vts/functional/VtsHalAudioControlV1_0TargetTest.cpp +15 −27 Original line number Diff line number Diff line Loading @@ -25,11 +25,12 @@ #include <utils/Errors.h> #include <utils/StrongPointer.h> #include <android/hardware/automotive/audiocontrol/1.0/types.h> #include <android/hardware/automotive/audiocontrol/1.0/IAudioControl.h> #include <android/hardware/automotive/audiocontrol/1.0/types.h> #include <android/log.h> #include <VtsHalHidlTargetTestBase.h> #include <gtest/gtest.h> #include <hidl/GtestPrinter.h> #include <hidl/ServiceManagement.h> using namespace ::android::hardware::automotive::audiocontrol::V1_0; using ::android::hardware::Return; Loading @@ -40,30 +41,12 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::sp; // Boiler plate for test harness class CarAudioControlHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { public: // get the test environment singleton static CarAudioControlHidlEnvironment* Instance() { static CarAudioControlHidlEnvironment* instance = new CarAudioControlHidlEnvironment; return instance; } virtual void registerTestServices() override { registerTestService<IAudioControl>(); } private: CarAudioControlHidlEnvironment() {} }; // The main test class for the automotive AudioControl HAL class CarAudioControlHidlTest : public ::testing::VtsHalHidlTargetTestBase { class CarAudioControlHidlTest : public ::testing::TestWithParam<std::string> { public: virtual void SetUp() override { // Make sure we can connect to the driver pAudioControl = ::testing::VtsHalHidlTargetTestBase::getService<IAudioControl>( CarAudioControlHidlEnvironment::Instance()-> getServiceName<IAudioControl>()); pAudioControl = IAudioControl::getService(GetParam()); ASSERT_NE(pAudioControl.get(), nullptr); } Loading @@ -82,7 +65,7 @@ public: * fader actually works. The only thing we can do is exercise the HAL and if the HAL crashes, * we _might_ get a test failure if that breaks the connection to the driver. */ TEST_F(CarAudioControlHidlTest, FaderExercise) { TEST_P(CarAudioControlHidlTest, FaderExercise) { ALOGI("Fader exercise test (silent)"); // Set the fader all the way to the back Loading @@ -104,7 +87,7 @@ TEST_F(CarAudioControlHidlTest, FaderExercise) { /* * Balance exercise test. */ TEST_F(CarAudioControlHidlTest, BalanceExercise) { TEST_P(CarAudioControlHidlTest, BalanceExercise) { ALOGI("Balance exercise test (silent)"); // Set the balance all the way to the left Loading @@ -126,7 +109,7 @@ TEST_F(CarAudioControlHidlTest, BalanceExercise) { /* * Context mapping test. */ TEST_F(CarAudioControlHidlTest, ContextMapping) { TEST_P(CarAudioControlHidlTest, ContextMapping) { ALOGI("Context mapping test"); int bus = -1; Loading Loading @@ -156,3 +139,8 @@ TEST_F(CarAudioControlHidlTest, ContextMapping) { bus = pAudioControl->getBusForContext((ContextNumber)~0); EXPECT_EQ(bus, -1); } INSTANTIATE_TEST_SUITE_P( PerInstance, CarAudioControlHidlTest, testing::ValuesIn(android::hardware::getAllHalInstanceNames(IAudioControl::descriptor)), android::hardware::PrintInstanceNameToString); No newline at end of file