Loading audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp +48 −0 Original line number Diff line number Diff line Loading @@ -47,3 +47,51 @@ TEST_P(AudioHidlDeviceTest, SetConnectedState_7_1) { // initial state. To workaround this, destroy the HAL at the end of this test. ASSERT_TRUE(resetDevice()); } class LatencyModeOutputStreamTest : public OutputStreamTest { protected: void SetUp() override { OutputStreamTest::SetUp(); Result res; EXPECT_OK(stream->getRecommendedLatencyModes(returnIn(res, mSupportedLatencyModes))); EXPECT_RESULT(okOrNotSupported, res); if (res == Result::NOT_SUPPORTED) { GTEST_SKIP() << "latency mode is not supported"; // returns } } hidl_vec<LatencyMode> mSupportedLatencyModes; }; TEST_P(LatencyModeOutputStreamTest, GetRecommendedLatencyModes) { doc::test("Verify that reported latency modes are valid when supported"); for (auto mode : mSupportedLatencyModes) { ASSERT_TRUE(mode >= LatencyMode::FREE && mode <= LatencyMode::LOW); } } TEST_P(LatencyModeOutputStreamTest, SetValidLatencyMode) { doc::test("Verify that setting valid latency modes works when supported"); for (auto mode : mSupportedLatencyModes) { EXPECT_OK(stream->setLatencyMode(mode)); } } TEST_P(LatencyModeOutputStreamTest, SetInValidLatencyMode) { doc::test("Verify that setting invalid latency modes fails"); EXPECT_RESULT(invalidArgsOrNotSupported, stream->setLatencyMode(static_cast<LatencyMode>(1977))); } /** Stub implementation of IStreamOutEventCallback **/ class MockOutLatencyModeCallback : public IStreamOutLatencyModeCallback { Return<void> onRecommendedLatencyModeChanged( const hidl_vec<LatencyMode>& hidlModes __unused) override { return {}; } }; TEST_P(LatencyModeOutputStreamTest, SetLatencyModeCallback) { doc::test("Verify that setting a latency mode callback works when supported"); EXPECT_OK(stream->setLatencyModeCallback(new MockOutLatencyModeCallback)); EXPECT_OK(stream->setLatencyModeCallback(nullptr)); } audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +1 −1 Original line number Diff line number Diff line Loading @@ -1010,6 +1010,7 @@ class StreamWriter : public StreamWorker<StreamWriter> { class OutputStreamTest : public OpenStreamTest<::android::hardware::audio::CPP_VERSION::IStreamOut> { protected: void SetUp() override { ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base #if MAJOR_VERSION <= 6 Loading @@ -1035,7 +1036,6 @@ class OutputStreamTest } #if MAJOR_VERSION >= 4 && MAJOR_VERSION <= 6 protected: const SourceMetadata initMetadata = { { { AudioUsage::MEDIA, AudioContentType::MUSIC, Loading Loading
audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp +48 −0 Original line number Diff line number Diff line Loading @@ -47,3 +47,51 @@ TEST_P(AudioHidlDeviceTest, SetConnectedState_7_1) { // initial state. To workaround this, destroy the HAL at the end of this test. ASSERT_TRUE(resetDevice()); } class LatencyModeOutputStreamTest : public OutputStreamTest { protected: void SetUp() override { OutputStreamTest::SetUp(); Result res; EXPECT_OK(stream->getRecommendedLatencyModes(returnIn(res, mSupportedLatencyModes))); EXPECT_RESULT(okOrNotSupported, res); if (res == Result::NOT_SUPPORTED) { GTEST_SKIP() << "latency mode is not supported"; // returns } } hidl_vec<LatencyMode> mSupportedLatencyModes; }; TEST_P(LatencyModeOutputStreamTest, GetRecommendedLatencyModes) { doc::test("Verify that reported latency modes are valid when supported"); for (auto mode : mSupportedLatencyModes) { ASSERT_TRUE(mode >= LatencyMode::FREE && mode <= LatencyMode::LOW); } } TEST_P(LatencyModeOutputStreamTest, SetValidLatencyMode) { doc::test("Verify that setting valid latency modes works when supported"); for (auto mode : mSupportedLatencyModes) { EXPECT_OK(stream->setLatencyMode(mode)); } } TEST_P(LatencyModeOutputStreamTest, SetInValidLatencyMode) { doc::test("Verify that setting invalid latency modes fails"); EXPECT_RESULT(invalidArgsOrNotSupported, stream->setLatencyMode(static_cast<LatencyMode>(1977))); } /** Stub implementation of IStreamOutEventCallback **/ class MockOutLatencyModeCallback : public IStreamOutLatencyModeCallback { Return<void> onRecommendedLatencyModeChanged( const hidl_vec<LatencyMode>& hidlModes __unused) override { return {}; } }; TEST_P(LatencyModeOutputStreamTest, SetLatencyModeCallback) { doc::test("Verify that setting a latency mode callback works when supported"); EXPECT_OK(stream->setLatencyModeCallback(new MockOutLatencyModeCallback)); EXPECT_OK(stream->setLatencyModeCallback(nullptr)); }
audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +1 −1 Original line number Diff line number Diff line Loading @@ -1010,6 +1010,7 @@ class StreamWriter : public StreamWorker<StreamWriter> { class OutputStreamTest : public OpenStreamTest<::android::hardware::audio::CPP_VERSION::IStreamOut> { protected: void SetUp() override { ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base #if MAJOR_VERSION <= 6 Loading @@ -1035,7 +1036,6 @@ class OutputStreamTest } #if MAJOR_VERSION >= 4 && MAJOR_VERSION <= 6 protected: const SourceMetadata initMetadata = { { { AudioUsage::MEDIA, AudioContentType::MUSIC, Loading